Commit Graph

3439 Commits

Author SHA1 Message Date
Paul Moore d6a21011b3 Remove support for extras after specifier in requirements 2021-01-23 12:06:44 +00:00
Stéphane Bidoul 8de9edf401
Merge pull request #9436 from sbidoul/vcs-url-sbi
Remove deprecated support for VCS pseudo URLs
2021-01-19 11:07:17 +01:00
Tzu-ping Chung 6c0e484703 Include both sources in inconsistency error 2021-01-18 19:00:52 +08:00
Stéphane Bidoul b3761f6fab
Remove support for git+git@ pseudo VCS URLs.
Now that we don't need to support git@
pseudo-urls, we can simplify the test for
valid VCS URLs based on link.is_vcs, which
is turns is based on the URL scheme.

This also means we fail earlier if a git@ pseudo
URL is used.

Since VCS requirements are not validated to be URLs
in Requirement constructors, we can simplify update_editable.
2021-01-18 09:11:07 +01:00
Pradyun Gedam 3af9093a73
Merge pull request #9274 from sbidoul/pip-wheel-must-keep-clone-sbi 2021-01-17 15:30:57 +00:00
Stéphane Bidoul aa089883a8
Merge pull request #9438 from sbidoul/legacy-cache-cleanup
Remove support for legacy cache entries
2021-01-13 16:03:43 +01:00
Stéphane Bidoul 750b8a32fe
Remove support for legacy cache entries 2021-01-10 11:50:13 +01:00
Pradyun Gedam 9b83654de8
Merge pull request #9331 from sbidoul/7969-revert-sbi
Revert #7969 and fix VCS stdout/stderr capture
2021-01-09 21:09:04 +00:00
Xavier Fernandez 14830ae837
Merge pull request #9372 from jdufresne/devnull
Prefer subprocess.DEVNULL over open(os.devnull, 'w')
2021-01-07 11:58:08 +01:00
Pradyun Gedam f01d60c3e3
Merge pull request #9388 from hugovk/the-future-is-now 2021-01-02 13:03:06 +00:00
Stéphane Bidoul 062f0e54d9
Merge pull request #9401 from jdufresne/ne
Remove unnecessary __ne__ definitions
2021-01-01 19:38:09 +01:00
Stéphane Bidoul df6ac53382
Merge pull request #9406 from sbidoul/simplify-check_binary_allowed-sbi
Simplify check_binary_allowed
2021-01-01 19:33:13 +01:00
Jon Dufresne ca053fbe88 Handle ._get_svn_url_rev() returning None in .get_remote_url()
The method Subversion._get_svn_url_rev() will sometimes return None for
a remote URL. The calling code should handle this. If it is None, raise
a RemoteNotFoundError as prescribed by the parent class docstring.

Followup to 0b761a164c.
2020-12-31 14:36:58 -08:00
Stéphane Bidoul 06f1eff024
Simplify check_binary_allowed
check_binary_allowed is only used to check
if a wheel needs to be built in 'pip install' mode.
It mixed format control and pep517 mode check.

We change it so it checks allowed formats only,
which leads to better readability of _should_build().
2020-12-31 13:17:44 +01:00
Jon Dufresne a49f1732e9 Remove unnecessary __ne__ definitions
Unnecessary since dropping Python 2 support. In Python 3, `__ne__`
defaults to the opposite of of `__eq__`.

https://docs.python.org/3/reference/datamodel.html#object.__ne__

> For `__ne__()`, by default it delegates to `__eq__()` and inverts the
> result unless it is `NotImplemented`.
2020-12-30 08:23:04 -08:00
Jon Dufresne 5150129f6b Replace compat.expanduser() with os.path.expanduser()
The upstream bug has been fixed and released in all supported Python
version: https://bugs.python.org/issue14768
2020-12-29 08:15:55 -08:00
Hugo van Kemenade 1cabd3a609 The future is now 2020-12-28 18:34:06 +02:00
Jon Dufresne 50517b2171 Prefer subprocess.DEVNULL over open(os.devnull, 'w')
Available since Python 3.3.

https://docs.python.org/3/library/subprocess.html#subprocess.DEVNULL

Use a context manager for the other opened file, dump.
2020-12-27 08:37:08 -08:00
Stéphane Bidoul e47734ed03
Add failing test that pip wheel -e keeps git clone in src 2020-12-27 17:13:29 +01:00
Jon Dufresne 14380668b5 Drop csv23 in favor of stdlib csv
Using csv23 has been unnecessary since dropping Python 2 support. It
previously remained as a compatibility shim.
2020-12-27 08:09:32 -08:00
Stéphane Bidoul b3d348d6e7
Merge remote-tracking branch 'upstream/master' into 7969-revert-sbi 2020-12-27 17:01:58 +01:00
Stéphane Bidoul 570a45ae71
Add test for call_subprocess stdout_only 2020-12-27 16:54:57 +01:00
Hugo van Kemenade a3e246f7d0 Cleanup: replace 'from urllib import xyz as urllib_xyz' with import urllib.xyz 2020-12-27 16:18:44 +02:00
Pradyun Gedam 5ccd226df8
Merge pull request #9364 from jdufresne/oserror
Use unified OSError and its subclasses
2020-12-27 12:15:41 +00:00
Tzu-ping Chung 92ad717612 New resolver incorrectly tries unneeded candidates
When the new resolver needs to upgrade a package, it puts the
already-installed package in the middle of the candidate list obtained
from indexes. But when doing it, the candidate list is eagerly consumed,
causing pip to download all candidates.
2020-12-27 04:16:29 +08:00
Tzu-ping Chung 41a30089de Re-apply invalid metadata skip
Skip candidate not providing valid metadata

This reverts commit 7165ab8cb9.
2020-12-27 04:16:24 +08:00
Jon Dufresne d282fb94a3 Use unified OSError and its subclasses
Since Python 3.3, the following classes have merged into OSError. They
remain as aliases for backward compatibility.

- EnvironmentError
- IOError
- WindowsError

https://docs.python.org/3/library/exceptions.html#OSError

Python 3 also has subclasses of OSError to help identify more specific
errors. For example, FileNotFoundError. This allows simplifying some
except blocks.
2020-12-26 12:16:09 -08:00
Pradyun Gedam 86afa89043
Merge pull request #9361 from jdufresne/f-strings
Use f-strings for simple string formatting
2020-12-26 10:24:18 +00:00
Pradyun Gedam fecfa11f5a
Merge pull request #9359 from jdufresne/get-remote-url
Harmonize type signature of VersionControl.get_remote_url() subclasses
2020-12-26 10:23:39 +00:00
Pradyun Gedam 31eb524ff0
Merge pull request #9351 from jdufresne/object
Remove object from class definitions
2020-12-26 10:21:40 +00:00
Jon Dufresne 1f9d6e4aea Remove unnecessary str() call around str literal
Unnecessary since dropping Python 2.
2020-12-25 16:52:35 -08:00
Jon Dufresne cdcf74fb8e Use f-strings for simple string formatting
Use pyupgrade to convert simple string formatting to use f-string
syntax. pyupgrade is intentionally timid and will not create an f-string
if it would make the expression longer or if the substitution parameters
are anything but simple names or dotted names.
2020-12-25 16:21:20 -08:00
Jon Dufresne 09b3d3a50b Remove object from class definitions
Unnecessary since dropping Python 2 support. In Python 3, all classes
are new style classes.
2020-12-25 15:48:11 -08:00
Jon Dufresne 0b761a164c Harmonize type signature of VersionControl.get_remote_url() subclasses
In the base class, the signature is defined as:

    type: (str) -> str

Further, the docstring says:

    Raises RemoteNotFoundError if the repository does not have a remote
    url configured.

However, some subclasses were returning None instead of raising
RemoteNotFoundError. This violated the type signature and forced calling
code to handle multiple error paradigms.

Now, all subclasses implement the base's signature.

This allowed simplifying some call sites as they can assume None will
not be returned.

This mismatch was noticed while trying to remove "mypy:
disallow-untyped-defs=False" comments.
2020-12-25 13:45:17 -08:00
Pradyun Gedam f91ba6b348
Merge pull request #9354 from jdufresne/super
Use short Python3 super() syntax
2020-12-25 19:18:28 +00:00
Jon Dufresne ba40f58ecc Remove encoding cookie from Python source files
Unnecessary since dropping Python 2. Python now decodes files as utf-8
by default.
2020-12-25 07:26:07 -08:00
Jon Dufresne 2e38024991 Drop u prefix from str literals
Unnecessary since dropping Python 2 support.

This makes one test case from test_str_to_display a duplicate and so has
been removed.
2020-12-25 07:26:06 -08:00
Jon Dufresne 5e11687cbd Replace typing.Text with str
Using typing.Text is unnecessary since dropping Python 2 support.

In Python 3, typing.Text is a simple alias of str. It exists as a
backward compatibility shim for Python 2.
2020-12-24 16:40:55 -08:00
Jon Dufresne c148bcc1aa Use short Python3 super() syntax 2020-12-24 15:11:51 -08:00
Jon Dufresne f32adaf09b Remove __future__ imports
Unnecessary since dropping Python 2.
2020-12-24 08:38:09 -08:00
Hugo van Kemenade 9db97546b3 os.curdir is already a str
Co-authored-by: Jon Dufresne <jon.dufresne@gmail.com>
2020-12-22 22:41:58 +02:00
Hugo van Kemenade 209ca8de8f Remove default allow_stderr_warning=False 2020-12-22 16:40:01 +02:00
Hugo van Kemenade 33f48e2b72 Replace more six 2020-12-22 10:22:20 +02:00
Hugo van Kemenade 817ee23051 Remove redundant Python 2.7 code 2020-12-22 09:06:26 +02:00
Pradyun Gedam be9637f7f5
Merge pull request #9189 from pradyunsg/drop-old-python-support
Drop support for Python 2.7 and Python 3.5
2020-12-20 18:57:41 +00:00
Pradyun Gedam 79f1b59335
We have no deprecated versions of Python now 2020-12-19 19:55:09 +00:00
Nikita Chepanov f8b03eefe2 Add `--ignore-requires-python` support to pip download 2020-12-17 12:40:01 -05:00
Pradyun Gedam 7165ab8cb9
Revert "Skip candidate not providing valid metadata" 2020-12-15 10:17:20 +00:00
Tzu-ping Chung 145be2eaf2 Skip pip search tests unless explicitly requested 2020-12-15 17:23:20 +08:00
Tzu-ping Chung d45541c8f3 Skip candidate not providing valid metadata
This is done by catching InstallationError from the underlying
distribution preparation logic. There are three cases to catch:

1. Candidates from indexes. These are simply ignored since we can
   potentially satisfy the requirement with other candidates.
2. Candidates from URLs with a dist name (PEP 508 or #egg=). A new
   UnsatisfiableRequirement class is introduced to represent this; it is
   like an ExplicitRequirement without an underlying candidate. As the
   name suggests, an instance of this can never be satisfied, and will
   cause eventual backtracking.
3. Candidates from URLs without a dist name. This is only possible for
   top-level user requirements, and no recourse is possible for them. So
   we error out eagerly.

The InstallationError raised during distribution preparation is cached
in the factory, like successfully prepared candidates, since we don't
want to repeatedly try to build a candidate if we already know it'd
fail. Plus pip's preparation logic also does not allow packages to be
built multiple times anyway.
2020-12-12 02:23:32 +08:00