generic framework path manipulation def frameworkinfofilename isframework strictframeworkre matchfilename if not isframework return none return isframework groupdict x p location p name p shortname w framework versions p version p shortname _ p suffix _ 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
import re

__all__ = ['framework_info']

STRICT_FRAMEWORK_RE = re.compile(r)

def framework_info(filename):
    
    is_framework = STRICT_FRAMEWORK_RE.match(filename)
    if not is_framework:
        return None
    return is_framework.groupdict()