3
0
Fork 0
forked from mirrors/nixpkgs

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.
This commit is contained in:
Christian Theune 2014-07-27 10:50:36 +00:00 committed by Domen Kožar
parent 077d989ad1
commit 24ef871e6a

View file

@ -26,6 +26,7 @@ wrapPythonProgramsIn() {
# dont wrap EGG-INFO scripts since they are called from python # dont wrap EGG-INFO scripts since they are called from python
if echo "$i" | grep -v EGG-INFO/scripts; then if echo "$i" | grep -v EGG-INFO/scripts; then
echo "wrapping \`$i'..." echo "wrapping \`$i'..."
sed -i "$i" -e "/^#\!/a import sys; sys.argv[0] = '$(basename $i)'"
wrapProgram "$i" \ wrapProgram "$i" \
--prefix PYTHONPATH ":" $program_PYTHONPATH \ --prefix PYTHONPATH ":" $program_PYTHONPATH \
--prefix PATH ":" $program_PATH --prefix PATH ":" $program_PATH