Use wrapPython in postFixup instead of wrapProgram

This commit is contained in:
Doron Behar 2019-10-08 10:20:53 +03:00
parent a45c9f541c
commit d4c7ab3d85

View File

@ -36,41 +36,44 @@ stdenv.mkDerivation rec {
--replace "/etc/init.d" "$out/etc/init.d" --replace "/etc/init.d" "$out/etc/init.d"
''; '';
# This is not exactly specified in upstream's README but it's needed by the
# resulting $out/bin/gaiafusion script
pythonEnv = (if pythonSupport then
pythonPackages.python.withPackages(ps: with ps; [
pyyaml
])
else null);
nativeBuildInputs = [ nativeBuildInputs = [
wafHook wafHook
pkgconfig pkgconfig
swig swig
makeWrapper ]
]; # The gaiafusion binary inside $out/bin needs a shebangs patch, and
# wrapping with the appropriate $PYTHONPATH
++ lib.optionals (pythonSupport) [
pythonPackages.wrapPython
]
;
buildInputs = [ buildInputs = [
libyaml libyaml
qt4 qt4
] ];
propagatedBuildInputs = []
++ lib.optionals (pythonSupport) [ ++ lib.optionals (pythonSupport) [
pythonEnv # This is not exactly specified in upstream's README but it's needed by the
# resulting $out/bin/gaiafusion script
pythonPackages.pyyaml
] ]
; ;
wafConfigureFlags = [
] wafConfigureFlags = []
++ lib.optionals (pythonSupport) [ "--with-python-bindings" ] ++ lib.optionals (pythonSupport) [ "--with-python-bindings" ]
++ lib.optionals (stlfacadeSupport) [ "--with-stlfacade" ] ++ lib.optionals (stlfacadeSupport) [ "--with-stlfacade" ]
++ lib.optionals (assertsSupport) [ "--with-asserts" ] ++ lib.optionals (assertsSupport) [ "--with-asserts" ]
++ lib.optionals (cyclopsSupport) [ "--with-cyclops" ] ++ lib.optionals (cyclopsSupport) [ "--with-cyclops" ]
; ;
# only gaiafusion is a python executable that needs patchShebangs
postInstall = lib.optionalString (pythonSupport) '' postFixup = ''
# We can't use patchShebangs because it will use bare bones $python/bin/python ''
# and we need a python environment with pyyaml + lib.optionalString pythonSupport ''
wrapProgram $out/bin/gaiafusion --prefix PYTHONPATH : $out/${pythonPackages.python.sitePackages}:${pythonEnv}/${pythonPackages.python.sitePackages} wrapPythonPrograms
''; ''
;
meta = with lib; { meta = with lib; {
homepage = "https://github.com/MTG/gaia"; homepage = "https://github.com/MTG/gaia";