Improve pythonSupport handling

Use pythonPackages instead of just python and add an attribute to
python-packages.nix.
This commit is contained in:
Doron Behar 2019-10-05 08:38:15 +03:00
parent cf6dd6cc0c
commit a246b74f21
2 changed files with 12 additions and 7 deletions

View File

@ -7,15 +7,15 @@
, wafHook , wafHook
, makeWrapper , makeWrapper
, qt4 , qt4
, python , pythonPackages
, pythonSupport ? true , pythonSupport ? false
# Default to false since it breaks the build, see https://github.com/MTG/gaia/issues/11 # Default to false since it breaks the build, see https://github.com/MTG/gaia/issues/11
, stlfacadeSupport ? false , stlfacadeSupport ? false
, assertsSupport ? true , assertsSupport ? true
, cyclopsSupport ? true , cyclopsSupport ? true
}: }:
assert pythonSupport -> python != null; assert pythonSupport -> pythonPackages != null;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "gaia"; pname = "gaia";
@ -37,9 +37,9 @@ stdenv.mkDerivation rec {
''; '';
# This is not exactly specified in upstream's README but it's needed by the # This is not exactly specified in upstream's README but it's needed by the
# resultings $out/bin/gaiafusion script # resulting $out/bin/gaiafusion script
pythonEnv = (if pythonSupport then pythonEnv = (if pythonSupport then
python.withPackages(ps: with ps; [ pythonPackages.python.withPackages(ps: with ps; [
pyyaml pyyaml
]) ])
else null); else null);
@ -66,10 +66,10 @@ stdenv.mkDerivation rec {
++ lib.optionals (cyclopsSupport) [ "--with-cyclops" ] ++ lib.optionals (cyclopsSupport) [ "--with-cyclops" ]
; ;
# only gaiafusion is a python executable that needs patchShebangs # only gaiafusion is a python executable that needs patchShebangs
postInstall = lib.optionalString '' postInstall = lib.optionalString (pythonSupport) ''
# We can't use patchShebangs because it will use bare bones $python/bin/python # We can't use patchShebangs because it will use bare bones $python/bin/python
# and we need a python environment with pyyaml # and we need a python environment with pyyaml
wrapProgram $out/bin/gaiafusion --prefix PYTHONPATH : $out/${python.sitePackages}:${pythonEnv}/${python.sitePackages} wrapProgram $out/bin/gaiafusion --prefix PYTHONPATH : $out/${pythonPackages.python.sitePackages}:${pythonEnv}/${pythonPackages.python.sitePackages}
''; '';
meta = with lib; { meta = with lib; {

View File

@ -2372,6 +2372,11 @@ in {
fx2 = callPackage ../development/python-modules/fx2 { }; fx2 = callPackage ../development/python-modules/fx2 { };
gaia = (toPythonModule (pkgs.gaia.override {
pythonPackages = self;
pythonSupport = true;
}));
gateone = callPackage ../development/python-modules/gateone { }; gateone = callPackage ../development/python-modules/gateone { };
GeoIP = callPackage ../development/python-modules/GeoIP { }; GeoIP = callPackage ../development/python-modules/GeoIP { };