Bug 601150

Summary: python-virtualenv spec should not replace "#!/usr/bin/env python" throughout the script
Product: [Fedora] Fedora EPEL Reporter: Robert Buchholz <rbu>
Component: python-virtualenvAssignee: Steve Milner <smilner>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: el5CC: fschwarz, smilner
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: python-virtualenv-1.4.8-2.fc13 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-06-21 21:28:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Attachments:
Description Flags
Patch to the spec file (includes 1.4.9 upgrade, sorry) none

Description Robert Buchholz 2010-06-07 10:36:42 UTC
Description of problem:
virtualenv --relocatable is creating scripts with a bad shebang (e.g. "2.4"). This is caused by a bad sed call in the spec file that replaces all occurences of "#!/usr/bin/env python" with an empty string. This replacement should only happen on the first line of virtualenv.py

Version-Release number of selected component (if applicable):
1.4.3-2

How reproducible:
Always

Steps to Reproduce:
1. virtualenv ve
2. virtualenv --relocatable ve
3. head ve/bin/easy_install
  
Actual results:
 "2.4"

Expected results:
 "#/usr/bin/env python2.4"

Additional info:
The file as installed by EPEL vs. upstream:

diff -u /usr/lib/python2.4/site-packages/virtualenv.py  egg/virtualenv-1.4.9-py2.4.egg/virtualenv.py
--- /usr/lib/python2.4/site-packages/virtualenv.py      2010-06-07 11:49:16.000000000 +0200
+++ egg/virtualenv-1.4.9-py2.4.egg/virtualenv.py        2010-06-07 11:20:05.000000000 +0200
@@ -1,4 +1,4 @@
-
+#!/usr/bin/env python
 """Create a "virtual" Python installation
 """

@@ -937,7 +937,7 @@
     # This is what we expect at the top of scripts:
     shebang = '#!%s/bin/python' % os.path.normcase(os.path.abspath(home_dir))
     # This is what we'll put:
-    new_shebang = '%s' % sys.version[:3]
+    new_shebang = '#!/usr/bin/env python%s' % sys.version[:3]
     activate = "import os; activate_this=os.path.join(os.path.dirname(__file__), 'activate_this.py'); execfile(activate_this, dict(__file__=activate_this)); del os, activate_this"
     bin_dir = os.path.join(home_dir, 'bin')
     for filename in os.listdir(bin_dir):
@@ -1104,8 +1104,8 @@
         script from that package.

     If you provide something like ``python_version='2.4'`` then the
-    script will start with ``2.4`` instead of
-    ````.  You can use this when the script must
+    script will start with ``#!/usr/bin/env python2.4`` instead of
+    ``#!/usr/bin/env python``.  You can use this when the script must
     be run with a particular Python version.
     """
     filename = __file__

Comment 1 Robert Buchholz 2010-06-07 10:38:13 UTC
Created attachment 421784 [details]
Patch to the spec file (includes 1.4.9 upgrade, sorry)

Comment 2 Steve Milner 2010-06-07 13:56:52 UTC
Thanks, I'll take a look today.

Comment 3 Steve Milner 2010-06-08 18:15:02 UTC
Applied the sed change and verified that relocatable works as you would expect it to based on info from this ticket.

There seems to currently be a dep problem in rawhide (unrelated to the package). Once that is resolved I'll send it through rawhide and to dist testing repos.

Comment 4 Steve Milner 2010-06-08 18:18:49 UTC
Side note, I have not upgraded the package to 1.4.9 yet as there seems to be a descrepency on versions:

1.4.9: http://pypi.python.org/pypi/virtualenv
1.4.8: http://bitbucket.org/ianb/virtualenv


(http://bitbucket.org/ianb/virtualenv/issue/44/pypi-version-bitbucket-openplans-version)

Comment 5 Fedora Update System 2010-06-09 16:03:22 UTC
python-virtualenv-1.4.8-2.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/python-virtualenv-1.4.8-2.fc13

Comment 6 Fedora Update System 2010-06-09 16:03:28 UTC
python-virtualenv-1.4.8-2.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/python-virtualenv-1.4.8-2.fc12

Comment 7 Fedora Update System 2010-06-09 16:03:32 UTC
python-virtualenv-1.4.8-2.el5 has been submitted as an update for Fedora EPEL 5.
http://admin.fedoraproject.org/updates/python-virtualenv-1.4.8-2.el5

Comment 8 Fedora Update System 2010-06-09 16:03:37 UTC
python-virtualenv-1.4.8-2.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/python-virtualenv-1.4.8-2.fc11

Comment 9 Fedora Update System 2010-06-10 19:11:59 UTC
python-virtualenv-1.4.8-2.fc13 has been pushed to the Fedora 13 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update python-virtualenv'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/python-virtualenv-1.4.8-2.fc13

Comment 10 Fedora Update System 2010-06-10 19:12:19 UTC
python-virtualenv-1.4.8-2.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update python-virtualenv'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/python-virtualenv-1.4.8-2.fc12

Comment 11 Fedora Update System 2010-06-10 19:22:40 UTC
python-virtualenv-1.4.8-2.fc11 has been pushed to the Fedora 11 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update python-virtualenv'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/python-virtualenv-1.4.8-2.fc11

Comment 12 Fedora Update System 2010-06-11 23:36:51 UTC
python-virtualenv-1.4.8-2.el5 has been pushed to the Fedora EPEL 5 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update python-virtualenv'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/python-virtualenv-1.4.8-2.el5

Comment 13 Fedora Update System 2010-06-21 21:28:29 UTC
python-virtualenv-1.4.8-2.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2010-06-21 21:32:02 UTC
python-virtualenv-1.4.8-2.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 15 Fedora Update System 2010-06-21 21:34:22 UTC
python-virtualenv-1.4.8-2.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.