1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00
Commit graph

1560 commits

Author SHA1 Message Date
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
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
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
Chris Hunt
f0d4df10eb Propagate lazy_wheel option through RequirementPreparer
Reduces dependence on Candidate (and Resolver (and Factory)).
2020-08-02 18:40:11 -04:00
Tzu-ping Chung
ea47920767 Add test case for SlikSVN version parsing 2020-08-01 02:03:45 +08:00
a85be3f555 Test verbose/quiet level specified via env var and config file 2020-07-28 10:13:24 +07:00
Pradyun Gedam
7056132f6f
Merge pull request #8601 from rouge8/use-feature-requirements-file 2020-07-27 13:19:51 +05:30
c564a3d541 Use monkeypatch.setenv in config and option tests 2020-07-25 20:46:45 +07:00
Stéphane Bidoul
38fe3c2f14
Percolate --use-feature from req file upwards
We explicitly propagate --use-feature options from req files upwards.
This is not strictly necessary for the option to be enabled, because
of the default value is a global list, but that implicit behaviour is
certainly accidental, so we make it explicit, with a test.
2020-07-25 11:14:04 +02:00
Pradyun Gedam
982aac544e
Merge pull request #8584 from McSinyx/range-unsupported-exc 2020-07-21 13:53:20 +05:30
Andy Freeland
3eef588a03 Support '--use-feature' in requirements files
This patch adds support for `--use-feature` in requirements files
so that a project that wants all contributors using the same pip
features can specify it in the requirements file. For example, to ensure
a requirements file uses the new resolver:

```
--use-feature=2020-resolver
boto3
boto3==1.13.13
```

This is a new version of #8293.
2020-07-18 16:08:47 -07:00
05bdc69aa3 Make test more explicit 2020-07-17 14:33:19 +07:00
cb8d81d135 Nitpick logging calls 2020-07-17 14:33:19 +07:00
892018eaf2 Use local server for an unit test for lazy wheel 2020-07-16 21:09:59 +07:00
Chris Hunt
c40d7b2122
Merge pull request #8575 from chrahunt/tests/add-better-entrypoint-test
Make wheel entrypoint error test higher-level
2020-07-15 16:52:35 -04:00
Pradyun Gedam
fa2fceecf1
Merge pull request #8189 from gutsytechster/remove_raise_for_status 2020-07-15 18:06:27 +05:30
db217992bd Use more descriptive exception when range requests are unsupported 2020-07-15 16:28:53 +07:00
Chris Hunt
05f2d9ebf6 Make entrypoint error test higher-level
The current tests didn't catch the bug that the new tests do,
so they have been removed. Using higher-level tests can give us more
confidence that things work end-to-end and are less likely to get in
the way of refactoring.

The new test has been marked xfail since the bug is still present.
2020-07-11 15:45:18 -04:00
Chris Hunt
8bf5731b84
Merge pull request #8562 from chrahunt/extract-direct-from-zip-refactoring
Install directly from wheels, without unpacking into an intermediate directory
2020-07-10 21:33:16 -04:00
Chris Hunt
e9508591ce
Merge pull request #8556 from chrahunt/maint/fail-on-install-location-options
Disallow explicitly passing install-location-related arguments in --install-options
2020-07-09 21:25:20 -04:00
Chris Hunt
d13ec25361 Prevent path traversal when installing wheels directly 2020-07-09 21:21:35 -04:00
gutsytechster
8c267e6e39
feat(pip/_internal/*): Use custom raise_for_status method 2020-07-08 18:08:55 +05:30
Christopher Hunt
b27956928f
Merge pull request #8553 from uranusjr/header-location-prefix
Header location prefix
2020-07-07 21:37:50 -04:00
Christopher Hunt
53aa1a932b
Merge pull request #8538 from McSinyx/parallel-test-teardown
Make utils.parallel tests tear down properly
2020-07-07 21:19:28 -04:00
Chris Hunt
f878fcdeec Rename function that reject location install options
Since it no longer shows a deprecation warning, the previous name
doesn't fit.
2020-07-07 19:11:11 -04:00
Chris Hunt
89572a7d40 Throw CommandError on any location-related install options 2020-07-07 19:11:11 -04:00
Tzu-ping Chung
600d5272e6 Add failing test for --prefix location 2020-07-07 18:53:33 +08:00
Christopher Hunt
334f06e224
Merge pull request #8054 from deveshks/correct-package-name-while-install
Canonicalize req name while doing pre-install package search
2020-07-06 12:10:33 -04:00
Christopher Hunt
161ee7f852
Merge pull request #8548 from chrahunt/better-wheel-empty-dir-test
Refactor test for empty directory in wheel
2020-07-06 09:25:31 -04:00
Devesh Kumar Singh
04fedfe53c Create custom get_distribution function 2020-07-06 13:42:05 +05:30
Christopher Hunt
4ba51d2e9c
Merge pull request #8501 from uranusjr/refactor-create-link-collector
Tidy up link collector constructor imports
2020-07-05 21:44:31 -04:00
Chris Hunt
ba96ba3b08 Reduce empty directory test coupling to implementation
Our previous test required that the implementation use a temporary
directory and unpack the wheel in-place. Now we just provide a
conventional empty directory in the wheel file itself.
2020-07-05 20:16:36 -04:00
Chris Hunt
a9c7f229b0 Create sample project wheel inline 2020-07-05 20:16:36 -04:00
Chris Hunt
42c01ae97e Normalize Path to str in wheel tests
In our next commit we will use the scheme path to locate files to
byte-compile. If the scheme path is a `Path`, then that causes
`compileall.compile_file` (via `py_compile.compile`) to fail with:

```
.tox/py38/lib/python3.8/site-packages/pip/_internal/operations/install/wheel.py:615: in install_unpacked_wheel
    success = compileall.compile_file(
../../../.pyenv/versions/3.8.0/lib/python3.8/compileall.py:157: in compile_file
    ok = py_compile.compile(fullname, cfile, dfile, True,
../../../.pyenv/versions/3.8.0/lib/python3.8/py_compile.py:162: in compile
    bytecode = importlib._bootstrap_external._code_to_timestamp_pyc(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

code = <code object <module> at 0x7fa7e274f500, file "/tmp/user/1000/pytest-of-chris/pytest-37/test_std_install_with_direct_u0/dest/lib/sample/__init__.py", line 1>, mtime = 1593910285.2200587, source_size = 134

>   ???
E   ValueError: unmarshallable object
```

Debugging in gdb shows that the error is set due to the `Path` object
being present in the code object, which `marshal.dumps` can't handle
(frame 1):

```
 0  w_complex_object (v=<optimized out>, flag=<optimized out>, p=0x7fffffff7160) at Python/marshal.c:564
 1  w_object (v=<Path at remote 0x7fffee51f120>, p=0x7fffffff7160) at Python/marshal.c:370
 2  w_complex_object (v=<code at remote 0x7fffee591710>, flag=<optimized out>, p=0x7fffffff7160) at Python/marshal.c:544
 3  w_object (v=<code at remote 0x7fffee591710>, p=0x7fffffff7160) at Python/marshal.c:370
 4  w_complex_object (v=('1.2.0', <code at remote 0x7fffee591710>, 'main', None), flag=<optimized out>, p=0x7fffffff7160) at Python/marshal.c:475
 5  w_object (v=('1.2.0', <code at remote 0x7fffee591710>, 'main', None), p=0x7fffffff7160) at Python/marshal.c:370
 6  w_complex_object (v=<code at remote 0x7fffee591ea0>, flag=<optimized out>, p=0x7fffffff7160) at Python/marshal.c:539
 7  w_object (p=0x7fffffff7160, v=<code at remote 0x7fffee591ea0>) at Python/marshal.c:370
 8  PyMarshal_WriteObjectToString (version=<optimized out>, x=<code at remote 0x7fffee591ea0>) at Python/marshal.c:1598
 9  marshal_dumps_impl (module=<optimized out>, version=<optimized out>, value=<code at remote 0x7fffee591ea0>) at Python/marshal.c:1739
 10 marshal_dumps (module=<optimized out>, args=<optimized out>, nargs=<optimized out>) at Python/clinic/marshal.c.h:124
```

In the interest of easy git bisects, we commit this fix before the code
that would expose the bug.
2020-07-05 09:38:08 -04:00
512221e1c1 Make utils.parallel tests tear down properly 2020-07-04 15:07:38 +07:00
Chris Hunt
3930e4b063 Drop unused argument 2020-07-03 19:46:45 -04:00
Chris Hunt
d49d97f19f Pass Wheel distribution to install.wheel.get_entrypoints
Right now we're just wiring up the arguments. Next we will actually use
them.
2020-07-03 19:46:45 -04:00
Chris Hunt
a953787152 Extract entrypoint test text construction into variable
We need this to construct the new argument to `get_entrypoints`.
2020-07-03 19:46:45 -04:00
Chris Hunt
3fad029b77 Test get_entrypoints when none are expected 2020-07-03 17:49:56 -04:00
Chris Hunt
dcd5cadcfd Expect a plain list in get_csv_rows_for_installed
This makes get_csv_rows_for_installed simpler, because it is not
modifying its arguments. We can also more easily refactor RECORD file
reading since it is now decoupled from getting the installed RECORD file
rows.
2020-07-03 12:25:12 -04:00
Xavier Fernandez
09f9b0030d
Merge pull request #8096 from deveshks/list-config-files
Add option to list config files with pip config
2020-07-02 15:01:35 +02:00
Pradyun Gedam
e774eccf46
Merge pull request #8343 from uranusjr/entrypoint-unicode 2020-06-30 14:33:24 +00:00
Pradyun Gedam
18431be48f
Merge pull request #8467 from McSinyx/lazy-wheel 2020-06-30 13:39:04 +00:00
Pradyun Gedam
93b0683d65
Merge pull request #8470 from deveshks/remove-always-unzip 2020-06-30 13:33:30 +00:00
Pradyun Gedam
17608c43d1
Merge pull request #8465 from deveshks/collector-debug-to-warn 2020-06-29 18:28:10 +00:00
Devesh Kumar Singh
6c899ed0c8 Update warning message to specify HTTP request 2020-06-29 22:20:11 +05:30
Devesh Kumar Singh
46790a4f3c Improve warning message for invalid vcs schemes 2020-06-28 16:23:07 +05:30
Devesh Kumar Singh
499e112275 Add unit tests to check vcs and archive url with invalid scheme 2020-06-28 16:23:07 +05:30
Devesh Kumar Singh
7a8f374c39 Add option to list config files with pip config 2020-06-28 16:22:00 +05:30
Tzu-ping Chung
ec7324fba0 Tidy up link collector constructor imports
make_link_collector() was in self_outdated_check, a module responsible
for checking whether the currently-running pip is outdated, but is
imported by things that has nothing to do with this outdated check. Move
the function to be a class method in LinkCollector so the module
hierarchy makes more sense.
2020-06-26 17:31:28 +08:00
25a25a0975 Test network.lazy_wheel.dist_from_wheel_url 2020-06-26 15:15:28 +07:00
0a3b20f9b8 Drop parallel map for Python 2 and the non-lazy variant
Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
2020-06-25 21:10:49 +07:00
13539d00f8 Wrap lazy map as well 2020-06-25 21:10:49 +07:00
e7f637e5ca Add tests for utils.parallel 2020-06-25 21:10:49 +07:00
Devesh Kumar Singh
bd70025c98 Remove --always-unzip based tests 2020-06-25 16:52:15 +05:30
Pradyun Gedam
fb68794188
Merge pull request #8026 from sbidoul/requested-sbi 2020-06-24 18:24:30 +05:30
Tzu-ping Chung
b0c1308d64 Always Unicode 2020-06-10 20:58:21 +08:00
Tzu-ping Chung
f81fd19a7b Ensure entry points are read as UTF-8
Like the wheel metadata, this is, strictly speaking, unspecified. But
UTF-8 is the de-facto standard, and we should support that.
2020-06-10 20:58:20 +08:00
Paul Moore
7bf78f05df
Merge pull request #8283 from uranusjr/pre-existing-build-directory-fix
Pre-existing build directory fix
2020-06-09 16:47:53 +01:00
Devesh Kumar Singh
db11f83e2a Fix tests module with flake8-bugbear 2020-06-05 02:41:08 +05:30
Tzu-ping Chung
09a7f271c7 Only attach UUID to build dir for spec candidates
These are the only cases where backtracking can happen. This approach
also accounts for VCS requirements relying on the same ensure function
to do cloning :/
2020-06-04 23:26:19 +08:00
Stéphane Bidoul
b9a19f6be0
Rename is_direct to user_supplied 2020-05-31 18:33:51 +02:00
Stéphane Bidoul
c9a445762c
Mark top level requirements as REQUESTED 2020-05-31 18:33:51 +02:00
Stéphane Bidoul
21df86f197
Add REQUESTED support to install_wheel 2020-05-31 18:33:50 +02:00
Devesh Kumar Singh
fe76a1229c Return SUCCESS from FakeCommand.run if run_func isn't provided 2020-05-28 22:31:00 +05:30
Devesh Kumar Singh
f2fb3610f3 Return SUCCESS from side effect function 2020-05-28 22:31:00 +05:30
Tzu-ping Chung
6c6b6a7765 Implement new Provider.find_matches() 2020-05-27 23:10:56 +08:00
Tzu-ping Chung
bc9b288b1e Implement wheel cache lookup in the new resolver 2020-05-27 20:19:37 +08:00
Pradyun Gedam
c3203aa282
Merge pull request #8292 from deveshks/add-mypy-req-constructors 2020-05-23 17:13:17 +05:30
Pradyun Gedam
d5265e24b7
Merge pull request #8083 from deveshks/warn-on-unexpected-content-type 2020-05-23 17:12:08 +05:30
gutsytechster
b82516c9ca fix(_internal/commands): Define a default add_option to child commands 2020-05-23 14:55:37 +05:30
gutsytechster
72a42197a4 refactor(commands): Add method add_options and remove __init__
This removes the __init__ method of child classes and defines
explicit method for adding command options.
2020-05-23 14:50:57 +05:30
Devesh Kumar Singh
ac39efa537 Update parse_editable to return Set[str] 2020-05-22 04:21:14 +05:30
Devesh Kumar Singh
64c78b19b9 Reword warning for invalid content-type 2020-05-21 19:37:03 +05:30
Devesh Kumar Singh
fa67244d45 Add unit test to warn on invalid content-type 2020-05-21 19:37:03 +05:30
Tzu-ping Chung
aef15104c3 Fix test comment 2020-05-19 16:03:51 +08:00
Tzu-ping Chung
776a55a419 Fix unit tests on module-internal functions 2020-05-19 16:03:51 +08:00
Pradyun Gedam
e7dd02c723
Merge pull request #8027 from gutsytechster/pip/7998 2020-05-19 12:14:59 +05:30
Paul Moore
e28b388c73
Merge pull request #7997 from uranusjr/resolver-use-user-site
New resolver: implement --user
2020-05-15 20:01:50 +01:00
gutsytechster
2276f9528c fix(network/auth): Asks for password when it is None
When `get_keyring_auth` provides the password as None, the
user should be prompt to ask password.
2020-05-15 19:41:43 +05:30
Paul Moore
d42c448e7a
Merge pull request #8234 from pfmoore/refactor_find_matches
Split find_matches into generation and sorting
2020-05-15 13:54:50 +01:00
Pradyun Gedam
9f0665cefe
Merge pull request #8055 from gutsytechster/endian_safe 2020-05-14 17:03:41 +05:30
Paul Moore
9cf1bed78d Address review comments 2020-05-14 11:33:30 +01:00
Paul Moore
ddbc8fd7c1 Split find_matches into generation and sorting 2020-05-13 17:52:09 +01:00
Pradyun Gedam
0bd624275d
Revert "build in place"
This reverts commit 88e6e6bc5c.
2020-05-13 02:50:10 +05:30
Pradyun Gedam
1b90e1bccf
Revert "remove _copy_source_tree and friends"
This reverts commit 873f1e6332.
2020-05-13 02:50:10 +05:30
Paul Moore
94f2dc435b
Merge pull request #8170 from pfmoore/nr_constraints2
New Resolver: Second try at implementing constraints
2020-05-07 12:40:49 +01:00
Paul Moore
64b3d1b278 Merge constraints into a single SpecifierSet 2020-05-06 11:30:25 +01:00
Paul Moore
ee4830b5ec Move constraints from factory to provider 2020-05-06 10:56:50 +01:00
Tzu-ping Chung
d8062791dd Implement use-user-site 2020-05-06 03:48:34 +08:00
Pradyun Gedam
09a5af52e4
Merge pull request #8125 from uranusjr/yanked-link-warning-relocate 2020-05-05 16:15:52 +05:30
gutsytechster
b30dd1e04e fix(tests/unit): Update tests to be endian safe
This updates `test_path_to_display` and `test_str_to_display__encoding`
to use the endian safe expected result instead of the hardcoded one.

This fixes https://github.com/pypa/pip/issues/7921
2020-05-03 22:51:00 +05:30
Paul Moore
1599cc2a36 Merge branch 'master' into nr_upgrade_strategy 2020-05-03 11:01:27 +01:00
Paul Moore
2483fb6cdd
Merge pull request #8127 from pradyunsg/resolver/installation-order
Rework `get_installation_order` to allow for dependency cycles
2020-05-03 09:58:59 +01:00
Devesh Kumar Singh
8dccece9c0 Combine setting new umask and getting old one into one 2020-04-29 11:57:11 +05:30
Devesh Kumar Singh
9319703ad9 Add unit test for checking permissions with custom umask 2020-04-29 11:46:43 +05:30
Paul Moore
1eb7011da4 Add an assertion that upgrade_strategy is valid 2020-04-28 10:39:53 +01:00
Tzu-ping Chung
adef52610e Fix assertion 2020-04-26 18:22:21 +08:00
Tzu-ping Chung
9af0b3daeb Use oct for better error message 2020-04-26 18:17:33 +08:00
Tzu-ping Chung
388ca923ef Add persumably failing permission check 2020-04-26 18:14:38 +08:00
Pradyun Gedam
ea52559cf8
Add tests for get_topological_weights 2020-04-25 04:09:28 +05:30
Pradyun Gedam
9ae99b6d2b
Factor out test logic for graph generation 2020-04-25 04:09:28 +05:30
Pradyun Gedam
ebc0e33378
Amend tests, by fixing typos 2020-04-25 04:09:28 +05:30
Tzu-ping Chung
367e6617bd Move yanked message unit tests to use resolver 2020-04-25 03:53:53 +08:00
Tzu-ping Chung
f35f37ef72 Add find_requirement() wrapper in legacy resolver 2020-04-25 02:28:43 +08:00
Paul Moore
df3b440f7b Fix the factory fixture to supply the new upgrade_strategy argument 2020-04-24 12:03:29 +01:00
Pradyun Gedam
5e4c3565e4
Update tests, didn't directly reference "regex" 2020-04-20 22:58:10 +05:30
Pradyun Gedam
7e61569b1a
Drop --skip-requirements-regex 2020-04-20 22:37:25 +05:30
Pradyun Gedam
471bc0e2c3
Merge pull request #7962 from CrafterKolyan/patch-1
Speed up `pip list --outdated`
2020-04-14 02:28:28 +05:30
Pradyun Gedam
3c1cf3e139
Merge pull request #7885 from NoahGorny/cache-trusted-host
Cache trusted host
2020-04-14 02:26:28 +05:30
Pradyun Gedam
f458573de6
Merge pull request #7882 from sbidoul/build-in-place-7555-sbi
Build local directories in place
2020-04-13 21:33:02 +05:30
Stéphane Bidoul
873f1e6332
remove _copy_source_tree and friends 2020-04-12 12:00:57 +02:00
Stéphane Bidoul
88e6e6bc5c
build in place 2020-04-12 12:00:57 +02:00
Stéphane Bidoul
076d1a8ed8
Fix tests that build fake InstallRequirements with source_dir 2020-04-12 11:39:09 +02:00
Paul Moore
c7bde5bf88
Merge pull request #7990 from uranusjr/resolver-installed-2
New Resolver: Correctly uninstall existing distribution before installing
2020-04-09 20:58:17 +01:00
Nikolay Korolev
3acf8b7e4b
Merge branch 'master' into patch-1 2020-04-09 15:48:56 +03:00
Xavier Fernandez
ea9cb06c49
Merge pull request #7988 from McSinyx/tabulate
Fix tabulate col size in case of empty cell
2020-04-09 13:35:16 +02:00
Tzu-ping Chung
be60eaaa4f Uninstall existing dist before reinstallation 2020-04-08 17:17:25 +08:00
Danny McClanahan
6e7b16cec4
add failing test ; apply the fix ; add template NEWS entry
add failing test

apply the fix

add template NEWS entry according to https://pip.pypa.io/en/latest/development/contributing/#news-entries (wrong PR #)

rename news entry to the current PR #

respond to review comments

fix test failures

fix tests by adding uuid salt in urls

cache html page fetching by link

make CI pass (?)

make the types much better

finally listen to the maintainer and cache parse_links() by url :)

avoid caching parse_links() when the url is an index url

cleanup

add testing for uncachable marking

only conditionally vendor _lru_cache for py2

bugfix => feature

python 2 does not cache!

Do away with type: ignore with getattr()

respond to review comments
2020-04-07 12:01:43 -07:00
26b76f6f11 Move tabulate to utils.misc and test it 2020-04-07 17:35:47 +07:00
Nikolay Korolev
e454181ba6 Fix coding style 2020-04-04 22:30:57 +03:00
Nikolay Korolev
f8bb362fef Fix Python 2 compatibility in tests 2020-04-04 22:26:03 +03:00
Nikolay Korolev
3bc3cee5ae Add logging thread-safety tests 2020-04-04 22:18:12 +03:00
Tzu-ping Chung
f061f3f691 Fetch install dist for a candidate if available
The candidate creation logic is further moved into the factory. The
factory would use pkg_resources.get_distribution() to find a matching
distribution for a givan InstallationCandidate. If found, the Candidate
would be created based on that found distribution, instead of the link.

--ignore-installed is implemented as to always use the link to create
candidates, even if an installed distribution is found.
2020-04-03 00:36:26 +08:00
Tzu-ping Chung
190c424b1e Implement Python as a dependency
If a dist contains Requires-Python metadata, it is converted into a
Requirement for the resolver based on whether the Requires-Python
is compatible or not.

If it is compatible, an ExplicitRequirement is returned to hold the
Python information (either sys.version_info, or the user-supplied
--python-version).

If it is incompatible, a special NoMatchRequirement is returned, which
never matches to anything, generating a ResolutionImpossible to report
the Python version incompatibility.

The --ignore-requires-python flag is implemented as to not return a
Requirement for Requires-Python at all.
2020-04-02 18:36:08 +08:00
Paul Moore
2a1f3c22a6
Merge pull request #7910 from uranusjr/resolver-refactor-factory
Second round of resolver refactor factory
2020-04-02 11:27:04 +01:00
Stéphane Bidoul
94b77130aa
Add WheelCache method to inform which cache was used
Return whether the link was found in the persistent or ephemeral cache.
2020-04-01 22:57:00 +02:00
Stéphane Bidoul
f77944733d
Add DirectUrl support to install_wheel 2020-04-01 22:56:59 +02:00
Stéphane Bidoul
bd4d52b09c
Add helper to get DirectUrl metadata from Distrribution 2020-04-01 22:56:59 +02:00
Stéphane Bidoul
88582c2564
Add helper to create a DirectUrl from a Link 2020-04-01 22:56:59 +02:00
Stéphane Bidoul
6f689f61db
Add helper to convert DirectUrl to PEP 440 direct reference 2020-04-01 22:56:59 +02:00
Stéphane Bidoul
6b7f4ce81b
Add DirectUrl model, implementing PEP 610 2020-04-01 22:56:59 +02:00
Paul Moore
657cf2515b
Merge pull request #7929 from McSinyx/tmp-file
Use better temporary files mechanism
2020-04-01 16:47:30 +01:00
209c74f690 Use better temporary files mechanism 2020-04-01 22:02:34 +07:00
Pradyun Gedam
7b02273f3e
Merge pull request #7927 from deveshks/raise-exception-if-rev-empty-git-url
Raise an exception if revision is empty in git url
2020-04-01 18:17:36 +05:30
Tzu-ping Chung
d29c86af98 Add method to create requirement from spec 2020-04-01 16:53:39 +08:00
Tzu-ping Chung
32c46403c5 Fix factory fixture for wheel_cache refactoring 2020-04-01 16:00:48 +08:00
Paul Moore
534561cbec
Merge pull request #7945 from uranusjr/unit-tests-new-resolver
Rename unit tests to use the new_resolver scheme
2020-03-31 10:55:09 +01:00
Tzu-ping Chung
64c78a5875 Rename unit tests to use the new_resolver scheme 2020-03-31 16:19:41 +08:00
Devesh Kumar Singh
0d2ca67729 Changed ValueError to InstallationError 2020-03-30 22:29:40 +05:30
Tzu-ping Chung
1514d85a08 Fix wheel_cache argument for the new resolver 2020-03-30 17:37:28 +08:00
Tzu-ping Chung
6db0df928c Move wheel cache out of InstallRequirment 2020-03-30 17:36:03 +08:00
Devesh Kumar Singh
106bd0d77f Raise an exception if revision is empty in git url 2020-03-29 12:04:48 +05:30
Tzu-ping Chung
f32beda075 Remove unused provider fixture from argumnet lists 2020-03-27 18:57:53 +08:00
Tzu-ping Chung
b1272a98f9 Make factory available in tests as a fixture 2020-03-27 03:53:01 +08:00
Tzu-ping Chung
4fd12fbf56 Fix PipProvider signature in test fixture 2020-03-27 03:34:27 +08:00
Noah Gorny
2050ecc7d7 tests: session: Remake test_insecure_host into test_trusted_host 2020-03-26 21:29:32 +02:00
Tzu-ping Chung
231ce27829 Delete unused improt and test util
This util function is already broken by previous signature changes to
make_requirement() anyway.
2020-03-27 03:25:43 +08:00
Noah Gorny
c936ed0165 session: Rename _insecure_adapter to _trusted_host_adapter
Currently it is just the insecure adapter, but this can change in the future
2020-03-26 21:15:38 +02:00
Tzu-ping Chung
3cb7a08f0d Implement ignore_dependencies in new resolver
If this flag is set, simply report every candidate has no dependencies.
2020-03-24 02:02:36 +08:00
Tzu-ping Chung
5af542ccac Use named arguments for clarity 2020-03-24 02:00:08 +08:00
Paul Moore
098d00d8c3 Add a test that runs the full resolver 2020-03-18 14:42:20 +00:00
Paul Moore
7d2eb544b5 Implement PipProvider 2020-03-18 14:42:16 +00:00
Tzu-ping Chung
ffb3692e00 Add simple tests for get_installation_order()
The implementation is improved a bit to make the sorting result more
predictable for easier testing.
2020-03-15 23:01:57 +08:00
Pradyun Gedam
4f6bef6eb4
Merge pull request #7792 from pradyunsg/misc/utils-tags
Rename pep425tags -> utils.compatibility_tags
2020-03-12 14:46:52 +05:30
Paul Moore
9b10b93503 Implement the resolvelib Requirement class 2020-03-11 11:37:56 +00:00
Jason R. Coombs
6282a307dc 👹 Feed the hobgoblins (delint). 2020-03-06 12:43:10 -05:00
Jason R. Coombs
3511d3d493 Convert the remaining '%' formatters to '.format'. Fixes #6973. 2020-03-06 12:43:03 -05:00
Xavier Fernandez
3ce1872aaf Actually test user_config_dir in TestUserConfigDir 2020-02-28 10:58:54 +01:00
Xavier Fernandez
b42a069920 utils.appdirs: drop unused user_data_dir function
The vendored appdir's user_data_dir function is used inside
user_config_dir which is itself tested.
2020-02-28 10:58:54 +01:00
Pradyun Gedam
3fa356a772
Update references to pep425tags 2020-02-26 10:24:43 -08:00
Chris Hunt
8362c20da5 Rename legacy resolver unit tests
It's a little long, but better to be consistent with our other test file
naming conventions until we come up with better ones.
2020-02-25 09:04:07 -05:00
Chris Hunt
fd74d0362c Move legacy_resolve to resolution.legacy.resolver
This gives us a concrete place to put the new resolver code and
resolver-specific modules (`resolution.resolver`).

The reason for another level of hierarchy compared to other modules
is to allow us to move other modules here as they
become implementation details of the legacy resolver. Examples I
have in mind are: `req.req_set`, `req.req_install`,
`req.constructors`, and `operations.prepare`.
2020-02-25 09:04:06 -05:00
Chris Hunt
40bc4ea8fe Move network unit tests to align with subpackage names 2020-02-23 16:22:30 -05:00
Christopher Hunt
40523794d8
Merge pull request #7747 from pfmoore/parsed_requirement
Refactor parse_requirements to be independent of InstallRequirement
2020-02-24 00:21:28 +08:00
Anudit Nagar
082c0f01d2
Update old-style formatting to new-style formatting (#7762) 2020-02-21 21:48:14 +05:30
Nitesh Sharma
ce1e0f470a
Move UI helpers to cli subpackage (#6727) 2020-02-21 14:01:13 +05:30
Paul Moore
f085bb0e0e Merge branch 'master' into parsed_requirement 2020-02-14 20:34:44 +00:00
Paul Moore
aac5d821f9 Move make_requirement to pip._internal.req.constructors (and rename it) 2020-02-14 12:22:50 +00:00
Paul Moore
90e4eb3eed Make parse_requirements return a ParsedRequirement 2020-02-14 11:52:53 +00:00
Pradyun Gedam
cdae7277ef
Merge pull request #7596 from uranusjr/6446-link-url-quoting
Fix incorrect quoting Link.url
2020-02-14 16:00:43 +05:30
Paul Moore
e2a57fd1e6 Refactor to reduce coupling.
* Make ParsedLine record the type of line
* Split handle_line to allow passing arguments only where needed
* Remove unneeded attributes from ParsedRequirement
2020-02-14 09:56:42 +00:00
Paul Moore
f2e49b3946 Use a new ParsedRequirement class to communicate between handle_line and parse_requirements 2020-02-13 10:39:17 +00:00
Paul Moore
6f154f5546
Merge pull request #7707 from pfmoore/refactor_options
Pass individual options to InstallRequirement rather than an options object
2020-02-07 14:22:10 +00:00
Paul Moore
a9f1d8562b Pass individual options to InstallRequirement rather than an options object 2020-02-06 16:05:11 +00:00
Chris Hunt
e7998a3617 Rename populate_requirement_set to get_requirements 2020-02-05 22:30:07 -05:00
Chris Hunt
de5ec7e884 Remove unused requirement_set argument 2020-02-05 22:30:07 -05:00
Chris Hunt
9c58aa7eb5 Do not use InstallRequirement in warn_deprecated_install_options
This only needed a list of requirements, so give it just that.
2020-02-05 22:30:07 -05:00
Chris Hunt
fd815bc1fa Pass in a plain list of InstallRequirement to Resolver.resolve
Further simplifies the Resolver interface, and will give us the
opportunity to remove any knowledge of RequirementSet from the
individual commands.
2020-02-05 22:30:05 -05:00
Chris Hunt
550ae907bd Parameterize check_supported_wheels to Resolver.resolve
This reduces our dependence on the input RequirementSet.
2020-02-05 22:29:46 -05:00
Chris Hunt
58c06299db Return a different RequirementSet from Resolver.resolve
This makes the resolver interface simpler by returning a brand new
RequirementSet vs mutating the one that was input to the function, and
will let us specialize RequirementSet for the different use cases.
2020-02-05 22:29:30 -05:00
Chris Hunt
8197a4bbc5 Do not write delete marker file to track source_dir delete preference
Previously we were writing a delete marker file which is checked in
InstallRequirement.remove_temporary_source which is only invoked if the
user did not pass --no-clean (and a PreviousBuildDirError was not
raised). Since our TempDirectory machinery now respects these conditions
we can just wrap our source directory in that instead of using this
ad-hoc mechanism for tracking our delete preference.

This will let us clean up a lot of dead code that only existed for this
use case.
2020-02-05 20:14:44 -05:00
Chris Hunt
b8c0d0175d Do not test unpack_http_url or unpack_file_url
The tests for unpack_{file,http}_url relies on these functions to both
retrieve and unpack. We want to move unpacking out, so call unpack_url
instead.
2020-02-04 21:49:40 -05:00
Chris Hunt
39d1c51fdb Globally-manage BuildEnvironment._temp_dir 2020-02-04 20:32:27 -05:00
Chris Hunt
f2af7df453 Use tempdir_registry to control auto-deleted files globally
Next we can actually transition some files to be globally-managed that
are only deleted conditionally.
2020-01-29 23:04:26 -05:00
Chris Hunt
45991bcc1e Use explicit default value for TempDirectory delete flag
Now we can opt-in to globally-managed + globally-configured file
deletion for pre-existing directories by passing an explicit `None`.
2020-01-29 23:04:14 -05:00
Christopher Hunt
f1cd4cb48e
Merge pull request #7608 from uranusjr/global-cleanup
Delay TempDirectory.delete resolution to cleanup
2020-01-22 18:25:05 +08:00
Stéphane Bidoul (ACSONE)
0e1e0ef566 _should_cache does not depend on check_binary_allowed
_should_cache is only called by _get_cache_dir.

In pip install mode, _get_cache_dir is never called when
check_binary_allowed returns False because in that case
should_build_for_install_command has returned False before
and the build was skipped.

In pip wheel mode, check_binary_allowed always returns True
(because it is not passed to the build function).

So _should_cache can use _always_true for check_binary_allowed.

*Alternative*

Alternatively, we could have passed check_binary_allowed
to build in pip wheel mode. The only difference is that wheels built
locally from *legacy* packages would then not be cached,
when pip wheel is used with --no-binary.
2020-01-20 10:41:48 +01:00
Tzu-ping Chung
35377c995c Add test for tempdir registry lazy eval 2020-01-19 18:22:14 +07:00
Pradyun Gedam
f1cf84e2f8
Merge pull request #7542 from sbidoul/normalize-cache-dir-sbi
Eagerly normalize cache directory
2020-01-18 22:38:59 +05:30
Tzu-ping Chung
cdd7821d92 Fix incorrect quoting Link.url
Cherry-picked manually from atugushev:fix-issue-6446.

Co-Authored-By: Albert Tugushev <albert@tugushev.ru>
2020-01-14 16:12:11 +08:00
Pradyun Gedam
b411cdbdf5
Azure Pipelines: Test Windows on Python 3.8 (#7320) 2020-01-13 12:33:43 +00:00
Chris Hunt
8d92e40c1f Use USERPROFILE in expanduser test
In Python 3.8, expanduser on Windows no longer respects HOME, per
https://bugs.python.org/issue36264.
2020-01-12 19:44:43 -05:00
Chris Hunt
0a57e4e9f2 Manage temp directory deletion centrally
This gives us a global toggle that we can use to control whether
temporary directories get deleted from one place (ideally, in the
commands taking --no-clean).
2020-01-10 11:08:05 +01:00
Stéphane Bidoul (ACSONE)
8ce0859012
Remove redundant expanduser in WheelCache
Path normalization, which includes expanduser is now
done eagerly. Assert this when initializing
WheelCache.
2020-01-08 08:02:29 +01:00
Chris Hunt
896317d13d Remove unused abi functions
Previously, these were used when the user did not provide an explicit
ABI. Now this is handled internally in `packaging.tags` (by
`_cpython_abi` and `_generic_abi`).
2020-01-07 19:01:05 -05:00
Chris Hunt
7aaa705c15 Remove unused glibc functions
The remaining glibc-related functions are required to allow us to put
the libc version in the pip user agent (for stats).
2020-01-07 19:01:00 -05:00
Chris Hunt
2455977bc8 Remove unused manylinux auto-deduction functions 2020-01-07 19:00:55 -05:00
Chris Hunt
5dbef5debe Use packaging.tags.cpython_tags
We assume this function improves the status quo over the current
`_cpython_tags`, so we use it when no arguments need to be customized.

Since `packaging.tags` has its own tests and derives defaults
differently than pep425tags, we also remove the applicable tests that
were testing against the result of a plain call to
`pep425tags.get_supported()`.
2020-01-07 18:59:44 -05:00
Chris Hunt
4659a78935 Use packaging.tags.compatible_tags
We assume this function improves on our existing behavior, so use it
as-is. We will customize the arguments over the next few commits.

Since packaging.tags internally calculates platforms when not provided,
we skip the tests which patch functions assuming that manylinux
compatibility determination depends on them.
2020-01-07 18:55:26 -05:00
Pradyun Gedam
ea27521359
Custom optparse.Option type that calls expanduser (#7534) 2020-01-07 12:26:38 +00:00
Chris Hunt
58f175fdf2 Remove unused format_tag
Since we delegate tag formatting to packaging.tags.Tag, we don't need
this function or its tests.
2020-01-07 01:42:42 -05:00
Chris Hunt
80b2c82d0c Use packaging.tags.Tag in place of Tuple
This is the standard type used by packaging.tags. Making this change
throughout the code lets us start switching over to using its
tag-generating functions in get_supported().

We also get rid of a test, since it was superseded by `__str__` in
packaging.tags.Tag.
2020-01-07 01:42:42 -05:00
Chris Hunt
893faa9e44 Replace get_abbr_impl with interpreter_name
This reduces the amount of code we have to manage.

interpreter_name is calculated differently, defaulting to the
long name of the interpreter rather than "cp", but that is more
conformant.
2020-01-06 18:27:51 -05:00
Chris Hunt
4b5614c9e2 Replace get_impl_ver with interpreter_version 2020-01-06 18:27:27 -05:00
Stéphane Bidoul (ACSONE)
f04e6ab7b5
Split should_build test
Separately test should_build_for_wheel_command
and should_buid_for_install_command.
The tests are simpler and this open the door
for reasoning about both functions independently.
2020-01-05 23:52:42 +01:00
Stéphane Bidoul (ACSONE)
9729273ca8
Make should_build and should_cache "private" 2020-01-05 23:52:42 +01:00
Stéphane Bidoul (ACSONE)
870106b9bb
Simplify _collect_buildset
Since filtering of what to build has been
done beforehand, there is no need to filter
again here anymore.
2020-01-05 23:52:41 +01:00
Stéphane Bidoul (ACSONE)
8ca8e9bf61
Extend should_build scope wrt legacy requirements
We don't build legacy requirements
when wheel is not installed because
we'll fallback to a legacy install in such case.
2020-01-05 23:52:40 +01:00
Stéphane Bidoul (ACSONE)
4bdca1a09a
Remove now useless build_wheels function 2020-01-05 23:52:40 +01:00
Chris Hunt
ae34781826 Parameterize wheel file path for metadata extraction 2020-01-04 20:50:17 -05:00
Chris Hunt
20706eb93f Add DictMetadata for adapting zip data to Distribution
pkg_resources.Distribution classes delegate to the IMetadataProvider
implementation provided at construction. This is the one we'll use for
adapting a ZipFile to pkg_resources.DistInfoDistribution.
2020-01-04 20:49:41 -05:00
Chris Hunt
b263fcc105 Move parse_wheel and supporting functions to utils.wheel
In order to parse metadata from wheel files directly we want to reuse
parse_wheel. Moving it out helps avoid creating an unnecessary
dependence on operations.install.wheel.
2020-01-04 23:11:51 +01:00
Tzu-ping Chung
5ffc6bd468 Add tests for global path options 2020-01-02 18:58:42 +08:00
Chris Hunt
d5b4c15105 Remove dead code from wheel_metadata
Since we don't pass the source directory anymore, remove the tests
and implementation.
2020-01-01 17:51:24 -05:00
Chris Hunt
a2af0f9468 Get WHEEL metadata from wheel file directly 2020-01-01 17:26:20 -05:00
Chris Hunt
62721eb5da Remove dead code
Since we don't pass the source dir anymore, we can simplify the tests
and implementation for wheel_dist_info_dir.
2020-01-01 17:26:20 -05:00
Chris Hunt
cd5400ceb9 Determine .dist-info directory from wheel file directly
First example of transitioning a directory-aware function to using a
zipfile directly. Since we will not need to maintain the unpacked dir
going forward, we don't need to worry about making wheel_dist_info_dir
"generic", just that the same tests pass for both cases at each commit.

To do this neatly we use pytest.fixture(params=[...]), which
generates a test for each param. Once we've transitioned the
necessary functions we only need to replace the fixture name and remove
the dead code.
2020-01-01 17:26:20 -05:00
Chris Hunt
452acd5e76 Add files in .dist-info directory tests
Since zips don't typically contain directory entries, we want to
only operate on files. Adding files to the .dist-info tests means we
will be able to reuse them for both cases, while they coexist.
2020-01-01 17:26:20 -05:00
Christopher Hunt
b2f596ba2b
Merge pull request #7536 from chrahunt/refactor/extract-wheel-info-functions
Refactor wheel info extraction during install
2020-01-02 06:25:33 +08:00
Chris Hunt
010c24d64c Take .dist-info dir directly in wheel_metadata
Since retrieval of the .dist-info dir already ensures that a
distribution is found, this reduces responsibility on wheel_metadata and
lets us remove a few tests already covered by the tests for
test_wheel_dist_info_dir_*.
2020-01-01 12:25:01 -05:00
Chris Hunt
fc48a17206 Simplify positive wheel_version unit test 2020-01-01 12:25:01 -05:00
Chris Hunt
6c56557fbe Remove unused req_description from wheel_dist_info_dir 2020-01-01 12:25:01 -05:00
Chris Hunt
e1c7de8861 Raise UnsupportedWheel instead of AssertionError, and let caller add name 2020-01-01 12:25:01 -05:00
Chris Hunt
32115b55af Extract getting wheel .dist-info directory into a separate function 2020-01-01 12:10:22 -05:00
Christopher Hunt
ab7e4769db
Merge pull request #7520 from chrahunt/maint/cross-platform-lints
Run linters/docs on Windows and macOS
2020-01-01 23:48:56 +08:00
Chris Hunt
c9b0742508 Remove old root_is_purelib
The _invalidversion_ tests are not applicable to the new function since
we do not use a regex to find the applicable folder.
2019-12-31 12:49:08 -05:00
Chris Hunt
42c6dd78b9 Use WHEEL metadata to determine Root-Is-Purelib 2019-12-31 12:47:01 -05:00
Chris Hunt
ca729c89de Simplify wheel_version tests 2019-12-31 12:35:53 -05:00
Chris Hunt
d66bc398be Split wheel_metadata from wheel_version
This will let us re-use the wheel_metadata for other parts of
processing, and by parameterizing checks in terms of metadata we will be
able to substitute in metadata derived directly from the zip.
2019-12-31 12:35:52 -05:00
Christopher Hunt
69143848b0
Make WHEEL file errors more explicit (#7529)
* Raise exception on exception in finding wheel dist

We plan to replace this code with direct extraction from a zip, so no
point catching anything more precise.

* Raise exception if no dist is found in wheel_version
* Catch file read errors when reading WHEEL

get_metadata delegates to the underlying implementation which tries
to locate and read the file, throwing an IOError (Python 2) or OSError
subclass on any errors.

Since the new explicit test checks the same case as brokenwheel in
test_wheel_version we remove the redundant test.

* Check for WHEEL decoding errors explicitly

This was the last error that could be thrown by get_metadata, so we can
also remove the catch-all except block.

* Move WHEEL parsing outside try...except

This API does not raise an exception, but returns any errors on the
message object itself. We are preserving the original behavior, and can
decide later whether to start warning or raising our own exception.

* Raise explicit error if Wheel-Version is missing

`email.message.Message.__getitem__` returns None on missing values, so
we have to check for ourselves explicitly.

* Raise explicit exception on failure to parse Wheel-Version

This is also the last exception that can be raised, so we remove
`except Exception`.

* Remove dead code

Since wheel_version never returns None, this exception will never be
raised.
2019-12-31 23:17:41 +08:00
Stéphane Bidoul (ACSONE)
261c286de9
Make wheel_cache an argument of build() 2019-12-29 18:51:45 +01:00
Stéphane Bidoul (ACSONE)
3828699ddc
Move build options from WheelBuilder to build function 2019-12-29 18:49:54 +01:00
Christopher Hunt
711cf4deaf
Merge pull request #7517 from sbidoul/wheel-builder-disentangle-6-sbi
Move final wheel builder copy operation to wheel command
2019-12-29 13:46:02 +08:00
Chris Hunt
8dc6919875 Fix mypy checks on Windows
Previously we were making unguarded calls to non-Windows-only APIs. Mypy
only automatically excludes these from platform-specific checks when
inside conditions.
2019-12-29 00:33:28 -05:00
Stéphane Bidoul (ACSONE)
cf21401fd7
Make wheelbuilder.build return successes too
Also, pluralize variable names for readability and consistency with
similar variables in callers.
2019-12-26 21:43:57 +01:00
Pradyun Gedam
37f3fd7087
Move legacy wheel build process 2019-12-25 17:52:39 +05:30
Christopher Hunt
0292938f89
Merge pull request #7501 from uranusjr/appdirs-patch 2019-12-24 23:30:55 +08:00
Tzu-ping Chung
c98c0ad79c Default to /etc/xdg if XDG_CONFIG_DIRS if empty 2019-12-23 14:33:17 +08:00
Christopher Hunt
3f4bb75fa4
Merge pull request #7499 from chrahunt/feature/add-old-entrypoints
Add old pip entrypoints
2019-12-23 05:40:10 +08:00
Pradyun Gedam
c06874c471
Merge pull request #7490 from sbidoul/legacy-cache-bug-sbi
Fix cache bug with legacy cache entries
2019-12-21 07:27:46 +00:00
Tzu-ping Chung
2ccc5c055d Match site_config_dirs for empty XDG_CONFIG_DIRS 2019-12-20 14:36:30 +08:00
Tzu-ping Chung
204887da03 Apply changes from bundled appdirs to vendored
* Convert Windows app data directory values to bytes on Python 2, so the
  output type is consistent across platforms (pypa/pip#4000)
* Also look in ~/.config for user config on macOS (pypa/pip#4100)
* Remove pywin32 dependency, only use ctypes and winreg for directory
  lookup on Windows (pypa/pip#2467)
* Always use os.path.join() instead of os.sep.join() so cross-platform
  tests work as expected (pypa/pip#3275)
2019-12-19 17:15:03 +08:00
Chris Hunt
82a2651f93 Move pip._internal.main to cli submodule
Moving this out of the way gives us the flexibility to define wrappers
that will redirect requests to our old entrypoints to our new one.
2019-12-18 21:09:22 -05:00
Christopher Hunt
ab12706aaa
Merge pull request #7478 from chrahunt/refactor/make-functional-download-tests
Make unpack_* unit tests into functional tests
2019-12-17 07:55:29 +08:00