summary refs log tree commit diff
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2015-07-07 18:25:10 +0200
committeraszlig <aszlig@redmoonstudios.org>2015-07-07 18:25:10 +0200
commitb028c14256d08c1dcb5a26f37edc879885cac20d (patch)
tree37bf3fd932c34e69c91084140914aaa3093aba7b
parentafb7655c6854151d84427f1c04600032ad12cace (diff)
downloadnixpkgs-b028c14256d08c1dcb5a26f37edc879885cac20d.tar
nixpkgs-b028c14256d08c1dcb5a26f37edc879885cac20d.tar.gz
nixpkgs-b028c14256d08c1dcb5a26f37edc879885cac20d.tar.bz2
nixpkgs-b028c14256d08c1dcb5a26f37edc879885cac20d.tar.lz
nixpkgs-b028c14256d08c1dcb5a26f37edc879885cac20d.tar.xz
nixpkgs-b028c14256d08c1dcb5a26f37edc879885cac20d.tar.zst
nixpkgs-b028c14256d08c1dcb5a26f37edc879885cac20d.zip
python-wrapper: Fix variable name for sed expr.
Regression introduced by 5f557885313088a235762d3cb7fd76ec0b1e6547.

The commit not only changes documentation, but also changed a few
variable names. One of them is $i which now is $f and it contains the
name of the file to wrap.

This was accidentally found by @Profpatsch (thanks!) who found himself
getting the basename of the last patch file to end up in sys.argv[0].
The reason for this is that $i is used in the for loop of the generic
patchPhase and thus is reused later when the Python file is to be
wrapped.

I have also added a small comment noting about this, to be sure that
this won't accidentally occur the next time someone changes variable
names.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
-rw-r--r--pkgs/development/python-modules/generic/wrap.sh3
-rw-r--r--pkgs/top-level/python-packages.nix2
2 files changed, 4 insertions, 1 deletions
diff --git a/pkgs/development/python-modules/generic/wrap.sh b/pkgs/development/python-modules/generic/wrap.sh
index 33b9a06f608..b6d2a66afff 100644
--- a/pkgs/development/python-modules/generic/wrap.sh
+++ b/pkgs/development/python-modules/generic/wrap.sh
@@ -37,6 +37,9 @@ wrapPythonProgramsIn() {
             # dont wrap EGG-INFO scripts since they are called from python
             if echo "$f" | grep -qv EGG-INFO/scripts; then
                 echo "wrapping \`$f'..."
+                # The magicalSedExpression will invoke a "$(basename "$f")", so
+                # if you change $f to something else, be sure to also change it
+                # in pkgs/top-level/python-packages.nix!
                 sed -i "$f" -re '@magicalSedExpression@'
                 # wrapProgram creates the executable shell script described
                 # above. The script will set PYTHONPATH and PATH variables.!
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index d2aecc94158..3e9e07361dc 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -68,7 +68,7 @@ let
           /\\$/{N;br}
           /__future__|^ *(#.*)?$/{n;br}
           ${concatImapStrings mkStringSkipper quoteVariants}
-          /^ *[^# ]/i import sys; sys.argv[0] = '"'$(basename "$i")'"'
+          /^ *[^# ]/i import sys; sys.argv[0] = '"'$(basename "$f")'"'
         }
       '';
     }