From 24ef871e6a1c858af3f9984a5b526c83b24520ed Mon Sep 17 00:00:00 2001 From: Christian Theune Date: Sun, 27 Jul 2014 10:50:36 +0000 Subject: [PATCH] python: fix argv[0] for wrapped console_scripts. Previously programs would see '.-wrapped' as their program name. This is a workaround but should be reasonably safe and reliable. --- pkgs/development/python-modules/generic/wrap.sh | 1 + 1 file changed, 1 insertion(+) 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