8000 Update ensurepip from CPython 3.12 · RustPython/RustPython@4d05416 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4d05416

Browse files
CPython Developersyouknowone
CPython Developers
authored andcommitted
Update ensurepip from CPython 3.12
1 parent 60993b9 commit 4d05416

File tree

4 files changed

+20
-33
lines changed

4 files changed

+20
-33
lines changed

Lib/ensurepip/__init__.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@
99

1010

1111
__all__ = ["version", "bootstrap"]
12-
_PACKAGE_NAMES = ('setuptools', 'pip')
13-
_SETUPTOOLS_VERSION = "65.5.0"
14-
_PIP_VERSION = "22.3.1"
12+
_PACKAGE_NAMES = ('pip',)
13+
_PIP_VERSION = "23.2.1"
1514
_PROJECTS = [
16-
("setuptools", _SETUPTOOLS_VERSION, "py3"),
1715
("pip", _PIP_VERSION, "py3"),
1816
]
1917

@@ -153,17 +151,17 @@ def _bootstrap(*, root=None, upgrade=False, user=False,
153151

154152
_disable_pip_configuration_settings()
155153

156-
# By default, installing pip and setuptools installs all of the
154+
# By default, installing pip installs all of the
157155
# following scripts (X.Y == running Python version):
158156
#
159-
# pip, pipX, pipX.Y, easy_install, easy_install-X.Y
157+
# pip, pipX, pipX.Y
160158
#
161159
# pip 1.5+ allows ensurepip to request that some of those be left out
162160
if altinstall:
163-
# omit pip, pipX and easy_install
161+
# omit pip, pipX
164162
os.environ["ENSUREPIP_OPTIONS"] = "altinstall"
165163
elif not default_pip:
166-
# omit pip and easy_install
164+
# omit pip
167165
os.environ["ENSUREPIP_OPTIONS"] = "install"
168166

169167
with tempfile.TemporaryDirectory() as tmpdir:
@@ -271,14 +269,14 @@ def _main(argv=None):
271269
action="store_true",
272270
default=False,
273271
help=("Make an alternate install, installing only the X.Y versioned "
274-
"scripts (Default: pipX, pipX.Y, easy_install-X.Y)."),
272+
"scripts (Default: pipX, pipX.Y)."),
275273
)
276274
parser.add_argument(
277275
"--default-pip",
278276
action="store_true",
279277
default=False,
280278
help=("Make a default pip install, installing the unqualified pip "
281-
"and easy_install in addition to the versioned scripts."),
279+
"in addition to the versioned scripts."),
282280
)
283281

284282
args = parser.parse_args(argv)
Binary file not shown.

Lib/test/test_ensurepip.py

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ def test_version(self):
2020
# Test version()
2121
with tempfile.TemporaryDirectory() as tmpdir:
2222
self.touch(tmpdir, "pip-1.2.3b1-py2.py3-none-any.whl")
23-
self.touch(tmpdir, "setuptools-49.1.3-py3-none-any.whl")
2423
with (unittest.mock.patch.object(ensurepip, '_PACKAGES', None),
2524
unittest.mock.patch.object(ensurepip, '_WHEEL_PKG_DIR', tmpdir)):
2625
self.assertEqual(ensurepip.version(), '1.2.3b1')
@@ -36,15 +35,12 @@ def test_get_packages_no_dir(self):
3635

3736
# use bundled wheel packages
3837
self.assertIsNotNone(packages['pip'].wheel_name)
39-
self.assertIsNotNone(packages['setuptools'].wheel_name)
4038

4139
def test_get_packages_with_dir(self):
4240
# Test _get_packages() with a wheel package directory
43-
setuptools_filename = "setuptools-49.1.3-py3-none-any.whl"
4441
pip_filename = "pip-20.2.2-py2.py3-none-any.whl"
4542

4643
with tempfile.TemporaryDirectory() as tmpdir:
47-
self.touch(tmpdir, setuptools_filename)
4844
self.touch(tmpdir, pip_filename)
4945
# not used, make sure that it's ignored
5046
self.touch(tmpdir, "wheel-0.34.2-py2.py3-none-any.whl")
@@ -53,15 +49,12 @@ def test_get_packages_with_dir(self):
5349
unittest.mock.patch.object(ensurepip, '_WHEEL_PKG_DIR', tmpdir)):
5450
packages = ensurepip._get_packages()
5551

56-
self.assertEqual(packages['setuptools'].version, '49.1.3')
57-
self.assertEqual(packages['setuptools'].wheel_path,
58-
os.path.join(tmpdir, setuptools_filename))
5952
self.assertEqual(packages['pip'].version, '20.2.2')
6053
self.assertEqual(packages['pip'].wheel_path,
6154
os.path.join(tmpdir, pip_filename))
6255

6356
# wheel package is ignored
64-
self.assertEqual(sorted(packages), ['pip', 'setuptools'])
57+
self.assertEqual(sorted(packages), ['pip'])
6558

6659

6760
class EnsurepipMixin:
@@ -92,13 +85,13 @@ def test_basic_bootstrapping(self):
9285
self.run_pip.assert_called_once_with(
9386
[
9487
"install", "--no-cache-dir", "--no-index", "--find-links",
95-
unittest.mock.ANY, "setuptools", "pip",
88+
unittest.mock.ANY, "pip",
9689
],
9790
unittest.mock.ANY,
9891
)
9992

10093
additional_paths = self.run_pip.call_args[0][1]
101-
self.assertEqual(len(additional_paths), 2)
94+
self.assertEqual(len(additional_paths), 1)
10295

10396
def test_bootstrapping_with_root(self):
10497
ensurepip.bootstrap(root="/foo/bar/")
@@ -107,7 +100,7 @@ def test_bootstrapping_with_root(self):
107100
[
108101
"install", "--no-cache-dir", "--no-index", "--find-links",
10 F438 9102
unittest.mock.ANY, "--root", "/foo/bar/",
110-
"setuptools", "pip",
103+
"pip",
111104
],
112105
unittest.mock.ANY,
113106
)
@@ -118,7 +111,7 @@ def test_bootstrapping_with_user(self):
118111
self.run_pip.assert_called_once_with(
119112
[
120113
"install", "--no-cache-dir", "--no-index", "--find-links",
121-
unittest.mock.ANY, "--user", "setuptools", "pip",
114+
unittest.mock.ANY, "--user", "pip",
122115
],
123116
unittest.mock.ANY,
124117
)
@@ -129,7 +122,7 @@ def test_bootstrapping_with_upgrade(self):
129122
self.run_pip.assert_called_once_with(
130123
[
131124
"install", "--no-cache-dir", "--no-index", "--find-links",
132-
unittest.mock.ANY, "--upgrade", "setuptools", "pip",
125+
unittest.mock.ANY, "--upgrade", "pip",
133126
],
134127
unittest.mock.ANY,
135128
)
@@ -140,7 +133,7 @@ def test_bootstrapping_with_verbosity_1(self):
140133
self.run_pip.assert_called_once_with(
141134
[
142135
"install", "--no-cache-dir", "--no-index", "--find-links",
143-
unittest.mock.ANY, "-v", "setuptools", "pip",
136+
unittest.mock.ANY, "-v", "pip",
144137
],
145138
unittest.mock.ANY,
146139
)
@@ -151,7 +144,7 @@ def test_bootstrapping_with_verbosity_2(self):
151144
self.run_pip.assert_called_once_with(
152145
[
153146
"install", "--no-cache-dir", "--no-index", "--find-links",
154-
unittest.mock.ANY, "-vv", "setuptools", "pip",
147+
unittest.mock.ANY, "-vv", "pip",
155148
],
156149
unittest.mock.ANY,
157150
)
@@ -162,7 +155,7 @@ def test_bootstrapping_with_verbosity_3(self):
162155
self.run_pip.assert_called_once_with(
163156
[
164157
"install", "--no-cache-dir", "--no-index", "--find-links",
165-
unittest.mock.ANY, "-vvv", "setuptools", "pip",
158+
unittest.mock.ANY, "-vvv", "pip",
166159
],
167160
unittest.mock.ANY,
168161
)
@@ -239,7 +232,6 @@ def test_uninstall(self):
239232
self.run_pip.assert_called_once_with(
240233
[
241234
"uninstall", "-y", "--disable-pip-version-check", "pip",
242-
"setuptools",
243235
]
244236
)
245237

@@ -250,7 +242,6 @@ def test_uninstall_with_verbosity_1(self):
250242
self.run_pip.assert_called_once_with(
251243
[
252244
"uninstall", "-y", "--disable-pip-version-check", "-v", "pip",
253-
"setuptools",
254245
]
255246
)
256247

@@ -261,7 +252,6 @@ def test_uninstall_with_verbosity_2(self):
261252
self.run_pip.assert_called_once_with(
262253
[
263254
"uninstall", "-y", "--disable-pip-version-check", "-vv", "pip",
264-
"setuptools",
265255
]
266256
)
267257

@@ -272,7 +262,7 @@ def test_uninstall_with_verbosity_3(self):
272262
self.run_pip.assert_called_once_with(
273263
[
274264
"uninstall", "-y", "--disable-pip-version-check", "-vvv",
275-
"pip", "setuptools",
265+
"pip"
276266
]
277267
)
278268

@@ -312,13 +302,13 @@ def test_basic_bootstrapping(self):
312302
self.run_pip.assert_called_once_with(
313303
[
314304
"install", "--no-cache-dir", "--no-index", "--find-links",
315-
unittest.mock.ANY, "setuptools", "pip",
305+
unittest.mock.ANY, "pip",
316306
],
317307
unittest.mock.ANY,
318308
)
319309

320310
additional_paths = self.run_pip.call_args[0][1]
321-
self.assertEqual(len(additional_paths), 2)
311+
self.assertEqual(len(additional_paths), 1)
322312
self.assertEqual(exit_code, 0)
323313

324314
def test_bootstrapping_error_code(self):
@@ -344,7 +334,6 @@ def test_basic_uninstall(self):
344334
self.run_pip.assert_called_once_with(
345335
[
346336
"uninstall", "-y", "--disable-pip-version-check", "pip",
347-
"setuptools",
348337
]
349338
)
350339

0 commit comments

Comments
 (0)
0