Commit Graph

1402 Commits

Author SHA1 Message Date
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 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 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
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
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 c148bcc1aa Use short Python3 super() syntax 2020-12-24 15:11:51 -08:00
Hugo van Kemenade 817ee23051 Remove redundant Python 2.7 code 2020-12-22 09:06:26 +02:00
Pradyun Gedam 7165ab8cb9
Revert "Skip candidate not providing valid metadata" 2020-12-15 10:17:20 +00: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
Pradyun Gedam 68713c0a26
Mark the failing test as xfail 2020-11-29 17:33:59 +00:00
Stéphane Bidoul 3defc24e31
Removed unused comes_from argument of parse_requirements 2020-11-08 19:07:28 +01:00
Xavier Fernandez 4dc48da9db utils: make Hashes object hashable 2020-10-31 15:54:54 +01:00
Daniel Katz cea9f32dae Support multiple `abi` and `platform` values for `pip download`. 2020-10-27 19:00:22 -04:00
Pradyun Gedam f2852cd775
Merge pull request #8991 from asottile/dead_code
delete some dead test code (VERBOSE_FALSE)
2020-10-27 21:45:20 +05:30
Pradyun Gedam b39aeeb6df
Merge pull request #9050 from sbidoul/fix-freeze-direct_url-editable-sbi 2020-10-27 19:34:10 +05:30
Pradyun Gedam 45d3a3e859
Update tests for new signature 2020-10-27 01:05:29 +05:30
Pradyun Gedam abb3d0fae3
Move build_env tests to functional
These tests use the script fixture which as a 30s setup time on my
machine. This KILLS productivity when trying to run unit tests as part
of a feedback loop during development.
2020-10-25 23:32:26 +05:30
Stéphane Bidoul d5a2007e8f
Avoid AssertionError in pip freeze with editable direct URLs 2020-10-25 15:18:02 +01:00
Tzu-ping Chung 761433cee8 Eliminate len() usage in tests 2020-10-13 16:12:11 +08:00
Tzu-ping Chung 8326148149 Implement "lazy sequence" to avoid Internet
find_matches() is modified to return a special type that implements
the sequence protocol (instead of a plain list). This special sequence
type tries to use the installed candidate as the first element if
possible, and only access indexes when the installed candidate is
considered unsatisfactory.
2020-10-13 16:06:00 +08:00
Anthony Sottile 336e979894 delete some dead test code (VERBOSE_FALSE)
was just browsing through some files and noticed this
2020-10-12 16:05:05 -07:00
Nguyễn Gia Phong 6887b0795b Merge usage of download_dir and wheel_download_dir
In every cases, at least one of them is None.  By doing this,
it is also possible to simplify wrapper codes around download_dir.
2020-10-07 13:42:21 +07:00
Pradyun Gedam 58c594c06b
Prepare isort for black 2020-09-23 21:47:47 +05:30
Pradyun Gedam faee60baea
Merge pull request #8902 from pradyunsg/linter-updates 2020-09-23 21:44:55 +05:30
Pradyun Gedam 25ab172b55
Update linter: isort 2020-09-23 19:52:28 +05:30
Pradyun Gedam 4c534e65d2
Tweak message when -r is not passed on a requirements.txt 2020-09-23 19:46:36 +05:30
Pradyun Gedam e61bb616ef
Merge pull request #8839 from uranusjr/new-resolver-hash-intersect 2020-09-17 10:58:44 +05:30
Xavier Fernandez 822d42b11a
Merge pull request #8614 from McSinyx/monkeypatch.setenv
Use monkeypatch.setenv to mock env vars
2020-09-04 11:05:15 +02:00
Nguyễn Gia Phong 4a2e03c4ff Use monkeypatch for env var in wheel unit tests 2020-09-04 15:06:08 +07:00
Nguyễn Gia Phong cd549eb7f1 Use mock to patch for TZ env var 2020-09-04 15:06:08 +07:00
Xavier Fernandez 83f1640827
Merge pull request #8578 from McSinyx/parse-count
Allow verbose/quiet level to be specified via config file and env var
2020-09-03 18:34:53 +02:00
Tzu-ping Chung dfaa111004 Pull in hashes from constraint files 2020-09-03 17:26:52 +08:00
Pradyun Gedam a99190459e
Merge pull request #8817 from sbidoul/improve-git-checkout 2020-09-01 18:40:51 +05:30
Stéphane Bidoul 5797a080b6
Fix test that now requires a working git repo 2020-08-30 11:52:06 +02:00
Pradyun Gedam e17f845475
Merge pull request #8522 from NoahGorny/fix-requirements-file-options
install: Update extra-index-url in session from requirements file
2020-08-25 15:08:11 +05:30
Nguyễn Gia Phong b46576d933 Give batch downloader a separate class 2020-08-12 16:07:27 +07:00
Nguyễn Gia Phong 078e0effb7 Add memoization mechanism for file download
This is intentionally dependent from caching, which relies on cache dir.
2020-08-11 22:39:42 +07:00
Nguyễn Gia Phong e62f16e969 Make Downloader perform the download 2020-08-11 22:36:08 +07:00
Pradyun Gedam 8eea660e03
Merge pull request #8744 from hroncok/keyring_global_nope
When one keyring attempt fails, don't bother with more
2020-08-11 15:41:02 +05:30
Pradyun Gedam 4c7bbdb4e4
Merge pull request #8702 from uranusjr/get-distribution-looks-for-all 2020-08-10 20:30:55 +05:30
Noah Gorny aae63795b2 reqfile: Update extra-index-url/index-url in session from requirements file
Also update the relevant tests
2020-08-06 19:25:31 +03:00
Nguyễn Gia Phong 487d00295c Define RequirementPreparer._session 2020-08-06 18:42:59 +07:00
Tzu-ping Chung 4fce2ea88c Add test to ensure get_distribution() behavior 2020-08-06 10:59:07 +08:00
Miro Hrončok ba062c3ed0 When one keyring attempt fails, don't bother with more
This makes https://github.com/pypa/pip/issues/8090 much less painful.
2020-08-03 12:34:26 +02:00