本文整理汇总了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
示例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]