[Pyobjc-dev] problems in bridge metadata lookup
Brought to you by:
ronaldoussoren
|
From: scott h. <sc...@ya...> - 2008-01-23 17:28:47
|
In trying to use some bridgesupport files that I generated, I came
across a couple problems that prevented files under /Library or ~/
Library from being found.
objc.initFrameworkWrapper throws a NameError when the bridgesupport
file is in /Library/BridgeSupport. It throws an ImportError when the
bridgesupport file is in ~/Library/BridgeSupport.
The former looks like a typo in objc/_bridgesupport.py where
"framework" is misspelled as "framwork". I think the latter is a
result of not expanding "~" to the user's home directory. Replacing
the path with os.path.expanduser(path) fixes it for me. The patch I'm
using follows.
Scott
--- ORIG/_bridgesupport.py 2008-01-22 17:02:42.000000000 -0500
+++ _bridgesupport.py 2008-01-23 10:57:29.000000000 -0500
@@ -151,12 +151,12 @@
# locations
fn = frameworkName + '.bridgesupport'
for dn in _gBridgeSupportDirectories:
- path = os.path.join(dn, fn)
+ path = os.path.expanduser(os.path.join(dn, fn))
if os.path.exists(path):
data = open(path, 'rb').read()
doc = ET.fromstring(data)
- dylib_path = os.path.join(dn, framworkName + '.dylib')
+ dylib_path = os.path.join(dn, frameworkName + '.dylib')
if os.path.exists(dylib_path):
_parseBridgeSupport(data, globals, frameworkName,
dylib_path)
else:
|