Example #1
0
def packagedin(abspath):
    """Return the package name that contains the asset `abspath`."""
    from pluggdapps import papackages  # Keep this line, don't shuffle around !!

    locations = {pinfo['location']: p for p, pinfo in papackages.items()}
    prefix = longest_prefix(locations.keys(), abspath)
    return locations[prefix] if prefix else None
Example #2
0
def packagedin( abspath ):
    """Return the package name that contains the asset `abspath`."""
    from pluggdapps import papackages # Keep this line, don't shuffle around !!

    locations = { pinfo['location'] : p for p, pinfo in papackages.items() }
    prefix = longest_prefix( locations.keys(), abspath )
    return locations[prefix] if prefix else None
Example #3
0
def asset_spec_from_abspath(abspath, papackages):
    """Use the dictionary of ``papackages``, gathered during platform boot
    time by calling package() entrypoint and convert abspath to
    asset-specification format."""
    locations = {pinfo['location']: p for p, pinfo in papackages.items()}
    prefix = longest_prefix(locations.keys(), abspath)
    pkg = locations[prefix] if prefix else None
    if pkg:
        return (pkg + ':' + abspath[len(prefix):].lstrip(os.sep))
    else:
        return None
Example #4
0
def asset_spec_from_abspath( abspath, papackages ):
    """Use the dictionary of ``papackages``, gathered during platform boot
    time by calling package() entrypoint and convert abspath to
    asset-specification format."""
    locations = { pinfo['location'] : p for p, pinfo in papackages.items() }
    prefix = longest_prefix( locations.keys(), abspath )
    pkg = locations[prefix] if prefix else None
    if pkg :
        return ( pkg + ':' + abspath[ len(prefix) : ].lstrip(os.sep) )
    else :
        return None