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

2112 commits

Author SHA1 Message Date
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
Stéphane Bidoul (ACSONE)
4d79037527
Eagerly normalize the cache directory
Fixes #7541
2020-01-08 08:01:09 +01:00
Christopher Hunt
5529bacc1f
Merge pull request #7569 from uranusjr/req-uninstall-logger
Use logger to log instead of logging
2020-01-08 11:05:40 +08:00
Christopher Hunt
eeeecbe856
Merge pull request #7543 from sbidoul/deprecate-gitgitarobase-sbi
Deprecate git+git@ form of VCS requirements
2020-01-08 11:04:12 +08:00
Chris Hunt
ae21af701d Remove unused version functions 2020-01-07 19:01:14 -05:00
Chris Hunt
2b1b60f6db Remove unused get_platform function
Now handled internally in `packaging.tags` (in `_platform_tags`).
2020-01-07 19:01:09 -05: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
9b3443583e Simplify _get_custom_platforms
Since we only call this function when platform is not None, we can drop
one of the branches. This is the only place using our manylinux
auto-deduction functions, so those can be removed next.
2020-01-07 19:00:51 -05:00
Chris Hunt
ad546b5e8d Remove unnecessary conversion in get_supported
Now that we're fully using packaging.tags, everything in the supported
list is already Tag.

Further, since each function is responsible for its own set of
non-overlapping tags, we can also remove the de-duplication.
2020-01-07 19:00:46 -05:00
Chris Hunt
3e66ab0918 Inline packaging.tags.generic_tags 2020-01-07 19:00:41 -05:00
Chris Hunt
72dcd34eb2 Make packaging.tags.generic_tags unconditional 2020-01-07 19:00:37 -05:00
Chris Hunt
293b778374 Customize platforms for packaging.tags.generic_tags 2020-01-07 19:00:32 -05:00
Chris Hunt
0bebeb66e6 Customize abis for packaging.tags.generic_tags 2020-01-07 19:00:28 -05:00
Chris Hunt
77dbd27703 Customize interpreter for packaging.tags.generic_tags 2020-01-07 19:00:23 -05:00
Chris Hunt
281273dac3 Use packaging.tags.generic_tags
As with cpython_tags and compatible_tags, we assume this function covers
our use cases in the no-argument case and will customize our arguments
for it in a few steps.
2020-01-07 19:00:18 -05:00
Chris Hunt
fa1ec40ce0 Remove unused abi3 branch in _generic_tags
Since this function is only called for non-CPython interpreters, the
abi3-related branches are not relevant.
2020-01-07 19:00:14 -05:00
Chris Hunt
1574872162 Inline packaging.tags.cpython_tags 2020-01-07 19:00:09 -05:00
Chris Hunt
56840c30c5 Make packaging.tags.cpython_tags unconditional 2020-01-07 19:00:04 -05:00
Chris Hunt
fecfadb810 Customize platforms for packaging.tags.cpython_tags 2020-01-07 19:00:00 -05:00
Chris Hunt
05045e7903 Customize abis for packaging.tags.cpython_tags 2020-01-07 18:59:55 -05:00
Chris Hunt
147680a613 Customize python_version for packaging.tags.cpython_tags 2020-01-07 18:59:50 -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
e388df6c59 Remove impl from _cpython_tags
We only call this function when the user or platform-provided
implementation is "cp", so we can inline the literal in place of the
parameter. This will make refactoring easier.
2020-01-07 18:57:55 -05:00
Chris Hunt
8f1c60ead0 Only use _cpython_tags for CPython
Since the behavior for both of these functions is the same, there is no
behavior change here. This will let us simplify `_cpython_tags` a bit.
2020-01-07 18:57:50 -05:00
Chris Hunt
b91286c38d Inline packaging.tags.compatible_tags 2020-01-07 18:57:45 -05:00
Chris Hunt
c514c6b35f Make packaging.tags.compatible_tags unconditional 2020-01-07 18:57:41 -05:00
Chris Hunt
2de0b7c560 Customize platforms for packaging.tags.compatible_tags 2020-01-07 18:57:36 -05:00
Chris Hunt
72d00ddcc1 Customize interpreter for packaging.tags.compatible_tags 2020-01-07 18:57:31 -05:00
Chris Hunt
750abcab04 Customize python_version for packaging.tags.compatible_tags 2020-01-07 18:57:26 -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
Chris Hunt
480911bc8e Remove unused abi arg from _compatible_tags 2020-01-07 17:00:40 -05:00
Chris Hunt
1c8c481214 Only calculate py-compatible tags in one place
Since `_compatible_tags` is the function that will be responsible for
generating the non-interpreter-specific tags, we remove the
corresponding sections from `_cpython_tags` and `_generic_tags`. The
resulting tags in `get_supported` are equivalent because these were
the last tags to be computed in those functions, and `_compatible_tags`
is executed after them (so any non-duplicate tags it produces will be
last).

To reinforce the reponsibility of `_compatible_tags` we also remove the
abi-related tag generation, which is already handled in `_cpython_tags`
and `_generic_tags`.
2020-01-07 17:00:40 -05:00
Chris Hunt
54db17c976 Use _cpython_tags, _generic_tags, and _compatible_tags
Since these functions are copies of the existing code, there is no
behavior change except each tag will now be present 3 times. To
accommodate this we remove all but the first duplicate tag from the
set of all tags.

We put `_compatible_tags` last because it will provide the lowest
priority tags. The order of `_cpython_tags` and `_generic_tags`
here is not significant - when we start customizing them we will
introduce a condition so that they are mutually exclusive.
2020-01-07 17:00:40 -05:00
Chris Hunt
d386bb2fff Copy get_supported into packaging.tags-like functions
packaging.tags provides a simple `sys_tags` function for getting
applicable tags for the running interpreter, but it does not allow
customization of arguments.

packaging.tags provides three functions for getting custom tags:

1. `cpython_tags` - for CPython only
2. `generic_tags` - for any non-CPython Python implementation
3. `compatible_tags` - tags that are not specific to an interpreter
   implementation

Since pip allows users to provide explicit impl, platform, abi, and
version, we have to use these functions.

`cpython_tags` and `generic_tags` are mutually exclusive, and return tags
that are the highest priority. These capture the most specific tags.

`compatible_tags` are always applicable, and a lower priority since they
may just be compatible with e.g. the Python language version, but lack
any optimizations available in the interpreter-specific tags.

To be able to do a meaningful comparison between our current
implementation and the above functions, we need to segment the pip code
into pieces that look like them.

To that end, we now have copies of the current `get_supported` function,
one for each of the functions provided by packaging.tags, and will walk
through converting them to rely on packaging.tags. For each
simplification step, if desired, we can compare the implementation in
the packaging.tags function with what we're replacing in pip.

Specifically, for each function in turn, we will:

1. Refactor it locally, taking into account its new, more limited,
   responsibilities
2. Introduce the packaging.tags function for the case where there are no
   custom arguments provided
3. Customize arguments one-by-one and delegate to the packaging.tags
   function
4. When there is no pip-specific logic left, remove the intermediate
   function and use the packaging.tags function directly in
   `get_supported`

In the end all these functions will be gone again and we'll be left with
an implementation that relies solely on the tag generation in
packaging.tags.
2020-01-07 17:00:40 -05:00
Chris Hunt
3ada01fb51 Convert return values in pep425tags.get_supported
Now we can incrementally use utility functions from pep425tags without
switching everything at once or converting in multiple places.
2020-01-07 17:00:40 -05:00
Tzu-ping Chung
1ea7a05df6 One more found by grepping 2020-01-07 20:49:55 +05:30
Tzu-ping Chung
555d05ce0d Use logger to log instead of logging 2020-01-07 20:40:36 +05:30
Xavier Fernandez
9c64c82186
Merge pull request #7561 from chrahunt/maint/use-packaging-tags-mac-versions
Switch to packaging.tags.mac_version for macOS wheel tag backfilling
2020-01-07 14:39:01 +01:00
Pradyun Gedam
52309f98d1
Merge pull request #7532 from uranusjr/pip-upgrade-prompt-message
Use sys.executable to format upgrade message
2020-01-07 12:34:54 +00:00
Pradyun Gedam
ea27521359
Custom optparse.Option type that calls expanduser (#7534) 2020-01-07 12:26:38 +00:00
Pradyun Gedam
6c515125c2
Merge pradyunsg:revert/6864 into master (#7557)
Revert addition of un-suffixed pip CLI entry points for invocation check on Windows
2020-01-07 08:16:38 +00:00
Chris Hunt
bc20a983da Use packaging.tags.mac_platforms
This function takes care of the version iteration AND architecture
determination internally.
2020-01-07 02:16:57 -05:00
Chris Hunt
687a00b3e1 Sort pep425tags typing imports
Makes the next change easier to review.
2020-01-07 02:16:28 -05: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
Christopher Hunt
f526f13a76
Merge pull request #7562 from chrahunt/maint/use-packaging-tags-interpreter-functions
Use interpreter_name and interpreter_version from packaging.tags
2020-01-07 14:39:54 +08:00
Tzu-ping Chung
32ecd727d5 Rename custom option class for future expansion 2020-01-07 10:50:53 +05:30
Chris Hunt
838d64d865 Extract platform list into separate function
Simplifies get_supported without changing any behavior.
2020-01-06 22:28:55 -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
Chris Hunt
c750c1d82a Update packaging to 20.0 2020-01-06 14:04:07 -05:00
Chris Hunt
8460394c47 Update packaging version and include py.typed
Since the new packaging has types, it includes a py.typed. No harm in
including this in our package, and it may facilitate debug tool usage on
an installed pip by signaling that pip._vendor.packaging is
type-annotated.
2020-01-06 14:03:34 -05:00
Pradyun Gedam
d9d801f818
Drop no-suffix checks for pip-from-PATH 2020-01-06 19:29:56 +05:30
Stéphane Bidoul (ACSONE)
5aa3b3d2f0
Remove unused build() argument 2020-01-05 23:52:42 +01:00
Stéphane Bidoul (ACSONE)
66e010980a
Remove WheelBuilder
build is now a function
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)
c0aca12123
Clarify should_cache a bit 2020-01-05 23:52:42 +01:00
Stéphane Bidoul (ACSONE)
25521f29b5
should_build always returns a boolean 2020-01-05 23:52:41 +01:00
Stéphane Bidoul (ACSONE)
6e7d0e5a05
_collect_buildset becomes _get_cache_dir
The only purpose of _collect_buildset is now
to compute the cache directory to use
for a given requirements. This is better
computed one by one in the build loop.
2020-01-05 23:52:41 +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)
212ee12474
Filter requirements to build beforehand in install command
One more step so build() becomes only concerned with building.
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)
3ae13f7d28
Move is_wheel_installed to utils 2020-01-05 23:52:40 +01:00
Stéphane Bidoul (ACSONE)
e45005f4bb
Filter requirements to build beforehand in wheel command
One more step so build() becomes only concerned with building.
2020-01-05 23:52:40 +01:00
Stéphane Bidoul (ACSONE)
3de4765ec7
Add should_build function for wheel and install commands 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
Stéphane Bidoul (ACSONE)
10ff58d7be
Simplify install by calling build once
We filter what to build beforehand so we
can call build once. We then filter failures
to detect PEP 517 failures.
2020-01-05 23:52:38 +01:00
Stéphane Bidoul (ACSONE)
8601bb5d06
Make build_wheels return all failures
Check for PEP 517 build failures by
filtering failures.
2020-01-05 23:52:03 +01:00
Stéphane Bidoul (ACSONE)
8784fb419a
Make build_wheels return successes too
In preparation for moving the unpacking
out of WheelBuilder.build
2020-01-05 18:47:52 +01:00
Chris Hunt
a94fb53dad Don't unpack wheel files after building for install
Actual installation has been using the wheel file directly for some
time. The last piece that required an unpacked wheel was metadata. Now
that it uses the wheel file directly, we can remove the unpacking after
build.
2020-01-05 10:57:15 -05:00
Chris Hunt
33043ba22f Use pkg_resources.Distribution derived from wheel directly
We now extract all metadata files from the wheel directly into memory
and make them available to the wrapping pkg_resources.Distribution via
the DictMetadata introduced earlier.
2020-01-05 10:57:14 -05:00
Chris Hunt
ed65393840 Extract reading wheel file from wheel_metadata into separate function 2020-01-04 20:50:17 -05: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
Stéphane Bidoul (ACSONE)
9cbe7f90d6
Reference the git+git@ removal issue
in the deprecation message
2020-01-04 12:50:38 +01:00
Stéphane Bidoul (ACSONE)
8415011774
Clarify git+git@ replacements 2020-01-04 12:50:06 +01:00
Stéphane Bidoul (ACSONE)
cf071dee55
Deprecate git+git@ form of VCS url 2020-01-02 19:20:29 +01:00
Tzu-ping Chung
9c04298d5b Revert expanduser on options that accept URL 2020-01-02 20:46:14 +08:00
Pradyun Gedam
08f61a9b73
Do not attempt setup.py clean for failed pep517 builds (#7477) 2020-01-02 12:11:32 +00:00
Stéphane Bidoul (ACSONE)
8d1d20de8c
Do not attempt setup.py clean for failed pep517 builds
Fixes #6642
2020-01-02 12:14:03 +01:00
Tzu-ping Chung
2e24041ca5 Custom optparse.Option type that calls expanduser 2020-01-02 15:30:54 +08:00
Chris Hunt
2f92826081 Extract basic wheel parsing into separate function
This functions as a guard for the rest of our wheel-handling code,
ensuring that we will only get past this point if we have a wheel that
we should be able to handle version-wise.

We return a tuple instead of bundling up the result in a dedicated type
because it's the simplest option. The interface will be easy to update
later if the need arises.
2020-01-01 17:51:25 -05: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
2519e9740c Split try block in wheel_metadata
Makes it simpler to substitute in zip-derived WHEEL extraction.
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
513a3162de Pass open zip file for wheel into install_unpacked_wheel
With this parameter we can incrementally update code to rely on the zip
file instead of the unpacked source directory.
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
Stéphane Bidoul (ACSONE)
68e49b9613 Remove redundant expanduser for download_dir in preparer
Since
- download_dir is only set by the download command
- download_dir is
normalized at the beginning of the download command
- path normalization includes expanduser
Therefore expanduser in the preparer is redundant
2020-01-01 18:54:08 +01: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
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
a539c8dfe0 Normalize exception message for dist_info_dir check 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
c51f020b98 Read WHEEL from .dist-info instead of using has_metadata
This will make it easier to transition to the already-determined
dist-info directory and reduces some of our dependence on pkg_resources.

Despite the name, the `egg_info` member is also populated for
.dist-info dirs.

ensure_str uses encoding='utf-8' and errors='strict' for Python 3
by default, which matches the behavior in
`pkg_resources.NullProvider.get_metadata`.
2020-01-01 12:10:20 -05:00
Tzu-ping Chung
6c2ffcd0ce
Update src/pip/_internal/self_outdated_check.py
Co-Authored-By: Christopher Hunt <chrahunt@gmail.com>
2020-01-02 00:00:59 +08: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
Xavier Fernandez
6896dfcd83
Merge pull request #7524 from sbidoul/wheel-download-dir-sbi
Ensure wheel download dir is present at the beginning of wheel command
2020-01-01 16:13:38 +01:00
Tzu-ping Chung
ed40706534 Use sys.executable to format upgrade message 2020-01-01 22:12:12 +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
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
Chris Hunt
918b154518 Move info_dir calculation up
This will let us use the value for later processing.
2019-12-31 12:12:17 -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)
a6d212383b
Remove redundant path normalization in preparer
wheel_download_dir is normalized at the
beginning of the wheel command
2019-12-31 05:32:42 +01:00
Christopher Hunt
ea7bbff713
Merge pull request #7496 from pradyunsg/refactor/move-legacy-install-process
Move logic for legacy installs to dedicated module
2019-12-31 12:00:23 +08:00
Christopher Hunt
e8ded43035
Merge pull request #7523 from sbidoul/wheel-builder-disentangle-7-sbi
Further reduce responsibility of WheelBuilder
2019-12-31 08:32:29 +08:00
Christopher Hunt
8c888a2287
Simplify getting info directories for wheel installation (#7526)
* Edit subdirs of top-level instead of checking in each directory

Previously, we were checking whether the top of the relative path ended
with .data. Now, we do not recurse into those directories, so there's no
need to check every time.

* Store info_dir in separate variable

Instead of working with a list everywhere, we use the single info_dir.

* Separate variables for info_dir and the destination path
* Use destination .dist-info dir only when needed

By initially storing just the name of the folder we ensure our code is
agnostic to the destination, so it'll be easier to install from a zip
later.

* Use os.listdir instead of os.walk for wheel dir population

Since we only execute any code when basedir == '', we only need the
top-level directories.

* Inline data_dirs calculation
* Inline info_dirs calculation
2019-12-30 23:59:23 +08:00
Stéphane Bidoul (ACSONE)
f55819787d
Normalize wheel dir at the beginning of wheel command
Similar to what is done in the download command.
2019-12-30 09:53:08 +01:00
Stéphane Bidoul (ACSONE)
9da9f6050b
In Resolver, assume wheel_download_dir exists
This is ensured at the beginning of the wheel
command, which is the only command that
sets wheel_download_dir.

This is also similar to what is done for download_dir
in the download command.
2019-12-30 09:53:08 +01:00
Stéphane Bidoul (ACSONE)
d8374b86f9
wheel: ensure wheel dir is present earlier
Similar to what is done for download_dir
in the download command
2019-12-30 09:53:08 +01: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)
c8d4277535
Convert _build_one from method to function
It does not rely on WheelBuilder anymore.
2019-12-29 18:51:44 +01:00
Stéphane Bidoul (ACSONE)
3828699ddc
Move build options from WheelBuilder to build function 2019-12-29 18:49:54 +01:00
Pradyun Gedam
b24a6d09fc
Merge pull request #7522 from pradyunsg/refactor/move-pep517-wheel-build-process
Move PEP-517 wheel build logic into operations.build
2019-12-29 17:44:01 +00:00
Christopher Hunt
dc860e865e
Merge pull request #7519 from chrahunt/bugfix/restrict-two-dist-info-dirs-toplevel-only
Only check for .dist-info directories at the top-level
2019-12-29 20:16:25 +08:00
Christopher Hunt
b3741acb8e
Merge pull request #7510 from chrahunt/refactor/operations-prepare-move-download-up
Move download copying out of unpacking functions
2019-12-29 20:15:19 +08:00
Pradyun Gedam
ccfef67016
Move PEP-517 wheel build logic into operations.build 2019-12-29 16:57:02 +05:30
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
Chris Hunt
93900e1199 Only check for .dist-info directories at the top-level
Previously we were restricting to a single .dist-info directory anywhere
in the unpacked wheel directory. That was incorrect since only a
top-level .dist-info directory indicates a contained "package". Now we
limit our restriction to top-level .dist-info directories.
2019-12-28 15:49:08 -05:00
Pradyun Gedam
7420629800
Effectively disable the wheel cache if not writable (#7489) 2019-12-28 18:56:05 +00:00
Pradyun Gedam
7d9b392fc0
Move legacy wheel build process into "operations.build" (#7513) 2019-12-28 18:55:06 +00:00
Stéphane Bidoul (ACSONE)
7c2c58442f
Update docstring 2019-12-28 16:18:10 +01:00
Pradyun Gedam
d4b5392b7a
Merge pull request #7516 from chrahunt/refactor/remove-unnecessary-cleanup
Remove unnecessary InstallRequirement cleanup in install_given_reqs
2019-12-28 12:42:01 +00:00
Stéphane Bidoul (ACSONE)
1ee270a8d4
Check that the cache is writable in _main()
This avoid code duplication (for the wheel and http
cache) and repeated warnings.
2019-12-28 13:04:54 +01:00
Stéphane Bidoul (ACSONE)
158ae67910
Remove unused _wheel_dir in WheelBuilder 2019-12-26 21:43:57 +01:00
Stéphane Bidoul (ACSONE)
9909b4069a
Move final copy operation from wheel_builder to wheel command 2019-12-26 21:43:57 +01: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
Stéphane Bidoul (ACSONE)
a4d06aecaa wheel builder: unconditionally update req.link (#7515)
We unconditionally update the requirement
link with the build wheel (in cache), so
when build() will return build success as
well as build failure, the caller can obtain
the built wheel by looking at req.local_file_path
2019-12-27 04:31:55 +08:00
Chris Hunt
db42a03ee2 Remove unnecessary InstallRequirement cleanup in install_given_reqs
install_given_reqs is only called from InstallCommand.run, which calls
RequirementSet.cleanup_files, which calls
InstallRequirement.remove_temporary_source for each InstallRequirement,
so the call here was not necessary.

We have test coverage affirming this still works as expected in
tests/functional/test_install_cleanup.py.
2019-12-26 14:46:05 -05:00
Chris Hunt
ce9ddbb600 Move download file copying out of unpacking functions
Now our "unpacking" functions aren't also for sometimes populating
the download directory.
2019-12-26 11:12:17 -05:00
Pradyun Gedam
37f3fd7087
Move legacy wheel build process 2019-12-25 17:52:39 +05:30
Chris Hunt
5c90145462 Switch conditions 2019-12-24 16:59:24 -05:00
Chris Hunt
554db9230d Move directory requirement download logging out of unpack_file_url
One less use of `download_dir` in `unpack_file_url`, which will make it
easier to factor out.
2019-12-24 16:56:24 -05:00
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
92da786643
Merge pull request #7494 from chrahunt/refactor/wheel-metadata-retrieval
Only allow one top-level .dist-info directory in wheels
2019-12-23 05:41:30 +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
Chris Hunt
e5495cf6a1 Raise UnsupportedWheel when .dist-info doesn't match name
This aligns with the previous behavior that would have enforced the
found .dist-info directory starting with the name of the package.

We raise UnsupportedWheel because it looks better in output than the
AssertionError (which includes traceback).
2019-12-21 21:27:49 -05:00
Chris Hunt
de217b54af Only allow one top-level .dist-info directory in wheels 2019-12-21 10:50:20 -05: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
Chris Hunt
38585adaec Add warning when using old console script wrappers
We use sys.stderr instead of our `deprecated` helper because logging is
not set up at the time this is executed.
2019-12-20 22:01:25 -05:00
Tzu-ping Chung
f6afa1a154 Make appdirs detect IronPython Windows 2019-12-20 15:42:44 +08: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
368c811467 Treat Windows an macOS as special case in appdirs 2019-12-20 14:16:30 +08:00