1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Added --no-index option to install and bundle command which temporarily disables querying the package index

This commit is contained in:
Jannis Leidel 2009-09-01 03:04:01 +02:00
parent 8922a1ead4
commit 78ec0268b2
2 changed files with 19 additions and 11 deletions

23
pip.py
View file

@ -377,6 +377,12 @@ class InstallCommand(Command):
action='append',
default=[],
help='extra URLs of package indexes to use in addition to --index-url')
self.parser.add_option(
'--no-index',
dest='no_index',
action='store_true',
default=False,
help='Ignore package index (only looking at --find-links URLs instead)')
self.parser.add_option(
'-b', '--build', '--build-dir', '--build-directory',
@ -432,6 +438,9 @@ class InstallCommand(Command):
options.src_dir = os.path.abspath(options.src_dir)
install_options = options.install_options or []
index_urls = [options.index_url] + options.extra_index_urls
if options.no_index:
logger.notify('Ignoring indexes: %s' % ','.join(index_urls))
index_urls = []
finder = PackageFinder(
find_links=options.find_links,
index_urls=index_urls)
@ -1079,12 +1088,14 @@ class PackageFinder(object):
def find_requirement(self, req, upgrade):
url_name = req.url_name
# Check that we have the url_name correctly spelled:
main_index_url = Link(posixpath.join(self.index_urls[0], url_name))
# This will also cache the page, so it's okay that we get it again later:
page = self._get_page(main_index_url, req)
if page is None:
url_name = self._find_url_name(Link(self.index_urls[0]), url_name, req) or req.url_name
# Only check main index if index URL is given:
if self.index_urls:
# Check that we have the url_name correctly spelled:
main_index_url = Link(posixpath.join(self.index_urls[0], url_name))
# This will also cache the page, so it's okay that we get it again later:
page = self._get_page(main_index_url, req)
if page is None:
url_name = self._find_url_name(Link(self.index_urls[0]), url_name, req) or req.url_name
def mkurl_pypi_url(url):
loc = posixpath.join(url, url_name)
# For maximum compatibility with easy_install, ensure the path

View file

@ -1,12 +1,9 @@
import sys
if sys.platform == 'win32':
from setuptools import setup
else:
from distutils.core import setup
from setuptools import setup
import os
version = '0.4'
version = '0.4.1'
doc_dir = os.path.join(os.path.dirname(__file__), 'docs')
index_filename = os.path.join(doc_dir, 'index.txt')