Hi, I noticed a _potential_ problem with the OSX<10.6 version check. It 
presumes majors won't ever go past 9, which they just did. I know this is 
pre-release and all, but there's no reason why it shouldn't be fixed 
pre-emptively. The problem lies with the fact that the '<' operator is 
being used w/ strings and therefore "10.10" _is_ '<' "10.6".

I have attached a patch (same as inline) which presumes majors and minors 
will never go past 99, easily tweakable for whichever cap you want to use.

diff -r b5cabd481804 pyglet/__init__.py
--- a/pyglet/__init__.py Sat May 31 08:53:39 2014 +0100
+++ b/pyglet/__init__.py Wed Jun 11 14:46:47 2014 +0100
@@ -205,6 +205,12 @@
     'darwin_cocoa': bool,
 }
 
+def _numeric_darwin_platform_version(version_string):
+    import platform
+    osx_version = [int(x) for x in version_string.split(".")]
+    osx_version = sum([a*b for a,b in zip(osx_version, [10000, 100, 1])])
+    return osx_version
+
 def _choose_darwin_platform():
     """Choose between Darwin's Carbon and Cocoa implementations."""
     if compat_platform != 'darwin':
@@ -213,8 +219,9 @@
     numbits = 8*struct.calcsize("P")
     if numbits == 64:
         import platform
-        osx_version = platform.mac_ver()[0]
-        if osx_version < '10.6':
+        osx_version = 
_numeric_darwin_platform_version(platform.mac_ver()[0])
+        min_version = _numeric_darwin_platform_version("10.6")
+        if osx_version < min_version:
             raise Exception('pyglet is not compatible with 64-bit Python 
for versions of Mac OS X prior to 10.6.')
         options['darwin_cocoa'] = True
     else:

Cheers!

Filipe

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.
diff -r b5cabd481804 pyglet/__init__.py
--- a/pyglet/__init__.py	Sat May 31 08:53:39 2014 +0100
+++ b/pyglet/__init__.py	Wed Jun 11 14:46:47 2014 +0100
@@ -205,6 +205,12 @@
     'darwin_cocoa': bool,
 }
 
+def _numeric_darwin_platform_version(version_string):
+    import platform
+    osx_version = [int(x) for x in version_string.split(".")]
+    osx_version = sum([a*b for a,b in zip(osx_version, [10000, 100, 1])])
+    return osx_version
+
 def _choose_darwin_platform():
     """Choose between Darwin's Carbon and Cocoa implementations."""
     if compat_platform != 'darwin':
@@ -213,8 +219,9 @@
     numbits = 8*struct.calcsize("P")
     if numbits == 64:
         import platform
-        osx_version = platform.mac_ver()[0]
-        if osx_version < '10.6':
+        osx_version = _numeric_darwin_platform_version(platform.mac_ver()[0])
+        min_version = _numeric_darwin_platform_version("10.6")
+        if osx_version < min_version:
             raise Exception('pyglet is not compatible with 64-bit Python for versions of Mac OS X prior to 10.6.')
         options['darwin_cocoa'] = True
     else:

Reply via email to