Skip to content

Commit 0d6fada

Browse files
committed
Merge branch 'main' into python_option
2 parents 4dc35b7 + f47a204 commit 0d6fada

File tree

17 files changed

+151
-17
lines changed

17 files changed

+151
-17
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,35 @@ jobs:
221221
env:
222222
TEMP: "R:\\Temp"
223223

224+
tests-zipapp:
225+
name: tests / zipapp
226+
runs-on: ubuntu-latest
227+
228+
needs: [pre-commit, packaging, determine-changes]
229+
if: >-
230+
needs.determine-changes.outputs.tests == 'true' ||
231+
github.event_name != 'pull_request'
232+
233+
steps:
234+
- uses: actions/checkout@v2
235+
- uses: actions/setup-python@v2
236+
with:
237+
python-version: "3.10"
238+
239+
- name: Install Ubuntu dependencies
240+
run: sudo apt-get install bzr
241+
242+
- run: pip install nox 'virtualenv<20' 'setuptools != 60.6.0'
243+
244+
# Main check
245+
- name: Run integration tests
246+
run: >-
247+
nox -s test-3.10 --
248+
-m integration
249+
--verbose --numprocesses auto --showlocals
250+
--durations=5
251+
--use-zipapp
252+
224253
# TODO: Remove this when we add Python 3.11 to CI.
225254
tests-importlib-metadata:
226255
name: tests for importlib.metadata backend

docs/html/cli/pip_download.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ match the constraint of the current interpreter (but not your target one), it
4343
is recommended to specify all of these options if you are specifying one of
4444
them. Generic dependencies (e.g. universal wheels, or dependencies with no
4545
platform, abi, or implementation constraints) will still match an over-
46-
constrained download requirement.
46+
constrained download requirement. If some of your dependencies are not
47+
available as binaries, you can build them manually for your target platform
48+
and let pip download know where to find them using ``--find-links``.
4749

4850

4951

docs/html/user_guide.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
User Guide
33
==========
44

5+
.. Hello there!
6+
7+
If you're thinking of adding content to this page... please take a moment
8+
to consider if this content can live on its own, within a topic guide or a
9+
reference page.
10+
11+
There is active effort being put toward *reducing* the amount of content on
12+
this specific page (https://github.com/pypa/pip/issues/9475) and moving it
13+
into more focused single-page documents that cover that specific topic.
514
615
Running pip
716
===========

news/10716.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use ``shell=True`` for opening the editor with ``pip config edit``.

news/11250.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add an option to run the test suite with pip built as a zipapp.

news/11314.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Avoid ``AttributeError`` when removing the setuptools-provided ``_distutils_hack`` and it is missing its implementation.

news/11319.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix import error when reinstalling pip in user site.

src/pip/__pip-runner__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ def check_python_version() -> None:
4545
)
4646

4747

48-
# TODO https://github.com/pypa/pip/issues/11294
4948
sys.meta_path.insert(0, PipImportRedirectingFinder())
5049

5150
assert __name__ == "__main__", "Cannot run __pip-runner__.py as a non-main module"

src/pip/_internal/commands/configuration.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,15 @@ def open_in_editor(self, options: Values, args: List[str]) -> None:
228228
fname = self.configuration.get_file_to_edit()
229229
if fname is None:
230230
raise PipError("Could not determine appropriate file.")
231+
elif '"' in fname:
232+
# This shouldn't happen, unless we see a username like that.
233+
# If that happens, we'd appreciate a pull request fixing this.
234+
raise PipError(
235+
f'Can not open an editor for a file name containing "\n{fname}'
236+
)
231237

232238
try:
233-
subprocess.check_call([editor, fname])
239+
subprocess.check_call(f'{editor} "{fname}"', shell=True)
234240
except FileNotFoundError as e:
235241
if not e.filename:
236242
e.filename = editor

src/pip/_internal/locations/__init__.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ def _should_use_sysconfig() -> bool:
6060

6161
_USE_SYSCONFIG = _should_use_sysconfig()
6262

63+
if not _USE_SYSCONFIG:
64+
# Import distutils lazily to avoid deprecation warnings,
65+
# but import it soon enough that it is in memory and available during
66+
# a pip reinstall.
67+
from . import _distutils
68+
6369
# Be noisy about incompatibilities if this platforms "should" be using
6470
# sysconfig, but is explicitly opting out and using distutils instead.
6571
if _USE_SYSCONFIG_DEFAULT and not _USE_SYSCONFIG:
@@ -241,8 +247,6 @@ def get_scheme(
241247
if _USE_SYSCONFIG:
242248
return new
243249

244-
from . import _distutils
245-
246250
old = _distutils.get_scheme(
247251
dist_name,
248252
user=user,
@@ -407,8 +411,6 @@ def get_bin_prefix() -> str:
407411
if _USE_SYSCONFIG:
408412
return new
409413

410-
from . import _distutils
411-
412414
old = _distutils.get_bin_prefix()
413415
if _warn_if_mismatch(pathlib.Path(old), pathlib.Path(new), key="bin_prefix"):
414416
_log_context()
@@ -442,8 +444,6 @@ def get_purelib() -> str:
442444
if _USE_SYSCONFIG:
443445
return new
444446

445-
from . import _distutils
446-
447447
old = _distutils.get_purelib()
448448
if _looks_like_deb_system_dist_packages(old):
449449
return old
@@ -488,8 +488,6 @@ def get_prefixed_libs(prefix: str) -> List[str]:
488488
if _USE_SYSCONFIG:
489489
return _deduplicated(new_pure, new_plat)
490490

491-
from . import _distutils
492-
493491
old_pure, old_plat = _distutils.get_prefixed_libs(prefix)
494492
old_lib_paths = _deduplicated(old_pure, old_plat)
495493

0 commit comments

Comments
 (0)