コード例 #1
0
ファイル: paths.py プロジェクト: bsmithers/hpf
def zipSuffix(path):
    "Return a touple, (zipType, suffix) or (False, None)"
    import re
    match = re.compile("\.(bz|gz)$", re.IGNORECASE).search(path)
    if match :
        suffix = match.string[match.start():match.end()]
        from hpf.utilities import conditional
        type = conditional(suffix.lower() == BZIPPED, BZIPPED, GZIPPED)
        return type, suffix
    else:
        return None, None
コード例 #2
0
ファイル: paths.py プロジェクト: bsmithers/hpf
def tarSuffix(path):
    "Returns true if this path is tarred.  Returns a touple: (tarType, suffix)"
    import re
    match = re.compile("\.(tar\.|t)(bz|gz)$", re.IGNORECASE).search(path)
    if match :
        suffix = match.string[match.start():match.end()]
        z = re.compile("bz$|gz$", re.IGNORECASE).search(suffix)
        if z :
            from hpf.utilities import conditional
            type = conditional(z.string[z.start():z.end()].lower() == BZIPPED, BZIPPED, GZIPPED )
	else :
	    type = TARRED
        return type, suffix
    else:
        return None, None