about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Theune <ct@gocept.com>2014-07-27 10:50:36 +0000
committerDomen Kožar <domen@dev.si>2014-07-27 13:23:15 +0200
commit24ef871e6a1c858af3f9984a5b526c83b24520ed (patch)
tree5c8b02ba02d69b15f399539f501c6de3e7bdf471
parent077d989ad14f89ff13349cb4f74977a25f51045a (diff)
downloadnixlib-24ef871e6a1c858af3f9984a5b526c83b24520ed.tar
nixlib-24ef871e6a1c858af3f9984a5b526c83b24520ed.tar.gz
nixlib-24ef871e6a1c858af3f9984a5b526c83b24520ed.tar.bz2
nixlib-24ef871e6a1c858af3f9984a5b526c83b24520ed.tar.lz
nixlib-24ef871e6a1c858af3f9984a5b526c83b24520ed.tar.xz
nixlib-24ef871e6a1c858af3f9984a5b526c83b24520ed.tar.zst
nixlib-24ef871e6a1c858af3f9984a5b526c83b24520ed.zip
python: fix argv[0] for wrapped console_scripts.
Previously programs would see '.<program>-wrapped' as their program name. This is a workaround
but should be reasonably safe and reliable.
-rw-r--r--pkgs/development/python-modules/generic/wrap.sh1
1 files changed, 1 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/generic/wrap.sh b/pkgs/development/python-modules/generic/wrap.sh
index 282aeca9ed1c..dda9f4877f67 100644
--- a/pkgs/development/python-modules/generic/wrap.sh
+++ b/pkgs/development/python-modules/generic/wrap.sh
@@ -26,6 +26,7 @@ wrapPythonProgramsIn() {
             # dont wrap EGG-INFO scripts since they are called from python
             if echo "$i" | grep -v EGG-INFO/scripts; then
                 echo "wrapping \`$i'..."
+                sed -i "$i" -e "/^#\!/a import sys; sys.argv[0] = '$(basename $i)'"
                 wrapProgram "$i" \
                     --prefix PYTHONPATH ":" $program_PYTHONPATH \
                     --prefix PATH ":" $program_PATH