当前位置: 首页>>代码示例>>Python>>正文


Python PackageIndex.add_find_links方法代码示例

本文整理汇总了Python中setuptools.package_index.PackageIndex.add_find_links方法的典型用法代码示例。如果您正苦于以下问题:Python PackageIndex.add_find_links方法的具体用法?Python PackageIndex.add_find_links怎么用?Python PackageIndex.add_find_links使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在setuptools.package_index.PackageIndex的用法示例。


在下文中一共展示了PackageIndex.add_find_links方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: HTMLRepository

# 需要导入模块: from setuptools.package_index import PackageIndex [as 别名]
# 或者: from setuptools.package_index.PackageIndex import add_find_links [as 别名]
class HTMLRepository(RemoteRepository):
    """\
    A remote repository which easy_install can cope with.

    """
    def __init__(self, location, index=False, verbose=False):
        self.location = format_as_url(location)
        self.index = index
        if index:
            self.environment = PackageIndex(index_url=self.location,
                                            search_path=[])
        else:
            self.environment = PackageIndex(no_default_index=True)
            self.environment.add_find_links([self.location])
        self._projects = None
        self.tmpdir = mkdtemp(prefix="ensetuptools-")
        self.verbose = verbose

    @property
    def projects(self):
        if self._projects == None:
            self._projects = {}
            info("Scanning repository at %s..." % self.location)
            self.environment.prescan()
            self.environment.scan_all()
            for project in self.environment:
                self._projects[project] = HTMLProject(self, project,
                    verbose=self.verbose)
            for project in self.environment.package_pages:
                if project not in self._projects:
                    self._projects[project] = HTMLProject(self, project,
                        verbose=self.verbose)
                self._projects[project].scan_needed = True
        return self._projects

    def search(self, combiner='and', **kwargs):
        if 'project' not in kwargs:
            raise SearchError("EasyInstall-based remote repositories require"
                              " a 'project' search term.")
        if isinstance(kwargs['project'], basestring):
            return self.projects[kwargs['project']].match(combiner, **kwargs)
        partial_match_names = set(project_name
                                  for project_name in self.projects
                                  if kwargs['project'].match(project_name))
        matches = []
        for project in partial_match_names:
            matches += self.projects[project].search(combiner, **kwargs)
        return matches
开发者ID:pombredanne,项目名称:ensetuptools,代码行数:50,代码来源:repository.py

示例2: eval

# 需要导入模块: from setuptools.package_index import PackageIndex [as 别名]
# 或者: from setuptools.package_index.PackageIndex import add_find_links [as 别名]
        formula_name_cap = formula_name[0].capitalize() + formula_name[1:]
        cmd_import = "from pkgit.formulas.%s import %s" %(formula_name,formula_name_cap)
        exec(cmd_import, globals(), locals())
    except ImportError:
        print
        print("Cannot find formula %s. Maybe it is misspelled" %formula_name)
        print("You can only use formulas: %s" %str(formulas())[1:-1])
        print
        raise
    # instanciate formula
    cmd_instanciate = "%s()" %formula_name_cap
    return eval(cmd_instanciate)	

__oldsyspath__ = sys.path[:]

'''
OPENALEA_PI = "http://openalea.gforge.inria.fr/pi"
OPENALEA_REPOLIST = "http://openalea.gforge.inria.fr/repolist"
def get_repo_list():
    """ Return the list of OpenAlea repository """
    import urllib
    try:
        ret = []
        u = urllib.urlopen(OPENALEA_REPOLIST)
        for i in u:
            ret.append(i.strip())
        return ret

    except Exception, e:
        print e
        return [OPENALEA_PI]
开发者ID:openalea,项目名称:PkgIt,代码行数:33,代码来源:utils.py


注:本文中的setuptools.package_index.PackageIndex.add_find_links方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。