* As a means to make things easier for new users, quote everything in
a `pip install` command that is part of a package that isn't just
a bare package name.
* Use single quotes for Linux/Mac and use double quotes for Windows
to follow existing style conventions.
* Shells like zsh have glob qualifiers that will error if an extra
is not quoted. While the glob qualifiers can be disabled, adding
quotes guards against errors if people are copy-pasting or do not
know that they can disable the behavior.
* Use single quotes for Linux/Mac and use double quotes for Windows
to follow existing style conventions.
```
(testvenv) williams-air:testvenv williamedwards$ pip3 install 'foobar @ git+ssh://example.com/foobar'
fatal: '/foobar' does not appear to be a git repository
fatal: Could not read from remote repository.
(testvenv) williams-air:testvenv williamedwards$ pip3 install 'foobar @ git+ssh://git@example.com/foobar'
...
Successfully installed foobar-0.0
```
Refactored `_get_index_url()` to get integration tests for the subprocess backend working.
Keyring support via the 'subprocess' provider can only retrieve a password, not a username-password combo. The username therefor MUST come from the URL.
If the URL obtained from the index does not contain a username then the username from a matching index is used. `_get_index_url()` does that matching.
The problem this refactoring solves is that the URL where a wheel or sdist can be downloaded from does not always start with the index url. Azure DevOps Artifacts Feeds are an example since it replaces the friendly name of the Feed with the GUID of the Feed. Causing `url.startswith(prefix)` to evaluate as `False`.
The new behaviour is to return the index which matches the netloc and has the longest common prefix of the `path` property of the value returned by `urllib.parse.urlsplit()`. The behaviour for resolving ties is unspecified.
this keeps the tabs under "Default paths" and "Avoiding caching" in sync
to reproduce the issue this commit solves, go to this page:
https://pip.pypa.io/en/stable/topics/caching/
then change the tabs under one of the sections, notice how changing to Unix / Linux breaks sync due to PipCLIDirective using the name [Linux](95a58e7ba5/docs/pip_sphinxext.py (L231)) for Unix based OS's
This follows the discussion in https://github.com/pypa/pip/pull/11487/files#r988625394,
that despite the VIRTUAL_ENV environment variable not being the technically correct
value, it is more readily understood by readers than ``sys.prefix``.
The new functionality serves a use case which was not previously possible with pip configuration files, namely the situation where you have a base Python installation and want to influence the pip configuration for all derivative virtual environments *without* changing the config for all other environments on a machine (global), or for all other environment run by the same user (user). Concretely, this could be used for a centrally managed network mounted filesystem based Python installation, from which multiple users can build virtual environments and inside which a specific pip configuration is needed (e.g. an index URL).