示例#1
0
        filteredFiles = []
        for f in files:
            fileGood = True
            for badFile in exclude:
                if f.samepath(badFile) \
                   or (badFile.isdir()
                       and f.canonicalpath().startswith(badFile)):
                    fileGood = False
            if fileGood:
                filteredFiles.append(f)
        files = filteredFiles
    if melPathOnly:
        files = [x for x in files if fileOnMelPath(x)]
    if basePackage and basePackage[-1] != '.':
        basePackage = basePackage + '.'
    return [(basePackage + melparse.getModuleBasename(x), x)
            for x in files] + recursedResults


def fileOnMelPath(file):
    """
    Return True if this file is on the mel path.
    """
    file = util.path(file)
    info = pm.mel.whatIs(file.basename()).split(': ', 1)
    if len(info) < 2:
        # If there wasn't a ':' character, the result was probably 'Unknown, or something similar -
        # anyway, not what we're looking for
        return False
    if info[0] not in ('Mel procedure found in', 'Script found in'):
        return False
示例#2
0
文件: __init__.py 项目: SarielD/pymel
        filteredFiles = []
        for f in files:
            fileGood = True
            for badFile in exclude:
                if f.samepath(badFile) \
                   or (badFile.isdir()
                       and f.canonicalpath().startswith(badFile)):
                    fileGood = False
            if fileGood:
                filteredFiles.append(f)
        files = filteredFiles
    if melPathOnly:
        files = [x for x in files if fileOnMelPath(x)]
    if basePackage and basePackage[-1] != '.':
        basePackage = basePackage + '.'
    return [ (basePackage + melparse.getModuleBasename(x), x) for x in files] + recursedResults

def fileOnMelPath( file ):
    """
    Return True if this file is on the mel path.
    """
    file = util.path(file)
    info = pm.mel.whatIs( file.basename() ).split(': ', 1)
    if len(info) < 2:
        # If there wasn't a ':' character, the result was probably 'Unknown, or something similar -
        # anyway, not what we're looking for
        return False
    if info[0] not in ('Mel procedure found in', 'Script found in'):
        return False
    path = util.path(info[1])
    return path.samepath(file)