fails on OS X if no point release version

RESOLVED FIXED in mozilla20



Build Config
5 years ago
5 years ago


(Reporter: gps, Assigned: jlmendezbonini)


Mac OS X

Firefox Tracking Flags

(Not tracked)



(1 attachment, 1 obsolete attachment)



5 years ago

1) Install OS X 10.8.0
2) Run

Traceback (most recent call last):
  File "python/mozboot/bin/", line 138, in <module>
  File "python/mozboot/bin/", line 129, in main
  File "python/mozboot/mozboot/", 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.

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
Attachment #691536 - Flags: review?(gps)

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-

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 ( It's even the exact same implementation as Python2.7.3.  Also, I noticed that you were already using distutils.version.StrictVersion within

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.

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/, python/mozboot/mozboot/, and python/mozboot/mozboot/ 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 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+

Comment 7

5 years ago
Awesome. Thanks Greg.

Comment 8

5 years ago
Assignee: nobody → jlmendezbonini
Target Milestone: --- → mozilla20

Comment 9

5 years ago
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.