Skip to content

Commit 16ee306

Browse files
committed
Merge tag 'v40.7.3'
Bump version: 40.7.2 → 40.7.3
2 parents 0e2dd1a + a08cf8b commit 16ee306

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

CHANGES.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
v40.7.3
2+
-------
3+
4+
* #1670: In package_index, revert to using a copy of splituser from Python 3.8. Attempts to use ``urllib.parse.urlparse`` led to problems as reported in #1663 and #1668. This change serves as an alternative to #1499 and fixes #1668.
5+
6+
17
v40.7.2
28
-------
39

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 40.7.2
2+
current_version = 40.7.3
33
commit = True
44
tag = True
55

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def pypi_link(pkg_filename):
8989

9090
setup_params = dict(
9191
name="setuptools",
92-
version="40.7.2",
92+
version="40.7.3",
9393
description=(
9494
"Easily download, build, install, upgrade, and uninstall "
9595
"Python packages"

setuptools/package_index.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -850,16 +850,13 @@ def _download_html(self, url, headers, filename):
850850

851851
def _download_svn(self, url, filename):
852852
warnings.warn("SVN download support is deprecated", UserWarning)
853-
def splituser(host):
854-
user, delim, host = host.rpartition('@')
855-
return user, host
856853
url = url.split('#', 1)[0] # remove any fragment for svn's sake
857854
creds = ''
858855
if url.lower().startswith('svn:') and '@' in url:
859856
scheme, netloc, path, p, q, f = urllib.parse.urlparse(url)
860857
if not netloc and path.startswith('//') and '/' in path[2:]:
861858
netloc, path = path[2:].split('/', 1)
862-
auth, host = splituser(netloc)
859+
auth, host = _splituser(netloc)
863860
if auth:
864861
if ':' in auth:
865862
user, pw = auth.split(':', 1)
@@ -1058,8 +1055,8 @@ def open_with_auth(url, opener=urllib.request.urlopen):
10581055
if netloc.endswith(':'):
10591056
raise http_client.InvalidURL("nonnumeric port: ''")
10601057

1061-
if scheme in ('http', 'https') and parsed.username:
1062-
auth = ':'.join((parsed.username, parsed.password))
1058+
if scheme in ('http', 'https'):
1059+
auth, address = _splituser(netloc)
10631060
else:
10641061
auth = None
10651062

@@ -1072,7 +1069,7 @@ def open_with_auth(url, opener=urllib.request.urlopen):
10721069

10731070
if auth:
10741071
auth = "Basic " + _encode_auth(auth)
1075-
parts = scheme, netloc, path, params, query, frag
1072+
parts = scheme, address, path, params, query, frag
10761073
new_url = urllib.parse.urlunparse(parts)
10771074
request = urllib.request.Request(new_url)
10781075
request.add_header("Authorization", auth)
@@ -1086,13 +1083,20 @@ def open_with_auth(url, opener=urllib.request.urlopen):
10861083
# Put authentication info back into request URL if same host,
10871084
# so that links found on the page will work
10881085
s2, h2, path2, param2, query2, frag2 = urllib.parse.urlparse(fp.url)
1089-
if s2 == scheme and h2 == parsed.hostname:
1086+
if s2 == scheme and h2 == address:
10901087
parts = s2, netloc, path2, param2, query2, frag2
10911088
fp.url = urllib.parse.urlunparse(parts)
10921089

10931090
return fp
10941091

10951092

1093+
# copy of urllib.parse._splituser from Python 3.8
1094+
def _splituser(host):
1095+
"""splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'."""
1096+
user, delim, host = host.rpartition('@')
1097+
return (user if delim else None), host
1098+
1099+
10961100
# adding a timeout to avoid freezing package_index
10971101
open_with_auth = socket_timeout(_SOCKET_TIMEOUT)(open_with_auth)
10981102

0 commit comments

Comments
 (0)