Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
b27fc068
Commit
b27fc068
authored
Nov 14, 2017
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feed the hobgoblins (delint).
parent
2ef95509
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
15 deletions
+26
-15
setuptools/package_index.py
setuptools/package_index.py
+26
-15
No files found.
setuptools/package_index.py
View file @
b27fc068
...
...
@@ -141,7 +141,7 @@ def distros_for_filename(filename, metadata=None):
def
interpret_distro_name
(
location
,
basename
,
metadata
,
py_version
=
None
,
precedence
=
SOURCE_DIST
,
platform
=
None
):
):
"""Generate alternative interpretations of a source distro name
Note: if `location` is a filesystem filename, you should call
...
...
@@ -346,7 +346,8 @@ class PackageIndex(Environment):
base = f.url # handle redirects
page = f.read()
if not isinstance(page, str): # We are in Python 3 and got bytes. We want str.
if not isinstance(page, str):
# In Python 3 and got bytes but want str.
if isinstance(f, urllib.error.HTTPError):
# Errors have no charset, assume latin1:
charset = 'latin-1'
...
...
@@ -381,7 +382,8 @@ class PackageIndex(Environment):
is_file = s and s.group(1).lower() == 'file'
if is_file or self.allows(urllib.parse.urlparse(url)[1]):
return True
msg = ("
\
n
Note: Bypassing %s (disallowed host; see "
msg = (
"
\
n
Note: Bypassing %s (disallowed host; see "
"http://bit.ly/2hrImnY for details).
\
n
")
if fatal:
raise DistutilsError(msg % url)
...
...
@@ -500,15 +502,16 @@ class PackageIndex(Environment):
"""
checker
is
a
ContentChecker
"""
checker.report(self.debug,
checker.report(
self.debug,
"Validating %%s checksum for %s" % filename)
if not checker.is_valid():
tfp.close()
os.unlink(filename)
raise DistutilsError(
"%s validation failed for %s; "
"possible download problem?"
% (
checker.hash.name, os.path.basename(filename))
"possible download problem?"
% (
checker.hash.name, os.path.basename(filename))
)
def add_find_links(self, urls):
...
...
@@ -536,7 +539,8 @@ class PackageIndex(Environment):
if self[requirement.key]: # we've seen at least one distro
meth, msg = self.info, "Couldn't retrieve index page for %r"
else: # no distros seen for this name, might be misspelled
meth, msg = (self.warn,
meth, msg = (
self.warn,
"Couldn't find index page for %r (maybe misspelled?)")
meth(msg, requirement.unsafe_name)
self.scan_all()
...
...
@@ -577,8 +581,7 @@ class PackageIndex(Environment):
def fetch_distribution(
self, requirement, tmpdir, force_scan=False, source=False,
develop_ok=False, local_index=None
):
develop_ok=False, local_index=None):
"""
Obtain
a
distribution
suitable
for
fulfilling
`requirement`
`requirement`
must
be
a
``
pkg_resources
.
Requirement
``
instance
.
...
...
@@ -609,12 +612,19 @@ class PackageIndex(Environment):
if dist.precedence == DEVELOP_DIST and not develop_ok:
if dist not in skipped:
self.warn("Skipping development or system egg: %s", dist)
self.warn(
"Skipping development or system egg: %s", dist,
)
skipped[dist] = 1
continue
if dist in req and (dist.precedence <= SOURCE_DIST or not source):
dist.download_location = self.download(dist.location, tmpdir)
test = (
dist in req
and (dist.precedence <= SOURCE_DIST or not source)
)
if test:
loc = self.download(dist.location, tmpdir)
dist.download_location = loc
if os.path.exists(dist.download_location):
return dist
...
...
@@ -704,7 +714,7 @@ class PackageIndex(Environment):
def _download_to(self, url, filename):
self.info("Downloading %s", url)
# Download the file
fp
, info = None,
None
fp
=
None
try:
checker = HashChecker.from_url(url)
fp = self.open_url(strip_fragment(url))
...
...
@@ -1103,7 +1113,8 @@ def local_open(url):
f += '/'
files.append('<a href="{name}">{name}</a>'.format(name=f))
else:
tmpl = ("<html><head><title>{url}</title>"
tmpl = (
"<html><head><title>{url}</title>"
"</head><body>{files}</body></html>")
body = tmpl.format(url=url, files='
\
n
'.join(files))
status, message = 200, "OK"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment