diff options
author | Steve Dower <steve.dower@python.org> | 2020-08-07 23:47:40 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-07 23:47:40 (GMT) |
commit | 70e9243a55be9c32b41f2149cdfa3957f96f8471 (patch) | |
tree | 6d24bab89214c1c89629a46443e8e7bbc2206eee | |
parent | 1ecbfbc26a51469672ab49eb306616a16a4c2450 (diff) | |
download | cpython-70e9243a55be9c32b41f2149cdfa3957f96f8471.zip cpython-70e9243a55be9c32b41f2149cdfa3957f96f8471.tar.gz cpython-70e9243a55be9c32b41f2149cdfa3957f96f8471.tar.bz2 |
bpo-41490: Update ensurepip to install pip 20.2.1 and setuptools 49.2.1 (GH-21774)
-rw-r--r-- | .github/workflows/build_msi.yml | 2 | ||||
-rw-r--r-- | Lib/ensurepip/__init__.py | 4 | ||||
-rw-r--r-- | Lib/ensurepip/_bundled/pip-20.2.1-py2.py3-none-any.whl (renamed from Lib/ensurepip/_bundled/pip-20.1.1-py2.py3-none-any.whl) | bin | 1490666 -> 1503343 bytes | |||
-rw-r--r-- | Lib/ensurepip/_bundled/setuptools-49.2.1-py3-none-any.whl (renamed from Lib/ensurepip/_bundled/setuptools-47.1.0-py3-none-any.whl) | bin | 583087 -> 789827 bytes | |||
-rw-r--r-- | Lib/test/test_importlib/test_resource.py | 69 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Library/2020-08-05-23-16-39.bpo-41490.6z47A_.rst | 1 |
6 files changed, 74 insertions, 2 deletions
diff --git a/.github/workflows/build_msi.yml b/.github/workflows/build_msi.yml index 182eb7c..3664ccb 100644 --- a/.github/workflows/build_msi.yml +++ b/.github/workflows/build_msi.yml @@ -9,6 +9,7 @@ on: - 3.7 paths: - 'Tools/msi/**' + - 'Lib/ensurepip/**' pull_request: branches: - master @@ -17,6 +18,7 @@ on: - 3.7 paths: - 'Tools/msi/**' + - 'Lib/ensurepip/**' jobs: build_win32: diff --git a/Lib/ensurepip/__init__.py b/Lib/ensurepip/__init__.py index 21320a8..8f504e7 100644 --- a/Lib/ensurepip/__init__.py +++ b/Lib/ensurepip/__init__.py @@ -12,9 +12,9 @@ from . import _bundled __all__ = ["version", "bootstrap"] -_SETUPTOOLS_VERSION = "47.1.0" +_SETUPTOOLS_VERSION = "49.2.1" -_PIP_VERSION = "20.1.1" +_PIP_VERSION = "20.2.1" _PROJECTS = [ ("setuptools", _SETUPTOOLS_VERSION, "py3"), diff --git a/Lib/ensurepip/_bundled/pip-20.1.1-py2.py3-none-any.whl b/Lib/ensurepip/_bundled/pip-20.2.1-py2.py3-none-any.whl Binary files differindex ea1d0f7..3d0d3f8 100644 --- a/Lib/ensurepip/_bundled/pip-20.1.1-py2.py3-none-any.whl +++ b/Lib/ensurepip/_bundled/pip-20.2.1-py2.py3-none-any.whl diff --git a/Lib/ensurepip/_bundled/setuptools-47.1.0-py3-none-any.whl b/Lib/ensurepip/_bundled/setuptools-49.2.1-py3-none-any.whl Binary files differindex f87867f..308e2f2 100644 --- a/Lib/ensurepip/_bundled/setuptools-47.1.0-py3-none-any.whl +++ b/Lib/ensurepip/_bundled/setuptools-49.2.1-py3-none-any.whl diff --git a/Lib/test/test_importlib/test_resource.py b/Lib/test/test_importlib/test_resource.py index f88d92d..e132c57 100644 --- a/Lib/test/test_importlib/test_resource.py +++ b/Lib/test/test_importlib/test_resource.py @@ -1,10 +1,13 @@ import sys import unittest +import uuid from . import data01 from . import zipdata01, zipdata02 from . import util from importlib import resources, import_module +from pathlib import Path +from test import support class ResourceTests: @@ -162,5 +165,71 @@ class NamespaceTest(unittest.TestCase): 'test.test_importlib.data03.namespace', 'resource1.txt') +class DeletingZipsTest(unittest.TestCase): + """Having accessed resources in a zip file should not keep an open + reference to the zip. + """ + ZIP_MODULE = zipdata01 + + def setUp(self): + modules = support.modules_setup() + self.addCleanup(support.modules_cleanup, *modules) + + data_path = Path(self.ZIP_MODULE.__file__) + data_dir = data_path.parent + self.source_zip_path = data_dir / 'ziptestdata.zip' + self.zip_path = Path.cwd() / '{}.zip'.format(uuid.uuid4()) + self.zip_path.write_bytes(self.source_zip_path.read_bytes()) + sys.path.append(str(self.zip_path)) + self.data = import_module('ziptestdata') + + def tearDown(self): + try: + sys.path.remove(str(self.zip_path)) + except ValueError: + pass + + try: + del sys.path_importer_cache[str(self.zip_path)] + del sys.modules[self.data.__name__] + except KeyError: + pass + + try: + support.unlink(self.zip_path) + except OSError: + # If the test fails, this will probably fail too + pass + + def test_contents_does_not_keep_open(self): + c = resources.contents('ziptestdata') + self.zip_path.unlink() + + def test_is_resource_does_not_keep_open(self): + c = resources.is_resource('ziptestdata', 'binary.file') + self.zip_path.unlink() + + def test_is_resource_failure_does_not_keep_open(self): + c = resources.is_resource('ziptestdata', 'not-present') + self.zip_path.unlink() + + def test_path_does_not_keep_open(self): + c = resources.path('ziptestdata', 'binary.file') + self.zip_path.unlink() + + def test_entered_path_does_not_keep_open(self): + # This is what certifi does on import to make its bundle + # available for the process duration. + c = resources.path('ziptestdata', 'binary.file').__enter__() + self.zip_path.unlink() + + def test_read_binary_does_not_keep_open(self): + c = resources.read_binary('ziptestdata', 'binary.file') + self.zip_path.unlink() + + def test_read_text_does_not_keep_open(self): + c = resources.read_text('ziptestdata', 'utf-8.file', encoding='utf-8') + self.zip_path.unlink() + if __name__ == '__main__': unittest.main() diff --git a/Misc/NEWS.d/next/Library/2020-08-05-23-16-39.bpo-41490.6z47A_.rst b/Misc/NEWS.d/next/Library/2020-08-05-23-16-39.bpo-41490.6z47A_.rst new file mode 100644 index 0000000..e89180d --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-08-05-23-16-39.bpo-41490.6z47A_.rst @@ -0,0 +1 @@ +Update :mod:`ensurepip` to install pip 20.2.1 and setuptools 49.2.1. |