summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Lib/ensurepip/__init__.py11
-rw-r--r--Lib/ensurepip/_bundled/__init__.py0
-rw-r--r--Misc/NEWS.d/next/Library/2019-08-04-17-22-33.bpo-37449.ycbL2z.rst2
3 files changed, 9 insertions, 4 deletions
diff --git a/Lib/ensurepip/__init__.py b/Lib/ensurepip/__init__.py
index fc0edec6e3..386ed6c25c 100644
--- a/Lib/ensurepip/__init__.py
+++ b/Lib/ensurepip/__init__.py
@@ -1,8 +1,11 @@
import os
import os.path
-import pkgutil
import sys
import tempfile
+from importlib import resources
+
+from . import _bundled
+
__all__ = ["version", "bootstrap"]
@@ -96,9 +99,9 @@ def _bootstrap(*, root=None, upgrade=False, user=False,
additional_paths = []
for project, version in _PROJECTS:
wheel_name = "{}-{}-py2.py3-none-any.whl".format(project, version)
- whl = pkgutil.get_data(
- "ensurepip",
- "_bundled/{}".format(wheel_name),
+ whl = resources.read_binary(
+ _bundled,
+ wheel_name,
)
with open(os.path.join(tmpdir, wheel_name), "wb") as fp:
fp.write(whl)
diff --git a/Lib/ensurepip/_bundled/__init__.py b/Lib/ensurepip/_bundled/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Lib/ensurepip/_bundled/__init__.py
diff --git a/Misc/NEWS.d/next/Library/2019-08-04-17-22-33.bpo-37449.ycbL2z.rst b/Misc/NEWS.d/next/Library/2019-08-04-17-22-33.bpo-37449.ycbL2z.rst
new file mode 100644
index 0000000000..b34bfea981
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-08-04-17-22-33.bpo-37449.ycbL2z.rst
@@ -0,0 +1,2 @@
+`ensurepip` now uses `importlib.resources.read_binary()` to read data instead of `pkgutil.get_data()`.
+Patch by Joannah Nanjekye. \ No newline at end of file