本文整理汇总了Python中setuptools.package_index.PackageIndex.scan_all方法的典型用法代码示例。如果您正苦于以下问题:Python PackageIndex.scan_all方法的具体用法?Python PackageIndex.scan_all怎么用?Python PackageIndex.scan_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类setuptools.package_index.PackageIndex
的用法示例。
在下文中一共展示了PackageIndex.scan_all方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: HTMLRepository
# 需要导入模块: from setuptools.package_index import PackageIndex [as 别名]
# 或者: from setuptools.package_index.PackageIndex import scan_all [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: load_index_servers
# 需要导入模块: from setuptools.package_index import PackageIndex [as 别名]
# 或者: from setuptools.package_index.PackageIndex import scan_all [as 别名]
def load_index_servers(self):
index_servers = []
for index in IndexSite.objects.all():
pypi = PackageIndex(index_url=index.url)
pypi.scan_all()
self.index_servers.append(pypi)