Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Lib/plat-mac/macresource.py

    r2 r391  
    5252        # If we're main we look in the current directory
    5353        searchdirs = [os.curdir]
    54     if sys.modules.has_key(modname):
     54    if modname in sys.modules:
    5555        mod = sys.modules[modname]
    5656        if hasattr(mod, '__file__'):
     
    7878    """Open a resource file given by pathname, possibly decoding an
    7979    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.
    8083    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"
    9988            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)
    10194
    10295def resource_pathname(pathname, verbose=0):
     
    10497    If the pathname given already refers to such a file simply return it,
    10598    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.
    106102    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"
    125107            raise
     108    else:
     109        return refno
     110    # Finally try decoding an AppleSingle file
     111    pathname = _decode(pathname, verbose=verbose)
    126112    return pathname
    127113
Note: See TracChangeset for help on using the changeset viewer.