Back to index

python3.2  3.2.2
Functions | Variables
ctypes.macholib.framework Namespace Reference

Functions

def framework_info
def test_framework_info

Variables

list __all__ = ['framework_info']
tuple STRICT_FRAMEWORK_RE = re.compile(r"""(?x)(?P<location>^.*)(?:^|/)(?P<name> (?P<shortname>\w+).framework/ (?:Versions/(?P<version>[^/]+)/)? (?P=shortname) (?:_(?P<suffix>[^_]+))?)$""")

Detailed Description

Generic framework path manipulation

Function Documentation

A framework name can take one of the following four forms:
    Location/Name.framework/Versions/SomeVersion/Name_Suffix
    Location/Name.framework/Versions/SomeVersion/Name
    Location/Name.framework/Name_Suffix
    Location/Name.framework/Name

returns None if not found, or a mapping equivalent to:
    dict(
        location='Location',
        name='Name.framework/Versions/SomeVersion/Name_Suffix',
        shortname='Name',
        version='SomeVersion',
        suffix='Suffix',
    )

Note that SomeVersion and Suffix are optional and may be None
if not present

Definition at line 19 of file framework.py.

00019 
00020 def framework_info(filename):
00021     """
00022     A framework name can take one of the following four forms:
00023         Location/Name.framework/Versions/SomeVersion/Name_Suffix
00024         Location/Name.framework/Versions/SomeVersion/Name
00025         Location/Name.framework/Name_Suffix
00026         Location/Name.framework/Name
00027 
00028     returns None if not found, or a mapping equivalent to:
00029         dict(
00030             location='Location',
00031             name='Name.framework/Versions/SomeVersion/Name_Suffix',
00032             shortname='Name',
00033             version='SomeVersion',
00034             suffix='Suffix',
00035         )
00036 
00037     Note that SomeVersion and Suffix are optional and may be None
00038     if not present
00039     """
00040     is_framework = STRICT_FRAMEWORK_RE.match(filename)
00041     if not is_framework:
00042         return None
00043     return is_framework.groupdict()

Here is the caller graph for this function:

Definition at line 44 of file framework.py.

00044 
00045 def test_framework_info():
00046     def d(location=None, name=None, shortname=None, version=None, suffix=None):
00047         return dict(
00048             location=location,
00049             name=name,
00050             shortname=shortname,
00051             version=version,
00052             suffix=suffix
00053         )
00054     assert framework_info('completely/invalid') is None
00055     assert framework_info('completely/invalid/_debug') is None
00056     assert framework_info('P/F.framework') is None
00057     assert framework_info('P/F.framework/_debug') is None
00058     assert framework_info('P/F.framework/F') == d('P', 'F.framework/F', 'F')
00059     assert framework_info('P/F.framework/F_debug') == d('P', 'F.framework/F_debug', 'F', suffix='debug')
00060     assert framework_info('P/F.framework/Versions') is None
00061     assert framework_info('P/F.framework/Versions/A') is None
00062     assert framework_info('P/F.framework/Versions/A/F') == d('P', 'F.framework/Versions/A/F', 'F', 'A')
00063     assert framework_info('P/F.framework/Versions/A/F_debug') == d('P', 'F.framework/Versions/A/F_debug', 'F', 'A', 'debug')

Here is the call graph for this function:


Variable Documentation

Definition at line 7 of file framework.py.

tuple ctypes.macholib.framework.STRICT_FRAMEWORK_RE = re.compile(r"""(?x)(?P<location>^.*)(?:^|/)(?P<name> (?P<shortname>\w+).framework/ (?:Versions/(?P<version>[^/]+)/)? (?P=shortname) (?:_(?P<suffix>[^_]+))?)$""")

Definition at line 9 of file framework.py.