Browse Source

Remove/change some more obsolete code paths.

master
Vinay Sajip 8 months ago
parent
commit
177a712386
  1. 2
      .hgignore
  2. 4
      CHANGES.rst
  3. 21
      distlib/compat.py
  4. 2
      distlib/locators.py
  5. 36
      distlib/util.py
  6. 6
      tests/compat.py
  7. 4
      tests/test_wheel.py

2
.hgignore

@ -10,5 +10,5 @@ distlib-vcsid|cover
tests/passwords
tests/keys/
tests/pypi-server-standalone.py
(dist|htmlcov|build|\.(tox|idea|egg-info))/
(dist|htmlcov|build|\.(tox|idea|egg-info|pytest_cache))/
_testdist-0.1/

4
CHANGES.rst

@ -15,6 +15,10 @@ Released: Not yet.
- Fixed #154: Determine Python versions correctly for Python >= 3.10.
- scripts
- Updated launcher executables.
Code relating to support for Python 2.6 was also removed.
0.3.3

21
distlib/compat.py

@ -615,18 +615,15 @@ except ImportError: # pragma: no cover
try:
from importlib.util import cache_from_source # Python >= 3.4
except ImportError: # pragma: no cover
try:
from imp import cache_from_source
except ImportError: # pragma: no cover
def cache_from_source(path, debug_override=None):
assert path.endswith('.py')
if debug_override is None:
debug_override = __debug__
if debug_override:
suffix = 'c'
else:
suffix = 'o'
return path + suffix
def cache_from_source(path, debug_override=None):
assert path.endswith('.py')
if debug_override is None:
debug_override = __debug__
if debug_override:
suffix = 'c'
else:
suffix = 'o'
return path + suffix
try:
from collections import OrderedDict

2
distlib/locators.py

@ -633,7 +633,7 @@ class SimpleScrapingLocator(Locator):
self._threads = []
for i in range(self.num_workers):
t = threading.Thread(target=self._fetch)
t.setDaemon(True)
t.daemon = True
t.start()
self._threads.append(t)

36
distlib/util.py

@ -1432,29 +1432,19 @@ if ssl:
self.sock = sock
self._tunnel()
if not hasattr(ssl, 'SSLContext'):
# For 2.x
if self.ca_certs:
cert_reqs = ssl.CERT_REQUIRED
else:
cert_reqs = ssl.CERT_NONE
self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file,
cert_reqs=cert_reqs,
ssl_version=ssl.PROTOCOL_SSLv23,
ca_certs=self.ca_certs)
else: # pragma: no cover
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
if hasattr(ssl, 'OP_NO_SSLv2'):
context.options |= ssl.OP_NO_SSLv2
if self.cert_file:
context.load_cert_chain(self.cert_file, self.key_file)
kwargs = {}
if self.ca_certs:
context.verify_mode = ssl.CERT_REQUIRED
context.load_verify_locations(cafile=self.ca_certs)
if getattr(ssl, 'HAS_SNI', False):
kwargs['server_hostname'] = self.host
self.sock = context.wrap_socket(sock, **kwargs)
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
if hasattr(ssl, 'OP_NO_SSLv2'):
context.options |= ssl.OP_NO_SSLv2
if self.cert_file:
context.load_cert_chain(self.cert_file, self.key_file)
kwargs = {}
if self.ca_certs:
context.verify_mode = ssl.CERT_REQUIRED
context.load_verify_locations(cafile=self.ca_certs)
if getattr(ssl, 'HAS_SNI', False):
kwargs['server_hostname'] = self.host
self.sock = context.wrap_socket(sock, **kwargs)
if self.ca_certs and self.check_domain:
try:
match_hostname(self.sock.getpeercert(), self.host)

6
tests/compat.py

@ -25,9 +25,3 @@ else:
text_type = str
from urllib.parse import urlparse, unquote
from urllib.request import Request
#
# Move distutils-related items here, to limit future changes
#
from distutils.spawn import find_executable, spawn

4
tests/test_wheel.py

@ -598,7 +598,7 @@ class WheelTestCase(DistlibTestCase):
w.verify()
md = w.metadata
self.assertEqual(md.run_requires, ['numpy'])
self.assertEquals(md.version, '0.1+1')
self.assertEqual(md.version, '0.1+1')
modified = w.update(self.wheel_modifier_ver)
self.assertTrue(modified)
@ -607,7 +607,7 @@ class WheelTestCase(DistlibTestCase):
w.verify()
md = w.metadata
self.assertEqual(md.run_requires, ['numpy'])
self.assertEquals(md.version, '0.1+123')
self.assertEqual(md.version, '0.1+123')
def test_info(self):
fn = os.path.join(HERE, 'dummy-0.1-py27-none-any.whl')

Loading…
Cancel
Save