示例#1
0
def generateModuleFilenamesInPythonPath(contextFilename):
    files = []
    rootdir = getRootDirectory(contextFilename)
    if rootdir in getPythonPath():
        # just search the pythonpath
        for path in getPythonPath():
            for file in getFilesForName(path):
                if file not in files:  # check for duplicates
                    files.append(file)
                    yield file
    else:
        # search the package hierarchy containing contextFilename
        # in addition to pythonpath
        basedir = getPackageBaseDirectory(contextFilename)
        for path in [basedir] + getPythonPath():
            for file in getFilesForName(path):
                if file not in files:  # check for duplicates
                    files.append(file)
                    yield file

        # and search the files immediately above the package hierarchy
        for file in getFilesForName(os.path.join(rootdir, "*.py")):
            if file not in files:  # check for duplicates
                files.append(file)
                yield file
示例#2
0
def generateModuleFilenamesInPythonPath(contextFilename):
    files = []
    rootdir = getRootDirectory(contextFilename)
    if rootdir in getPythonPath():
        # just search the pythonpath
        for path in getPythonPath():
            for file in getFilesForName(path):
                if file not in files:   # check for duplicates
                    files.append(file)
                    yield file
    else:
        # search the package hierarchy containing contextFilename
        # in addition to pythonpath
        basedir = getPackageBaseDirectory(contextFilename)
        for path in [basedir] + getPythonPath():
            for file in getFilesForName(path):
                if file not in files:   # check for duplicates
                    files.append(file)
                    yield file

        # and search the files immediately above the package hierarchy
        for file in getFilesForName(os.path.join(rootdir,"*.py")):
            if file not in files:   # check for duplicates
                files.append(file)
                yield file
示例#3
0
def generateModuleFilenamesInPackage(filenameInPackage):
    basedir = getPackageBaseDirectory(filenameInPackage)
    for file in getFilesForName(basedir):
        yield file
示例#4
0
def generateModuleFilenamesInPackage(filenameInPackage):
    basedir = getPackageBaseDirectory(filenameInPackage)
    for file in getFilesForName(basedir):
        yield file