mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-37449: Move ensurepip off of pkgutil and to importlib.resources (GH-15109)
Move ensurepip off of pkgutil and to importlib.resources. https://bugs.python.org/issue37449
This commit is contained in:
parent
d6a9d17d8b
commit
2ccb50cf77
3 changed files with 9 additions and 4 deletions
|
@ -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)
|
||||
|
|
0
Lib/ensurepip/_bundled/__init__.py
Normal file
0
Lib/ensurepip/_bundled/__init__.py
Normal file
Loading…
Add table
Add a link
Reference in a new issue