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

RESOLVED FIXED in mozilla20

Status

()

Core
Build Config
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: gps, Assigned: jlmendezbonini)

Tracking

Trunk
mozilla20
All
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

5 years ago
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.
(Assignee)

Comment 1

5 years ago
Created attachment 691536 [details] [diff] [review]
Keeps OSX version as a string instead of converting it to ints.

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)
(Reporter)

Comment 2

5 years ago
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-
(Assignee)

Comment 3

5 years ago
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.
(Reporter)

Comment 4

5 years ago
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.
(Assignee)

Comment 5

5 years ago
Created attachment 691598 [details] [diff] [review]
Use distutils.version.StrictVersion in OSX version tests.

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)
(Reporter)

Comment 6

5 years ago
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+
(Assignee)

Comment 7

5 years ago
Awesome. Thanks Greg.
(Reporter)

Comment 8

5 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/6445a79d9795
Assignee: nobody → jlmendezbonini
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla20

Comment 9

5 years ago
https://hg.mozilla.org/mozilla-central/rev/6445a79d9795
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.