Merge lp:~gz/bzr/trivial_no_bzr_reinvoke into lp:bzr

Proposed by Martin Packman
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: no longer in the source branch.
Merged at revision: 6412
Proposed branch: lp:~gz/bzr/trivial_no_bzr_reinvoke
Merge into: lp:bzr
Diff against target: 34 lines (+1/-18)
1 file modified
bzr (+1/-18)
To merge this branch: bzr merge lp:~gz/bzr/trivial_no_bzr_reinvoke
Reviewer Review Type Date Requested Status
Vincent Ladeuil Approve
Jelmer Vernooij (community) Approve
Review via email: mp+86245@code.launchpad.net

Commit message

No longer try reinvoking with a newer python version from the bzr script

Description of the change

Removes a trick in the bzr script for switching python interpreter if the wrong one is used.

Since "import warnings" was added, this has been pointless for Python < 2.1 and with "from __future__ import absolute_import" it will also stop working for < 2.5 as well:

<https://code.launchpad.net/~jelmer/bzr/future-absolute-imports/+merge/86164>

Given this can silently hide installation problems and result in worse performance, I think we're better off just complaining and exiting.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve
Revision history for this message
Vincent Ladeuil (vila) wrote :

My eyes stopped bleeding ;)

review: Approve
Revision history for this message
Martin Packman (gz) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzr'
2--- bzr 2011-12-09 17:13:21 +0000
3+++ bzr 2011-12-19 14:16:31 +0000
4@@ -25,29 +25,12 @@
5 # update this on each release
6 _script_version = (2, 5, 0)
7
8-try:
9- version_info = sys.version_info
10-except AttributeError:
11- version_info = 1, 5 # 1.5 or older
12-
13-REINVOKE = "__BZR_REINVOKE"
14 NEED_VERS = (2, 6)
15-KNOWN_PYTHONS = ('python2.6', 'python2.7')
16
17-if version_info < NEED_VERS:
18- if not os.environ.has_key(REINVOKE):
19- # mutating os.environ doesn't work in old Pythons
20- os.putenv(REINVOKE, "1")
21- for python in KNOWN_PYTHONS:
22- try:
23- os.execvp(python, [python] + sys.argv)
24- except OSError:
25- pass
26+if sys.version_info < NEED_VERS:
27 sys.stderr.write("bzr: error: cannot find a suitable python interpreter\n")
28 sys.stderr.write(" (need %d.%d or later)\n" % NEED_VERS)
29 sys.exit(1)
30-if hasattr(os, "unsetenv"):
31- os.unsetenv(REINVOKE)
32
33
34 profiling = False