about summary refs log tree commit diff
path: root/pkgs/development/tools/misc/itstool
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2020-03-17 15:56:04 +0000
committerFrederik Rietdijk <freddyrietdijk@fridh.nl>2020-04-03 22:05:53 +0200
commit2bec129116d04db2fc817eb5ccb28638e6bdc7b7 (patch)
treea276c8120530ebf7559046a3a8ceba10e96274bf /pkgs/development/tools/misc/itstool
parentda7ac56575d266942308f8ac1b4abc684894f0b4 (diff)
itstool: use wrapPython to fix double shebang on macOS
Diffstat (limited to 'pkgs/development/tools/misc/itstool')
-rw-r--r--pkgs/development/tools/misc/itstool/default.nix20
1 files changed, 5 insertions, 15 deletions
diff --git a/pkgs/development/tools/misc/itstool/default.nix b/pkgs/development/tools/misc/itstool/default.nix
index 6ad76b1dfcd09..e503aac5a28a3 100644
--- a/pkgs/development/tools/misc/itstool/default.nix
+++ b/pkgs/development/tools/misc/itstool/default.nix
@@ -8,22 +8,12 @@ stdenv.mkDerivation rec {
     sha256 = "1acjgf8zlyk7qckdk19iqaca4jcmywd7vxjbcs1mm6kaf8icqcv2";
   };
 
-  buildInputs = [ (python3.withPackages(ps: with ps; [ libxml2 ])) ];
+  pythonPath = [ python3.pkgs.libxml2 ];
+  buildInputs = [ python3 python3.pkgs.libxml2 ];
+  nativeBuildInputs = [ python3.pkgs.wrapPython ];
 
-  # bin/itstool's shebang is "#!${python3.withPackages(...)/bin/python} -s"
-  # withPackages' shebang is "#!#{bash}/bin/bash -e
-  #
-  # macOS won't allow the target of a shebang to be an interpreted script,
-  # causing bin/itstool to get interpreted as bash.
-  #
-  # By prefixing /usr/bin/env to the shebang, we have env fork/exec the python
-  # wrapper, which is perfectly happy to execute an interpreted script.
-  #
-  # However, we don't want to do this on Linux, which only allows one argument
-  # in a shebang.
-  postFixup = lib.optionalString stdenv.isDarwin ''
-    substituteInPlace $out/bin/itstool \
-      --replace "#!/" "#!/usr/bin/env /"
+  postFixup = ''
+    wrapPythonPrograms
   '';
 
   meta = {