コード例 #1
0
ファイル: util.py プロジェクト: m0rcq/zato
def visit_py_source_from_distribution(dir_name):
    """ Yields all the Python source modules from a Distutils2 distribution.
    """
    path = os.path.join(dir_name, 'setup.cfg')
    if not os.path.exists(path):
        msg = "Could not find setup.cfg in [{}], path:[{}] doesn't exist".format(dir_name, path)
        logger.debug(msg)
        raise NoDistributionFound(path)

    dist = Distribution()
    config = Config(dist)
    config.parse_config_files([path])

    logger.debug('dist.packages:[%s]' % dist.packages)

    for package in dist.packages:
        package_dir = os.path.abspath(os.path.join(dir_name, package.replace('.', os.path.sep)))
        yield visit_py_source(package_dir)
コード例 #2
0
ファイル: util.py プロジェクト: ccjchina/zato
def visit_py_source_from_distribution(dir_name):
    """ Yields all the Python source modules from a Distutils2 distribution.
    """
    path = os.path.join(dir_name, 'setup.cfg')
    if not os.path.exists(path):
        msg = "Could not find setup.cfg in [{}], path:[{}] doesn't exist".format(dir_name, path)
        logger.debug(msg)
        raise NoDistributionFound(path)

    dist = Distribution()
    config = Config(dist)
    config.parse_config_files([path])

    logger.debug('dist.packages:[%s]' % dist.packages)

    for package in dist.packages:
        package_dir = os.path.abspath(os.path.join(dir_name, package.replace('.', os.path.sep)))
        yield visit_py_source(package_dir)
コード例 #3
0
ファイル: util.py プロジェクト: dsuch/zato
def visit_py_source_from_distribution(dir_name):
    """ Yields all the Python source modules from a Distutils2 distribution.
    """
    abs_dir = os.path.abspath(dir_name)
    path = os.path.join(dir_name, 'setup.cfg')
    if not os.path.exists(path):
        msg = "Could not find setup.cfg in [{}], path:[{}] doesn't exist".format(dir_name, path)
        logger.error(msg)
        raise ValueError(msg)
    
    dist = Distribution()
    config = Config(dist)
    config.parse_config_files([path])
    
    logger.debug('dist.packages:[%s]' % dist.packages)
    
    for package in dist.packages:
        package_dir = os.path.abspath(os.path.join(dir_name, package.replace('.', os.path.sep)))
        for pattern in('*.py', '*.pyw'):
            glob_path = os.path.join(package_dir, pattern)
            for py_path in glob(glob_path):
                yield py_path