]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-41490: Update ensurepip to install pip 20.2.1 and setuptools 49.2.1 (GH-21775)
authorSteve Dower <steve.dower@python.org>
Fri, 7 Aug 2020 22:10:32 +0000 (23:10 +0100)
committerGitHub <noreply@github.com>
Fri, 7 Aug 2020 22:10:32 +0000 (23:10 +0100)
.github/workflows/build_msi.yml
Lib/ensurepip/__init__.py
Lib/ensurepip/_bundled/pip-20.2.1-py2.py3-none-any.whl [moved from Lib/ensurepip/_bundled/pip-20.1.1-py2.py3-none-any.whl with 54% similarity]
Lib/ensurepip/_bundled/setuptools-49.2.1-py3-none-any.whl [moved from Lib/ensurepip/_bundled/setuptools-47.1.0-py3-none-any.whl with 54% similarity]
Lib/test/test_importlib/test_resource.py
Misc/NEWS.d/next/Library/2020-08-05-23-16-39.bpo-41490.6z47A_.rst [new file with mode: 0644]

index 769b3d012e94071274a102881c72b84f9bb61e69..e35ebe42565224722508a96a7a8cc6ddfd289352 100644 (file)
@@ -8,6 +8,7 @@ on:
     - 3.7
     paths:
     - 'Tools/msi/**'
+    - 'Lib/ensurepip/**'
   pull_request:
     branches:
     - master
@@ -15,6 +16,7 @@ on:
     - 3.7
     paths:
     - 'Tools/msi/**'
+    - 'Lib/ensurepip/**'
 
 jobs:
   build_win32:
index f3152a55d4430c0beb623d36ce0966e59cf10236..9415fd73b80ddb21309933bfdb2b2b8c92f6b0e3 100644 (file)
@@ -9,9 +9,9 @@ import tempfile
 __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"),
similarity index 54%
rename from Lib/ensurepip/_bundled/pip-20.1.1-py2.py3-none-any.whl
rename to Lib/ensurepip/_bundled/pip-20.2.1-py2.py3-none-any.whl
index ea1d0f7c8604a4cad61409c8ec927d5cac5e5c0e..3d0d3f8ae7facb9251f2c6f10f81fd2f75645a2f 100644 (file)
Binary files a/Lib/ensurepip/_bundled/pip-20.1.1-py2.py3-none-any.whl and b/Lib/ensurepip/_bundled/pip-20.2.1-py2.py3-none-any.whl differ
similarity index 54%
rename from Lib/ensurepip/_bundled/setuptools-47.1.0-py3-none-any.whl
rename to Lib/ensurepip/_bundled/setuptools-49.2.1-py3-none-any.whl
index f87867ff98254ac4d8341d64f1dfa7b2cd7ae84e..308e2f2ed5ed9b3697944c8f8ff24d7853159891 100644 (file)
Binary files a/Lib/ensurepip/_bundled/setuptools-47.1.0-py3-none-any.whl and b/Lib/ensurepip/_bundled/setuptools-49.2.1-py3-none-any.whl differ
index f88d92d154672958227b739ba2218e731f151cf1..e132c57282b37f01f2a349e8a3871254586aa198 100644 (file)
@@ -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 (file)
index 0000000..e89180d
--- /dev/null
@@ -0,0 +1 @@
+Update :mod:`ensurepip` to install pip 20.2.1 and setuptools 49.2.1.