itstool: fix double-shebang issue on macOS
This commit is contained in:
parent
edaa972160
commit
da7ac56575
@ -1,4 +1,4 @@
|
|||||||
{ stdenv, fetchurl, python3 }:
|
{ stdenv, lib, fetchurl, python3 }:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "itstool-2.0.6";
|
name = "itstool-2.0.6";
|
||||||
@ -10,6 +10,22 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
buildInputs = [ (python3.withPackages(ps: with ps; [ libxml2 ])) ];
|
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 = {
|
meta = {
|
||||||
homepage = http://itstool.org/;
|
homepage = http://itstool.org/;
|
||||||
description = "XML to PO and back again";
|
description = "XML to PO and back again";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user