mirror of https://github.com/pypa/pip
Change wording from "unsafe" to "insecure"
This commit is contained in:
parent
2731f06474
commit
d3638aa7a0
|
@ -80,20 +80,20 @@ no_allow_external = make_option(
|
|||
)
|
||||
|
||||
allow_unsafe = make_option(
|
||||
"--allow-unsafe",
|
||||
dest="allow_unsafe",
|
||||
"--allow-insecure",
|
||||
dest="allow_insecure",
|
||||
action="append",
|
||||
default=[],
|
||||
metavar="PACKAGE",
|
||||
help="Allow the installation of unsafe and unverifiable files",
|
||||
help="Allow the installation of insecure and unverifiable files",
|
||||
)
|
||||
|
||||
no_allow_unsafe = make_option(
|
||||
"--no-allow-unsafe",
|
||||
dest="allow_all_unsafe",
|
||||
"--no-allow-insecure",
|
||||
dest="allow_all_insecure",
|
||||
action="store_false",
|
||||
default=True,
|
||||
help="Disallow the installation of unsafe and unverifiable files"
|
||||
help="Disallow the installation of insecure and unverifiable files"
|
||||
)
|
||||
|
||||
requirements = make_option(
|
||||
|
|
|
@ -164,8 +164,8 @@ class InstallCommand(Command):
|
|||
mirrors=options.mirrors,
|
||||
use_wheel=options.use_wheel,
|
||||
allow_external=options.allow_external,
|
||||
allow_unsafe=options.allow_unsafe,
|
||||
allow_all_unsafe=options.allow_all_unsafe,
|
||||
allow_insecure=options.allow_insecure,
|
||||
allow_all_insecure=options.allow_all_insecure,
|
||||
)
|
||||
|
||||
def run(self, options, args):
|
||||
|
|
44
pip/index.py
44
pip/index.py
|
@ -48,8 +48,8 @@ class PackageFinder(object):
|
|||
|
||||
def __init__(self, find_links, index_urls,
|
||||
use_mirrors=False, mirrors=None, main_mirror_url=None,
|
||||
use_wheel=False, allow_external=False, allow_unsafe=[],
|
||||
allow_all_unsafe=False):
|
||||
use_wheel=False, allow_external=False, allow_insecure=[],
|
||||
allow_all_insecure=False):
|
||||
self.find_links = find_links
|
||||
self.index_urls = index_urls
|
||||
self.dependency_links = []
|
||||
|
@ -66,11 +66,11 @@ class PackageFinder(object):
|
|||
# Do we allow (safe and verifiable) externally hosted files?
|
||||
self.allow_external = allow_external
|
||||
|
||||
# Which names are allowed to install unsafe and unverifiable files?
|
||||
self.allow_unsafe = set(normalize_name(n) for n in allow_unsafe)
|
||||
# Which names are allowed to install insecure and unverifiable files?
|
||||
self.allow_insecure = set(normalize_name(n) for n in allow_insecure)
|
||||
|
||||
# Do we allow unsafe and unverifiable files?
|
||||
self.allow_all_unsafe = allow_all_unsafe
|
||||
self.allow_all_insecure = allow_all_insecure
|
||||
|
||||
# Stores if we ignored any external links so that we can instruct
|
||||
# end users how to install them if no distributions are available
|
||||
|
@ -78,7 +78,7 @@ class PackageFinder(object):
|
|||
|
||||
# Stores if we ignored any unsafe links so that we can instruct
|
||||
# end users how to install them if no distributions are available
|
||||
self.need_warn_unsafe = False
|
||||
self.need_warn_insecure = False
|
||||
|
||||
@property
|
||||
def use_wheel(self):
|
||||
|
@ -251,9 +251,9 @@ class PackageFinder(object):
|
|||
logger.warn("Some externally hosted files were ignored (use "
|
||||
"--allow-external to allow).")
|
||||
|
||||
if self.need_warn_unsafe:
|
||||
logger.warn("Some unsafe and unverifiable files were ignored "
|
||||
"(use --allow-unsafe %s to allow)." % req.name)
|
||||
if self.need_warn_insecure:
|
||||
logger.warn("Some insecure and unverifiable files were ignored"
|
||||
" (use --allow-insecure %s to allow)." % req.name)
|
||||
|
||||
raise DistributionNotFound('No distributions at all found for %s' % req)
|
||||
installed_version = []
|
||||
|
@ -292,9 +292,9 @@ class PackageFinder(object):
|
|||
logger.warn("Some externally hosted files were ignored (use "
|
||||
"--allow-external to allow).")
|
||||
|
||||
if self.need_warn_unsafe:
|
||||
logger.warn("Some unsafe and unverifiable files were ignored "
|
||||
"(use --allow-unsafe %s to allow)." % req.name)
|
||||
if self.need_warn_insecure:
|
||||
logger.warn("Some insecure and unverifiable files were ignored"
|
||||
" (use --allow-insecure %s to allow)." % req.name)
|
||||
|
||||
raise DistributionNotFound('No distributions matching the version for %s' % req)
|
||||
if applicable_versions[0][1] is InfLink:
|
||||
|
@ -317,9 +317,9 @@ class PackageFinder(object):
|
|||
|
||||
if (selected_version.verifiable is not None
|
||||
and not selected_version.verifiable):
|
||||
logger.warn("You are installing a potentially unsafe and "
|
||||
logger.warn("You are installing a potentially insecure and "
|
||||
"unverifiable file. Future versions of pip will "
|
||||
"default to disallowing unsafe files.")
|
||||
"default to disallowing insecure files.")
|
||||
|
||||
return selected_version
|
||||
|
||||
|
@ -385,12 +385,12 @@ class PackageFinder(object):
|
|||
|
||||
if (link.trusted is not None
|
||||
and not link.trusted
|
||||
and not normalize_name(req.name).lower() in self.allow_unsafe
|
||||
and not self.allow_all_unsafe): # TODO: Remove after release
|
||||
and not normalize_name(req.name).lower() in self.allow_insecure
|
||||
and not self.allow_all_insecure): # TODO: Remove after release
|
||||
logger.debug("Not searching %s for urls, it is an "
|
||||
"untrusted link and cannot produce safe or "
|
||||
"verifiable files." % link)
|
||||
self.need_warn_unsafe = True
|
||||
self.need_warn_insecure = True
|
||||
continue
|
||||
|
||||
pending_queue.put(link)
|
||||
|
@ -477,14 +477,14 @@ class PackageFinder(object):
|
|||
|
||||
if (link.verifiable is not None
|
||||
and not link.verifiable
|
||||
and not normalize_name(search_name).lower() in self.allow_unsafe
|
||||
and not self.allow_all_unsafe): # TODO: Remove after release
|
||||
and not normalize_name(search_name).lower() in self.allow_insecure
|
||||
and not self.allow_all_insecure): # TODO: Remove after release
|
||||
# We have a link that we are sure we cannot verify it's integrity,
|
||||
# so we should skip it unless we are allowing unsafe installs
|
||||
# for this requirement.
|
||||
logger.debug("Skipping %s because it is an unsafe and unverifiable"
|
||||
" file." % link)
|
||||
self.need_warn_unsafe = True
|
||||
logger.debug("Skipping %s because it is an insecure and "
|
||||
"unverifiable file." % link)
|
||||
self.need_warn_insecure = True
|
||||
return []
|
||||
|
||||
match = self._py_version_re.search(version)
|
||||
|
|
|
@ -1399,9 +1399,9 @@ def parse_requirements(filename, finder=None, comes_from=None, options=None):
|
|||
finder.allow_external = True
|
||||
elif line.startswith("--no-allow-external"):
|
||||
finder.allow_external = False
|
||||
elif line.startswith("--allow-unsafe"):
|
||||
line = line[len("--allow-unsafe"):].strip().lstrip("=")
|
||||
finder.allow_unsafe |= set([normalize_name(line).lower()])
|
||||
elif line.startswith("--allow-insecure"):
|
||||
line = line[len("--allow-insecure"):].strip().lstrip("=")
|
||||
finder.allow_insecure |= set([normalize_name(line).lower()])
|
||||
else:
|
||||
comes_from = '-r %s (line %s)' % (filename, line_number)
|
||||
if line.startswith('-e') or line.startswith('--editable'):
|
||||
|
|
Loading…
Reference in New Issue