Merge ~cjwatson/launchpad:drop-re-exec into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 8b4ded1d0e2d1076721bb0e2333c2d3d5ac13c4b
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:drop-re-exec
Merge into: launchpad:master
Diff against target: 41 lines (+0/-19)
2 files modified
_pythonpath.py (+0/-12)
setup.py (+0/-7)
Reviewer Review Type Date Requested Status
Ioana Lasc (community) Approve
Review via email: mp+407101@code.launchpad.net

Commit message

Drop code to re-exec scripts with a different Python version

To post a comment you must log in.
Revision history for this message
Ioana Lasc (ilasc) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/_pythonpath.py b/_pythonpath.py
2index 616dcda..0e03ee8 100644
3--- a/_pythonpath.py
4+++ b/_pythonpath.py
5@@ -21,19 +21,7 @@ else:
6 top = os.path.dirname(os.path.abspath(os.path.realpath(filename)))
7
8 env = os.path.join(top, 'env')
9-python_version_path = os.path.join(env, 'python_version')
10-
11-# If the current Python major/minor version doesn't match the virtualenv,
12-# then re-exec. This makes it practical to experiment with switching
13-# between Python 2 and 3 without having to update the #! lines of all our
14-# scripts to match.
15 python_version = '%s.%s' % sys.version_info[:2]
16-with open(python_version_path) as python_version_file:
17- env_python_version = python_version_file.readline().strip()
18-if python_version != env_python_version:
19- env_python = os.path.join(env, 'bin', 'python')
20- os.execl(env_python, env_python, *sys.argv)
21-
22 stdlib_dir = os.path.join(env, 'lib', 'python%s' % python_version)
23
24 if ('site' in sys.modules and
25diff --git a/setup.py b/setup.py
26index 5c4f42d..88d7e51 100644
27--- a/setup.py
28+++ b/setup.py
29@@ -125,13 +125,6 @@ class lp_develop(develop):
30 with open(instance_name_path, "w") as instance_name_file:
31 print(os.environ["LPCONFIG"], file=instance_name_file)
32
33- # Write out the build-time Python major/minor version so that
34- # scripts run with /usr/bin/python3 know whether they need to
35- # re-exec.
36- python_version_path = os.path.join(env_top, "python_version")
37- with open(python_version_path, "w") as python_version_file:
38- print("%s.%s" % sys.version_info[:2], file=python_version_file)
39-
40
41 __version__ = '2.2.3'
42

Subscribers

People subscribed via source and target branches

to status/vote changes: