diff options
author | Burke Libbey <burke@libbey.me> | 2019-12-03 16:47:16 -0500 |
---|---|---|
committer | Frederik Rietdijk <freddyrietdijk@fridh.nl> | 2020-04-03 22:05:53 +0200 |
commit | da7ac56575d266942308f8ac1b4abc684894f0b4 (patch) | |
tree | 49e02a05ca0b7a0aef5221e024ca2954c0d611eb | |
parent | edaa972160d05379075ac29db67c879aebc4cb46 (diff) | |
download | nixlib-da7ac56575d266942308f8ac1b4abc684894f0b4.tar nixlib-da7ac56575d266942308f8ac1b4abc684894f0b4.tar.gz nixlib-da7ac56575d266942308f8ac1b4abc684894f0b4.tar.bz2 nixlib-da7ac56575d266942308f8ac1b4abc684894f0b4.tar.lz nixlib-da7ac56575d266942308f8ac1b4abc684894f0b4.tar.xz nixlib-da7ac56575d266942308f8ac1b4abc684894f0b4.tar.zst nixlib-da7ac56575d266942308f8ac1b4abc684894f0b4.zip |
itstool: fix double-shebang issue on macOS
-rw-r--r-- | pkgs/development/tools/misc/itstool/default.nix | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/pkgs/development/tools/misc/itstool/default.nix b/pkgs/development/tools/misc/itstool/default.nix index a5c3623b699c..6ad76b1dfcd0 100644 --- a/pkgs/development/tools/misc/itstool/default.nix +++ b/pkgs/development/tools/misc/itstool/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, python3 }: +{ stdenv, lib, fetchurl, python3 }: stdenv.mkDerivation rec { name = "itstool-2.0.6"; @@ -10,6 +10,22 @@ stdenv.mkDerivation rec { buildInputs = [ (python3.withPackages(ps: with ps; [ libxml2 ])) ]; + # 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 /" + ''; + meta = { homepage = http://itstool.org/; description = "XML to PO and back again"; |