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

202 commits

Author SHA1 Message Date
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
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
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
Pradyun Gedam
37f3fd7087
Move legacy wheel build process 2019-12-25 17:52:39 +05:30
Chris Hunt
c565d7a1b2 Switch to install_wheel in unit tests
Since it tests install_unpacked_wheel, the coverage should be the same.
2019-12-14 11:38:31 -05:00
Christopher Hunt
d7eaede434
Revert "Add new option: pip wheel --save-wheel-names (#6377)" (#7420)
This reverts commit bcad1b1cb5, reversing
changes made to f86490317a.

As discussed, we should rethink the interface of this command output as
part of larger CLI usability review. In the interim, the same
functionality can be achieved using straightforward shell commands.
2019-12-13 07:57:05 +08:00
Christopher Hunt
830e29e189
Move wheel to operations.install.wheel (#7421)
* Update documentation

For now just fixing the paths and adding a sub-package docstring.
2019-12-04 06:02:39 +08:00
Chris Hunt
b8c16a0dc8 Move Wheel tests 2019-12-02 11:52:51 +08:00
Chris Hunt
60f6ed9387 Move wheel.Wheel to models.wheel.Wheel
This aligns more closely with how the class is used and makes it easier
to move the rest of the wheel module to a dedicated module for
installation.
2019-12-02 11:52:51 +08:00
Chris Hunt
bf26185d55 Import Wheel in tests directly 2019-12-02 11:52:51 +08:00
Chris Hunt
1abf978e88 Move format_tag to pep425tags
This is a more appropriate place for the function, since it is more
related to tags than wheels, and will make it easier to refactor Wheel
into its own module.
2019-12-02 11:52:51 +08:00
mdebi
f6aaba9fd9 Warn if a path in PATH starts with tilde during install 2019-11-16 00:16:41 +01:00
Chris Hunt
7d27bff299 Make versions argument singular for pep425tags.get_supported()
This simplifies the interface of this function in preparation for
switching to packaging.tags.
2019-11-12 20:58:44 -05:00
Christopher Hunt
8ce34af430
Merge pull request #7323 from chrahunt/refactor/less-intrusive-pep425tags
Be less intrusive towards pep425tags in tests
2019-11-11 15:37:10 +08:00
Chris Hunt
94dbbe2556 Remove patching of pep425tags internals in wheel tests 2019-11-09 13:09:18 -05:00
Chris Hunt
7f910251a4 Remove unused sys.platform patching from test_wheel 2019-11-09 13:09:06 -05:00
Chris Hunt
8963f63989 Parameterize requirement name for logging 2019-11-08 21:54:03 -05:00
Chris Hunt
e03a71aff8 Use new Scheme model for wheel installation 2019-11-07 12:43:39 -05:00
Pradyun Gedam
9435050c2d
Move tests for WheelBuilder and friends 2019-11-04 11:51:44 +05:30
Pradyun Gedam
647d30ec77
Move hash_file to utils.misc
Why: Allows for better code reuse, without introducing dependency
between wheel->wheel_builder.
2019-11-04 11:51:08 +05:30
Pradyun Gedam
da9a432576
Move WheelBuilder and friends to a dedicated module 2019-11-04 11:49:02 +05:30
Stéphane Bidoul (ACSONE)
f5eba4f726
Add tests for git sha wheel caching 2019-11-03 22:54:33 +01:00
Stéphane Bidoul (ACSONE)
cdf09bfc4a
remove should_use_ephemeral_cache 2019-10-29 09:15:44 +01:00
Stéphane Bidoul (ACSONE)
aaa4237adf
refactor should_use_ephemeral_cache 2019-10-28 22:56:04 +01:00
Pradyun Gedam
8dbf8461fc
Clean up wheel.move_wheel_files (#7176) 2019-10-20 13:26:48 +05:30
Chris Hunt
913f856739 Cleanup arguments, add docstring 2019-10-11 22:24:50 -04:00
Chris Hunt
39572ddd12 Don't pass InstallRequirement to install_unpacked_wheel
We are only using this value for logging. Passing a string reduces
coupling between InstallRequirement and this function.
2019-10-11 21:58:58 -04:00
Chris Hunt
4682f3cb9b Pass scheme to install_unpacked_wheel
This reduces the number of required arguments and helps establish a
convention for install_* functions, which should take a scheme instead
of the individual components.
2019-10-11 21:49:39 -04:00
Chris Hunt
578de7d863 Rename wheel install function 2019-10-11 21:41:47 -04:00
Patrik Kopkan
9a2181a087 Add new option: pip wheel --save-wheel-names 2019-09-25 13:39:34 +02:00
Pradyun Gedam
ab6d550592
Remove link.is_artifact 2019-09-21 14:30:14 +05:30
Chris Hunt
2aeed371e5 Make content_type optional in unpack_file. 2019-09-19 20:02:47 -04:00
Chris Hunt
89bbe73498 Remove unused argument in unpacking.unpack_file 2019-09-19 01:47:24 -04:00
Chris Hunt
6a5bd723ec Move unpack_* from utils.misc to utils.unpacking. 2019-09-17 23:40:02 -04:00
Chris Hunt
0689cf5db7 Remove function-level imports in test. 2019-09-17 23:37:38 -04:00
Chris Jerdonek
fe2509bd58 Move LinkCollector to a new collector.py module. 2019-09-14 02:54:07 -07:00
Pradyun Gedam
e0239735a3
Refactor wheel.move_wheel_files to use updated distlib (#6763) 2019-09-09 00:18:15 +05:30
Chris Hunt
f92961d99e More descriptive function name. 2019-09-07 10:50:14 -04:00
Chris Hunt
b63ea9cd08 Remove now-unused finder and format_control from WheelBuilder. 2019-09-04 21:10:34 -04:00
Chris Hunt
a4102d179a Don't check allowed format in wheel.py, pass function to do check. 2019-09-04 21:06:52 -04:00
Chris Hunt
b0a7d2b503 Refactor wheel.move_wheel_files to use updated distlib. 2019-09-01 22:36:13 -04:00
Stéphane Bidoul (ACSONE)
2e1dfbef76 consolidate vcs link detection 2019-08-16 08:14:33 +02:00
Stéphane Bidoul (ACSONE)
ea517a2bb9 clarify WheelBuilder.build() a bit 2019-08-14 11:24:26 +02:00
Chris Jerdonek
022a36662f Remove WheelBuilder's dependence on PipSession. 2019-08-11 11:33:23 -07:00
Chris Jerdonek
bb9cb5e19d Change the return type of Wheel.support_index_min() to int. 2019-08-08 22:58:17 -07:00
Chris Hunt
39ac9ca351 Rename compatible functions in tests.lib.path.Path. 2019-07-02 18:48:44 -04:00
Ian Wienand
0dbab23df9 Add SHA256 hash of .whl as info output (#5908)
* Add SHA256 hash of .whl as info output

Currently I'm trying to debug some issues with what appear to be
corrupt wheels.  It would be very useful to see what pip thought the
state of things was as it wrote the wheel output; if a final corrupt
distributed file is then different to what pip has saved in its build
logs, you know the problem is somewhere after pip but before
distribution.

Currently we get a log of the initial creation, then the stamp when it
gets moved in the final output location, e.g.:

 creating '/tmp/pip-wheel-71CpBe/foo-1.2.3-py2.py3-none-any.whl
 ...
 Stored in directory: /opt/wheel/workspace

A lot happens in between this, so my suggestion is we add the final
output file and it's hash before the "Stored in directory:", e.g. you
now see:

 Building wheels for collected packages: simple
   Running setup.py bdist_wheel for simple: started
   Running setup.py bdist_wheel for simple: finished with status 'done'
   Finished: simple-3.0-py3-none-any.whl sha256=39005a57a6327972575072af82e11d0817439fe6a069381f6f2a123a8c0bf1cf
   Stored in directory: /tmp/pytest-of-iwienand/pytest-18/test_pip_wheel_success0/workspace/scratch
 Successfully built simple

Despite the hash being fairly important for things like
--require-hashes, AFAICS the final hash is not put in the logs at all
currently, so I think this is generically helpful.

* Reword wheel hash details output

This rewords the output to be more like the form of the preceding
messages.  Additionally the size is added, since we have calculated it
anyway.  The output will now look like:

 Collecting simple==3.0
 Building wheels for collected packages: simple
   Building wheel for simple (setup.py): started
   Building wheel for simple (setup.py): finished with status 'done'
   Created wheel for simple: filename=simple-3.0-py3-none-any.whl size=1138 sha256=2a980a802c9d38a24d29aded2dc2df2b080e58370902e5fdf950090ff67aec10
   Stored in directory: /tmp/pytest-of-iwienand/pytest-0/test_pip_wheel_success0/workspace/scratch
 Successfully built simple
2019-06-26 02:44:43 -07:00
Chris Jerdonek
a9a9cfd98c Improve the debug log message when installing an incompatible wheel. 2019-05-25 23:59:32 -07:00
Chris Jerdonek
32c11ee2c3 Respect --global-option and --install-option for VCS installs. 2019-04-08 02:03:17 -07:00
Chris Jerdonek
87f0539b78 Change format_command_result() to use format_command_args(). 2019-02-22 02:52:06 -08:00
Chris Jerdonek
1d0645e86f Add format_command_args() with tests. 2019-02-22 02:52:02 -08:00
Chris Jerdonek
aec72bd0cd Add log divider variable. 2019-02-22 00:14:58 -08:00
Chris Jerdonek
ebe2417110 Fix the RECORD filename of installed files appearing in the old RECORD. 2019-02-15 02:33:02 -08:00
Chris Jerdonek
d3a1b8536a Improve logging in the case of a failed legacy build. 2019-02-14 13:57:07 -08:00
Chris Jerdonek
6cdecce71d Fix an IndexError crash when a legacy build of a wheel fails. 2019-02-10 13:10:39 -08:00
Chris Jerdonek
2d9d3ff90b Add more unit test cases. 2019-02-01 17:41:46 -08:00
Chris Jerdonek
6b0892eace Use the ephemeral cache if autobuilding and no cache directory is available. 2019-02-01 02:25:56 -08:00
Chris Jerdonek
806a013bc0 Add failing test for the have_directory_for_build AssertionError. 2019-02-01 02:23:58 -08:00
Chris Jerdonek
7f25059bf7 Allow and warn on RECORD lines with more than three elements. 2019-01-23 19:24:38 -08:00
Chris Jerdonek
8074db86d6 Add failing test. 2019-01-23 19:24:34 -08:00
Paul Moore
4ca38e0c38 Merge with master 2018-11-11 13:49:35 +00:00
Chris Jerdonek
5c93250fa9
Merge pull request #5875 from uranusjr/egg-info-canonical
Rewrite egg_info_matches with canonicalize_name
2018-10-30 01:30:40 -07:00
Paul Moore
3c94d81f68 Support --python-tag for PEP 517 builds 2018-10-29 23:33:21 +01:00
Chris Jerdonek
951e0cba51
Fix #5868: TypeError in move_wheel_files(). (#5883) 2018-10-24 09:19:58 -07:00
Tzu-ping Chung
3368819156 Split, simplify, and fix egg_info_matches 2018-10-22 16:46:42 +08:00
Pradyun Gedam
4fc697847a
Update imports for the moved compat module 2018-07-29 18:32:20 +05:30
Pradyun Gedam
8df8e53901
Merge branch 'master' into refactor/introduce-models 2018-07-24 01:35:56 +05:30
Oliver Jeeves
ca5cca3426
Fix error trying to generate scripts warning when PATH not set
fixes #5558
2018-07-07 02:59:55 +05:30
Pradyun Gedam
89223dd47c
Sort imports 2018-06-24 02:41:57 +05:30
Pradyun Gedam
c02af381f2
Caplog! 2018-06-24 02:38:21 +05:30
Andrés Delfino
7b1f2a06d2 Add test for PR #5293 (#5325)
* Test that trailing os.sep are ignored while searching PATH
* Simplify paths list creation
2018-04-23 21:21:43 +05:30
Pradyun Gedam
54bf509636
Add test for normalization
As suggested by @pfmoore
2018-04-07 17:25:41 +05:30
Anthony Sottile
e21e2d3f8f Upgrade syntax in ./tests
Changes were automated via https://github.com/asottile/pyupgrade

See #4921
2017-12-14 21:59:41 -08:00
Pradyun Gedam
24fd884672
Decouple WheelBuilder from RequirementSet (#4860) 2017-11-16 15:16:21 +05:30
Pradyun Gedam
fc7ca26489 Warn user when installing scripts outside PATH (#4553) 2017-10-02 17:54:37 +01:00
Donald Stufft
95bcf8c5f6 Move all internal APIs to pip._internal 2017-08-31 14:53:00 -04:00
Benoit Pierre
c58a4ccf1d tests: fix mistakenly skipped test (#4665) 2017-08-31 13:17:56 -04:00
Pradyun S. Gedam
6f29b5d552 Move wheel_cache out of RequirementSet (#4600)
It now goes into both Resolver and WheelBuilder, where it belongs.
2017-07-05 19:57:35 -04:00
Pradyun S. Gedam
581c12b5bc Move some RequirementSet attributes to RequirementPreparer (#4583)
* Move some attributes to RequirementPreparer

* 🎨

Remove unused import
2017-07-05 14:41:45 -04:00
Pradyun S. Gedam
69ef4d9224 From RequirementSet to Resolver - Part 1 (#4546) 2017-06-27 12:37:38 -04:00
Pradyun S. Gedam
29df9244f2 🔧 2017-06-16 12:10:42 +05:30
Pradyun S. Gedam
fe5b7c9c9a Begin moving WheelCache to pip.cache 2017-06-15 18:34:05 +05:30
Pradyun S. Gedam
9923c1ad7e Sort imports and minor Flake8 changes (#4520)
* Run isort on the codebase

Command: isort --recursive --skip __main__.py --skip _vendor -o pip._vendor -sd THIRDPARTY -m 5 -p pip -p tests ./pip ./tests

* 📰
2017-06-13 14:17:00 +02:00
Pradyun S. Gedam
1832569530 Sort all imports 2017-05-16 15:47:47 +05:30
Vincent Philippon
8378567b61 Install wheel with a non-PEP 440 version in the filename.
PEP 427 has no specific requirements for the format of the version.
As pip wheel allows to create a wheel with a non-PEP 440 version,
it should also be able to install that same wheel.
2017-03-27 23:12:42 -04:00
Alex Gaynor
3e527f2fbf Fixed some pytest warnings in the tests 2017-03-20 11:45:29 -04:00
Xavier Fernandez
b559221ee1 Move uninstall file selection logic to req_uninstall.py 2016-11-20 13:04:14 +01:00
Francesco Montesano
d64b871d97 Allow pip install with entrypoint names with colons (#3901) 2016-11-19 00:27:16 +01:00
Lipis
d86d171364 OS X -> macOS (#4074) 2016-11-06 12:24:43 -05:00
Stéphane Bidoul (ACSONE)
4d1b798465 Allow creating wheels for editable packages (#3695) 2016-05-26 06:41:01 -04:00
Ville Skyttä
46582e5ab6 Use logger.warning instead of deprecated logger.warn 2016-04-15 16:30:28 +03:00
Donald Stufft
8e236dd6a0 Update to use the Requirement class from packaging 2016-03-07 11:40:39 +11:00