Closed Bug 820285 Opened 13 years ago Closed 13 years ago

bootstrap.py fails on OS X if no point release version

Categories

(Firefox Build System :: General, defect)

All
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla20

People

(Reporter: gps, Assigned: jlmendezbonini)

Details

Attachments

(1 file, 1 obsolete file)

STR: 1) Install OS X 10.8.0 2) Run bootstrap.py Traceback (most recent call last): File "python/mozboot/bin/bootstrap.py", line 138, in <module> sys.exit(main(sys.argv)) File "python/mozboot/bin/bootstrap.py", line 129, in main dasboot.bootstrap() File "python/mozboot/mozboot/bootstrap.py", line 61, in bootstrap major, minor, point = map(int, platform.mac_ver()[0].split('.')) ValueError: need more than 2 values to unpack unknowne4ce8f42347a:mozilla-central-hg gps$ python Python 2.7.2 (default, Jun 20 2012, 16:23:33) [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import platform >>> platform.mac_ver() ('10.8', ('', '', ''), 'x86_64') Should be a trivial fix.
Instead of converting the os version to integers, I decided to keep it as a string. All the subsequent version comparisons are also done with strings within osx.py
Attachment #691536 - Flags: review?(gps)
Comment on attachment 691536 [details] [diff] [review] Keeps OSX version as a string instead of converting it to ints. Review of attachment 691536 [details] [diff] [review]: ----------------------------------------------------------------- String comparison will fail when OS X 10.10 is released because "10.10" < "10.7" Please retain the integer conversion and deal with the case where len(platform.mac_ver()[0]) < 3. FWIW, there exists distutils.version.StrictVersion to perform version comparisons. However, I believe this isn't available in Python 2.5 and the bootstrapper currently needs to support 2.5+. If I'm wrong and this is available in Python 2.5 core, I'll accept a patch that uses StrictVersion.
Attachment #691536 - Flags: review?(gps) → review-
Hi Greg, Thanks for the feedback and sorry for that dumb mistake. For some reason Python2.5 docs don't mention distutils.version.StrictVersion but it's indeed available (http://pydoc.org/get.cgi/usr/local/lib/python2.5/distutils/version.py). It's even the exact same implementation as Python2.7.3. Also, I noticed that you were already using distutils.version.StrictVersion within osx.py.
So, I think the options are: a) Switch everything to use StrictVersion b) Handle when len(platform.mac_ver()[0])) < 3 a is more robust but more work. Your call.
I implemented the solution using distutils.version.StrictVersion and I'll appreciate your feedback. However, it's important to note that while testing with Python2.5 I ran into some syntax errors in python/mozboot/bin/bootstrap.py, python/mozboot/mozboot/bootstrap.py, and python/mozboot/mozboot/osx.py that are not part of this patch. I did manage to test with Python2.6 and Python2.7.
Attachment #691536 - Attachment is obsolete: true
Attachment #691598 - Flags: review?(gps)
Comment on attachment 691598 [details] [diff] [review] Use distutils.version.StrictVersion in OSX version tests. Review of attachment 691598 [details] [diff] [review]: ----------------------------------------------------------------- Looks good to me! I was wrong about Python 2.5. The minimum we need to support is Python 2.6.1 (which is shipped on OS X 10.6). I'll check this in for you.
Attachment #691598 - Flags: review?(gps) → review+
Awesome. Thanks Greg.
Assignee: nobody → jlmendezbonini
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla20
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: