Commits

Ronald Oussoren committed 0b506a3

Use /System/Library/Frameworks/CFNetwork.framework when available

(This is the location on OSX 10.8 or later, the old location also
works but might fail in later releases)

  • Participants
  • Parent commits deb310c

Comments (0)

Files changed (1)

File pyobjc-framework-CFNetwork/Lib/CFNetwork/__init__.py

 
 import sys
 import objc
+import os
 import CoreFoundation
 
 from CFNetwork import _metadata
 def CFSocketStreamSOCKSGetErrorSubdomain(err):
     return (err.error >> 16) & 0xFFFF
 
+frameworkPath = "/System/Library/Frameworks/CFNetwork.framework"
+if not os.path.exists(frameworkPath):
+    frameworkPath = "/System/Library/Frameworks/CoreServices.framework/Frameworks/CFNetwork.framework"
+
+
 sys.modules['CFNetwork'] = mod = objc.ObjCLazyModule(
     "CFNetwork", "com.apple.CFNetwork",
-    objc.pathForFramework("/System/Library/Frameworks/CoreServices.framework/Frameworks/CFNetwork.framework"),
+    objc.pathForFramework(frameworkPath),
     _metadata.__dict__, None, {
         '__doc__': __doc__,
         'objc': objc,