diff options
author | Ronald Oussoren <ronaldoussoren@mac.com> | 2009-09-06 10:00:26 +0000 |
---|---|---|
committer | Ronald Oussoren <ronaldoussoren@mac.com> | 2009-09-06 10:00:26 +0000 |
commit | 2596758cb42cb592f2e3c33ef77bc9b02c995510 (patch) | |
tree | 78f8869bfd6ec74755463b0f918d2e24d5972465 /Lib/plat-mac/macresource.py | |
parent | f01697014f63e3fbe11f73afe789b6205125cb20 (diff) | |
download | cpython-git-2596758cb42cb592f2e3c33ef77bc9b02c995510.tar.gz |
Fix build issues on OSX 10.6 (issue 6802)
Diffstat (limited to 'Lib/plat-mac/macresource.py')
-rw-r--r-- | Lib/plat-mac/macresource.py | 56 |
1 files changed, 21 insertions, 35 deletions
diff --git a/Lib/plat-mac/macresource.py b/Lib/plat-mac/macresource.py index f02453ba1d..d693c87226 100644 --- a/Lib/plat-mac/macresource.py +++ b/Lib/plat-mac/macresource.py @@ -77,52 +77,38 @@ def need(restype, resid, filename=None, modname=None): def open_pathname(pathname, verbose=0): """Open a resource file given by pathname, possibly decoding an AppleSingle file""" + # No resource fork. We may be on OSX, and this may be either + # a data-fork based resource file or a AppleSingle file + # from the CVS repository. try: - refno = Res.FSpOpenResFile(pathname, 1) + refno = Res.FSOpenResourceFile(pathname, u'', 1) except Res.Error, arg: - if arg[0] in (-37, -39): - # No resource fork. We may be on OSX, and this may be either - # a data-fork based resource file or a AppleSingle file - # from the CVS repository. - try: - refno = Res.FSOpenResourceFile(pathname, u'', 1) - except Res.Error, arg: - if arg[0] != -199: - # -199 is "bad resource map" - raise - else: - return refno - # Finally try decoding an AppleSingle file - pathname = _decode(pathname, verbose=verbose) - refno = Res.FSOpenResourceFile(pathname, u'', 1) - else: + if arg[0] != -199: + # -199 is "bad resource map" raise - return refno + else: + return refno + # Finally try decoding an AppleSingle file + pathname = _decode(pathname, verbose=verbose) + refno = Res.FSOpenResourceFile(pathname, u'', 1) def resource_pathname(pathname, verbose=0): """Return the pathname for a resource file (either DF or RF based). If the pathname given already refers to such a file simply return it, otherwise first decode it.""" + # No resource fork. We may be on OSX, and this may be either + # a data-fork based resource file or a AppleSingle file + # from the CVS repository. try: - refno = Res.FSpOpenResFile(pathname, 1) - Res.CloseResFile(refno) + refno = Res.FSOpenResourceFile(pathname, u'', 1) except Res.Error, arg: - if arg[0] in (-37, -39): - # No resource fork. We may be on OSX, and this may be either - # a data-fork based resource file or a AppleSingle file - # from the CVS repository. - try: - refno = Res.FSOpenResourceFile(pathname, u'', 1) - except Res.Error, arg: - if arg[0] != -199: - # -199 is "bad resource map" - raise - else: - return refno - # Finally try decoding an AppleSingle file - pathname = _decode(pathname, verbose=verbose) - else: + if arg[0] != -199: + # -199 is "bad resource map" raise + else: + return refno + # Finally try decoding an AppleSingle file + pathname = _decode(pathname, verbose=verbose) return pathname def open_error_resource(): |