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

Default to allowing unsafe urls and allow disabling them via option

This commit is contained in:
Donald Stufft 2013-06-02 19:40:51 -04:00
parent cc46cdc8b3
commit 2731f06474
3 changed files with 14 additions and 4 deletions

View file

@ -85,8 +85,15 @@ allow_unsafe = make_option(
action="append", action="append",
default=[], default=[],
metavar="PACKAGE", metavar="PACKAGE",
help="Allow the installation of unsafe and unverifiable files for a " help="Allow the installation of unsafe and unverifiable files",
"package", )
no_allow_unsafe = make_option(
"--no-allow-unsafe",
dest="allow_all_unsafe",
action="store_false",
default=True,
help="Disallow the installation of unsafe and unverifiable files"
) )
requirements = make_option( requirements = make_option(
@ -168,5 +175,6 @@ index_group = {
allow_external, allow_external,
no_allow_external, no_allow_external,
allow_unsafe, allow_unsafe,
no_allow_unsafe,
] ]
} }

View file

@ -165,6 +165,7 @@ class InstallCommand(Command):
use_wheel=options.use_wheel, use_wheel=options.use_wheel,
allow_external=options.allow_external, allow_external=options.allow_external,
allow_unsafe=options.allow_unsafe, allow_unsafe=options.allow_unsafe,
allow_all_unsafe=options.allow_all_unsafe,
) )
def run(self, options, args): def run(self, options, args):

View file

@ -48,7 +48,8 @@ class PackageFinder(object):
def __init__(self, find_links, index_urls, def __init__(self, find_links, index_urls,
use_mirrors=False, mirrors=None, main_mirror_url=None, use_mirrors=False, mirrors=None, main_mirror_url=None,
use_wheel=False, allow_external=False, allow_unsafe=[]): use_wheel=False, allow_external=False, allow_unsafe=[],
allow_all_unsafe=False):
self.find_links = find_links self.find_links = find_links
self.index_urls = index_urls self.index_urls = index_urls
self.dependency_links = [] self.dependency_links = []
@ -69,7 +70,7 @@ class PackageFinder(object):
self.allow_unsafe = set(normalize_name(n) for n in allow_unsafe) self.allow_unsafe = set(normalize_name(n) for n in allow_unsafe)
# Do we allow unsafe and unverifiable files? # Do we allow unsafe and unverifiable files?
self.allow_all_unsafe = False self.allow_all_unsafe = allow_all_unsafe
# Stores if we ignored any external links so that we can instruct # Stores if we ignored any external links so that we can instruct
# end users how to install them if no distributions are available # end users how to install them if no distributions are available