Changeset 391 for python/trunk/Lib/plat-mac/macresource.py
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Lib/plat-mac/macresource.py
r2 r391 52 52 # If we're main we look in the current directory 53 53 searchdirs = [os.curdir] 54 if sys.modules.has_key(modname):54 if modname in sys.modules: 55 55 mod = sys.modules[modname] 56 56 if hasattr(mod, '__file__'): … … 78 78 """Open a resource file given by pathname, possibly decoding an 79 79 AppleSingle file""" 80 # No resource fork. We may be on OSX, and this may be either 81 # a data-fork based resource file or a AppleSingle file 82 # from the CVS repository. 80 83 try: 81 refno = Res.FSpOpenResFile(pathname, 1) 82 except (AttributeError, Res.Error), arg: 83 if isinstance(arg, AttributeError) or arg[0] in (-37, -39): 84 # No resource fork. We may be on OSX, and this may be either 85 # a data-fork based resource file or a AppleSingle file 86 # from the CVS repository. 87 try: 88 refno = Res.FSOpenResourceFile(pathname, u'', 1) 89 except Res.Error, arg: 90 if arg[0] != -199: 91 # -199 is "bad resource map" 92 raise 93 else: 94 return refno 95 # Finally try decoding an AppleSingle file 96 pathname = _decode(pathname, verbose=verbose) 97 refno = Res.FSOpenResourceFile(pathname, u'', 1) 98 else: 84 refno = Res.FSOpenResourceFile(pathname, u'', 1) 85 except Res.Error, arg: 86 if arg[0] != -199: 87 # -199 is "bad resource map" 99 88 raise 100 return refno 89 else: 90 return refno 91 # Finally try decoding an AppleSingle file 92 pathname = _decode(pathname, verbose=verbose) 93 refno = Res.FSOpenResourceFile(pathname, u'', 1) 101 94 102 95 def resource_pathname(pathname, verbose=0): … … 104 97 If the pathname given already refers to such a file simply return it, 105 98 otherwise first decode it.""" 99 # No resource fork. We may be on OSX, and this may be either 100 # a data-fork based resource file or a AppleSingle file 101 # from the CVS repository. 106 102 try: 107 refno = Res.FSpOpenResFile(pathname, 1) 108 Res.CloseResFile(refno) 109 except (AttributeError, Res.Error), arg: 110 if isinstance(arg, AttributeError) or arg[0] in (-37, -39): 111 # No resource fork. We may be on OSX, and this may be either 112 # a data-fork based resource file or a AppleSingle file 113 # from the CVS repository. 114 try: 115 refno = Res.FSOpenResourceFile(pathname, u'', 1) 116 except Res.Error, arg: 117 if arg[0] != -199: 118 # -199 is "bad resource map" 119 raise 120 else: 121 return refno 122 # Finally try decoding an AppleSingle file 123 pathname = _decode(pathname, verbose=verbose) 124 else: 103 refno = Res.FSOpenResourceFile(pathname, u'', 1) 104 except Res.Error, arg: 105 if arg[0] != -199: 106 # -199 is "bad resource map" 125 107 raise 108 else: 109 return refno 110 # Finally try decoding an AppleSingle file 111 pathname = _decode(pathname, verbose=verbose) 126 112 return pathname 127 113
Note:
See TracChangeset
for help on using the changeset viewer.