diff options
author | Patrick Gartung <gartung@fnal.gov> | 2019-09-26 11:48:22 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-26 11:48:22 -0500 |
commit | 321e956fa94d3e5faf9c96c249f25275c7aa60ca (patch) | |
tree | 62a05197403ff3e1c7ce8e246f212c8f33e38f54 /lib/spack/external/macholib/framework.py | |
parent | 90236bc9f54a0fccbf0e133d09ce258b379e5ae3 (diff) | |
download | spack-321e956fa94d3e5faf9c96c249f25275c7aa60ca.tar.gz spack-321e956fa94d3e5faf9c96c249f25275c7aa60ca.tar.bz2 spack-321e956fa94d3e5faf9c96c249f25275c7aa60ca.tar.xz spack-321e956fa94d3e5faf9c96c249f25275c7aa60ca.zip |
External: add macholib and altgraph needed to relocate Mach-o binaries on Linux (#12909)
Diffstat (limited to 'lib/spack/external/macholib/framework.py')
-rw-r--r-- | lib/spack/external/macholib/framework.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/lib/spack/external/macholib/framework.py b/lib/spack/external/macholib/framework.py new file mode 100644 index 0000000000..8f8632c209 --- /dev/null +++ b/lib/spack/external/macholib/framework.py @@ -0,0 +1,43 @@ +""" +Generic framework path manipulation +""" + +import re + +__all__ = ['framework_info'] + +_STRICT_FRAMEWORK_RE = re.compile(r"""(?x) +(?P<location>^.*)(?:^|/) +(?P<name> + (?P<shortname>[-_A-Za-z0-9]+).framework/ + (?:Versions/(?P<version>[^/]+)/)? + (?P=shortname) + (?:_(?P<suffix>[^_]+))? +)$ +""") + + +def framework_info(filename): + """ + 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 + """ + is_framework = _STRICT_FRAMEWORK_RE.match(filename) + if not is_framework: + return None + return is_framework.groupdict() |