git.iko.soy/typeable/nixpkgs
on master help sign in
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>

commitb028c14256d08c1dcb5a26f37edc879885cac20d authoraszlig <aszlig@redmoonstudios.org> dateTue 7 Jul 2015, 18:25 (11 years ago) parentafb7655
2 files changed+4−1
pkgs/development/python-modules/generic/wrap.sh+3 pkgs/top-level/python-packages.nix+1−1
pkgs/development/python-modules/generic/wrap.sh+3
@@ -37,6 +37,9 @@ wrapPythonProgramsIn() {
3737 # dont wrap EGG-INFO scripts since they are called from python
3838 if echo "$f" | grep -qv EGG-INFO/scripts; then
3939 echo "wrapping \`$f'..."
40+ # The magicalSedExpression will invoke a "$(basename "$f")", so
41+ # if you change $f to something else, be sure to also change it
42+ # in pkgs/top-level/python-packages.nix!
4043 sed -i "$f" -re '@magicalSedExpression@'
4144 # wrapProgram creates the executable shell script described
4245 # above. The script will set PYTHONPATH and PATH variables.!
pkgs/top-level/python-packages.nix+1−1
@@ -68,7 +68,7 @@ let
6868 /\\$/{N;br}
6969 /__future__|^ *(#.*)?$/{n;br}
7070 ${concatImapStrings mkStringSkipper quoteVariants}
71− /^ *[^# ]/i import sys; sys.argv[0] = '"'$(basename "$i")'"'
71+ /^ *[^# ]/i import sys; sys.argv[0] = '"'$(basename "$f")'"'
7272 }
7373 '';
7474 }