Closed Bug 985078 Opened 11 years ago Closed 11 years ago

update merge_helper.py to work in releng environment

Categories

(Release Engineering :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: hwine, Assigned: hwine)

References

Details

Attachments

(1 file)

We got the script from RelMan -- need to move into our repo and tweak.
While this script is scheduled to be replaced prior to next merge day, it's broken as is, and fails after some work is done. This change prevents it from running when it should not.
Attachment #8393279 - Flags: review?(aki)
Comment on attachment 8393279 [details] [diff] [review] merge_helper.diff I think you want if sys.version_info < (2, 7): http://stackoverflow.com/questions/446052/python-best-way-to-check-for-python-version-in-a-program-that-uses-new-language >>> import sys >>> sys.version '2.7.3 (default, Dec 31 2012, 11:22:44) \n[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))]' >>> 2.8 > sys.version False >>> 2.7 > sys.version False >>> sys.version_info sys.version_info(major=2, minor=7, micro=3, releaselevel='final', serial=0) >>> sys.version_info < (2, 8) True >>> sys.version_info < (2, 7) False
(In reply to Aki Sasaki [:aki] from comment #2) > Comment on attachment 8393279 [details] [diff] [review] > merge_helper.diff > > I think you want > > if sys.version_info < (2, 7): that would work as well > http://stackoverflow.com/questions/446052/python-best-way-to-check-for- > python-version-in-a-program-that-uses-new-language not quite on topic - the recommendation is to test for feature, not version number, which I agree with, but is more involved than needed here. And it also points out that this really doesn't work for 2.5 as the script uses 'with', so script bails on syntax error. That's good enough for this case, as the goal is to avoid a bail after tagging is done and pushed. > >>> import sys > >>> sys.version > '2.7.3 (default, Dec 31 2012, 11:22:44) \n[GCC 4.2.1 Compatible Apple Clang > 4.1 ((tags/Apple/clang-421.11.66))]' > >>> 2.8 > sys.version > False Ah, but that's not what I have -- I'm doing a string comparison, so it's lexical ordering, which works: $ for v in 5 6 7; do echo -n "python2.$v: " ; python2.$v -c 'import sys; print "2.7" > sys.version' ; done python2.5: True python2.6: True python2.7: False That said, a sys.version check _is_ old school, sys.version_info has been around since 2.0 -- r+ if I switch to "if (2,7) > sys.version_info" ?
Comment on attachment 8393279 [details] [diff] [review] merge_helper.diff Ah, the string comparison does work. I think I prefer (2, 7) > sys.version_info but since your patch works it's more bikeshed than requirement.
Attachment #8393279 - Flags: review?(aki) → review+
Comment on attachment 8393279 [details] [diff] [review] merge_helper.diff checked in with tweak to more modern sys.version_info < (2, 7) http://hg.mozilla.org/build/braindump/rev/5e13a9713d25
Attachment #8393279 - Flags: checked-in+
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Component: Tools → General
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: