← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Colin Watson has proposed merging ~cjwatson/launchpad:drop-re-exec into launchpad:master.

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

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/407101
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:drop-re-exec into launchpad:master.
diff --git a/_pythonpath.py b/_pythonpath.py
index 616dcda..0e03ee8 100644
--- a/_pythonpath.py
+++ b/_pythonpath.py
@@ -21,19 +21,7 @@ else:
 top = os.path.dirname(os.path.abspath(os.path.realpath(filename)))
 
 env = os.path.join(top, 'env')
-python_version_path = os.path.join(env, 'python_version')
-
-# If the current Python major/minor version doesn't match the virtualenv,
-# then re-exec.  This makes it practical to experiment with switching
-# between Python 2 and 3 without having to update the #! lines of all our
-# scripts to match.
 python_version = '%s.%s' % sys.version_info[:2]
-with open(python_version_path) as python_version_file:
-    env_python_version = python_version_file.readline().strip()
-if python_version != env_python_version:
-    env_python = os.path.join(env, 'bin', 'python')
-    os.execl(env_python, env_python, *sys.argv)
-
 stdlib_dir = os.path.join(env, 'lib', 'python%s' % python_version)
 
 if ('site' in sys.modules and
diff --git a/setup.py b/setup.py
index 5c4f42d..88d7e51 100644
--- a/setup.py
+++ b/setup.py
@@ -125,13 +125,6 @@ class lp_develop(develop):
             with open(instance_name_path, "w") as instance_name_file:
                 print(os.environ["LPCONFIG"], file=instance_name_file)
 
-            # Write out the build-time Python major/minor version so that
-            # scripts run with /usr/bin/python3 know whether they need to
-            # re-exec.
-            python_version_path = os.path.join(env_top, "python_version")
-            with open(python_version_path, "w") as python_version_file:
-                print("%s.%s" % sys.version_info[:2], file=python_version_file)
-
 
 __version__ = '2.2.3'