Commit Graph

191 Commits

Author SHA1 Message Date
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 4a93045be1 Remove no-op RequirementSet.cleanup_files 2020-02-05 20:16:05 -05:00
Chris Hunt 77e9b79d0e Remove no-op calls to WheelCache.cleanup 2020-02-04 23:11:27 -05:00
Chris Hunt 7068e58b6f Configure tempdir registry
This mirrors the current logic within the individual requirement-related
commands (install, wheel) for setting options.no_clean, which is used to
determine whether we need to delete directories.

Next, we'll add the actual directories to track and remove them from
being managed by other objects.
2020-02-04 20:22:39 -05:00
Chris Hunt 0b4ec28a39 Centralize addition of no_clean argument
We want to rely on --no-clean being a valid option for
RequirementCommand types, so move it to one place close to the code that
will depend on it.
2020-02-04 20:22:39 -05: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
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) 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) 3ae13f7d28
Move is_wheel_installed to utils 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
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
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) 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
Chris Hunt fe320a3da0 Remove redundant build_dir normalization 2019-12-12 21:46:04 +08:00
Chris Hunt b6e007c6a8 Remove redundant src_dir normalization 2019-12-12 21:46:04 +08:00
Chris Hunt b8f626ace6 Deprecate install-location-related options in --install-option 2019-11-30 17:42:48 -05:00
Pradyun Gedam 1405a403fe
Merge branch 'master' into add-use-user-site-to-preparer 2019-11-11 08:40:20 +05:30
Pradyun Gedam c9606b86e1
Add use_user_site to RequirementPreparer 2019-11-10 13:51:29 +05:30
Pradyun Gedam c40a9d332d
Update callsites for RequirementTracker 2019-11-10 12:33:25 +05:30
Chris Hunt deac2343dc Don't pass PackageFinder to Preparer from Resolver
Preparer's overall responsibilities align more with having its own
reference to finder, which will help us remove it from resolver later.
2019-11-05 20:57:14 -05:00
Chris Hunt f305f66eb2 Trace common finder info outside resolver
There's no reason for Resolver to trace this information about our
PackageFinder, we just need a common one-time function to trace useful
information.
2019-11-05 20:57:14 -05:00
Christopher Hunt 31460e5ed7
Merge pull request #7299 from chrahunt/refactor/make-setuptools-args-explicit
Make setuptools args explicit
2019-11-05 20:52:35 +08:00
Chris Hunt 431727a4e4 Set home in setuptools args functions 2019-11-04 19:48:24 -05:00
Chris Hunt b28d05bb50 Set user and prefix in setuptools args functions
Previously we were adding arguments to install_options in response to
command-line parameters, which leads to spooky action at a distance.
Now we provide the arguments explicitly.
2019-11-04 19:40:00 -05:00
Pradyun Gedam da9a432576
Move WheelBuilder and friends to a dedicated module 2019-11-04 11:49:02 +05:30
Chris Hunt 3076c39f25 Remove unused Resolver.session 2019-11-03 14:31:38 -05:00
Chris Hunt 44cc3aeb0a Use session from RequirePreparer, not Resolver 2019-11-03 14:26:47 -05:00
Chris Hunt 9dc065972f Return InstallationResult from requirement installation 2019-10-29 21:50:48 -04:00
Thomas Kluyver 1310fc276a Use truthiness of everything but None for use_user_site 2019-10-25 08:26:11 +01:00
Thomas Kluyver d631a9355c Allow for use_user_site being set to an integer
This can come from tox config, see:
https://github.com/pypa/pip/pull/7002#issuecomment-545108292
2019-10-24 11:59:22 +01:00
Pradyun Gedam c729a84b48
Merge pull request #7002 from takluyver/install-user-fallback
Default to --user install in certain conditions
2019-10-22 08:44:06 +05:30
Thomas Kluyver 42b1ef3537 Clarify comment 2019-10-21 13:52:50 +01:00
Thomas Kluyver fbc0588c01 Add unit tests of decide_user_install() 2019-10-20 21:48:18 +01:00
Thomas Kluyver 16174f4ad0 Add logging for decide_user_install 2019-10-20 21:28:56 +01:00
Thomas Kluyver 79f0591630 Don't check write access on the same path twice 2019-10-20 21:23:49 +01:00
Pradyun Gedam 9ab9040d75
Remove RequirementSet.require_hashes (#7068) 2019-10-20 13:23:40 +05:30
Thomas Kluyver ecac7a17b5 Line length 2019-10-19 11:28:51 +01:00
Pradyun Gedam e94e7877ab Polish & clarify decide_user_install() function 2019-10-19 11:23:27 +01:00
Chris Hunt b8fb97a815 Remove unused RequirementSet.require_hashes 2019-10-13 13:19:49 -04:00
Sebastian Jordan e3089c5bff Merge remote-tracking branch 'origin/master' into issue-6222 2019-10-11 19:23:45 +02:00
Thomas Kluyver 5f14682749 Factor out code for handling the --user option & its default 2019-10-09 17:34:16 +01:00
Thomas Kluyver a9405b22fc Ensure necessary install_options are set for default user install 2019-10-09 08:48:33 +01:00
Thomas Kluyver a6b13b637b Fix maximum line length 2019-10-09 08:43:58 +01:00
Thomas Kluyver 14e76d0eaf Remove unused import 2019-10-09 08:38:58 +01:00
Thomas Kluyver 042d4844e8 Default to --user install in certain conditions 2019-10-09 08:34:29 +01:00
Albert Tugushev 10b9421193 Fix a typo 2019-10-06 01:10:59 +07:00
Sebastian Jordan 6a2d2dbb81 Merge branch 'master' of https://github.com/pypa/pip into issue-6222 2019-10-03 08:36:19 +02:00
Maxim Kurnikov 3692097cca add per-file disallow_untyped_defs=False, and set it to True globally 2019-09-29 23:31:15 +02:00
Sebastian Jordan cd0d6e8239 Delete unnecessary empty line addition 2019-09-25 07:04:56 +02:00
Sebastian Jordan 7a0f7b607d Improve check_binary_allowed via early return 2019-09-25 06:58:53 +02:00
Sebastian Jordan 4879c8b2eb Linting 2019-09-22 21:31:45 +02:00
Sebastian Jordan e9ea3966e0 Build pep 517 requirements when installing packages 2019-09-22 21:29:31 +02:00
Chris Hunt 85dcaa74bb Unconditionally create TempDirectory.path 2019-09-22 00:02:46 -04:00
Chris Hunt 8b8f8abe45 Unconditionally create TempDirectory in install 2019-09-19 21:54:39 -04:00
Chris Hunt 81d8005bd1 Change argument name to better reflect purpose.
Also assert on provided path, since it should have been created in all
cases.
2019-09-11 19:03:57 -04:00
Chris Hunt 82be4ee76a Use application context manager for PipSession.
This removes a level of indentation from all commands without
introducing any dummy functions.
2019-09-07 09:46:48 -04:00
Pradyun Gedam a39e881479
Fix pip.exe upgrade pip fails on Windows
Merge pull request #6928 from atugushev/fix-issue-6924
2019-09-07 14:14:29 +05:30
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
Albert Tugushev bb68ebaa84 Address review comments
Simplify code
2019-08-26 17:22:47 +03:00
Albert Tugushev d8b6296227 Fix pip.exe upgrade pip fails on Windows
It fails if it already satisfies the requirement, when
pip has been modifying via `pip.exe install ...` command.
2019-08-26 16:05:48 +03:00
A_Rog 70027b2f50 Address #6876: Make command output go through a single function (#6881) 2019-08-22 17:29:22 -07: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 698b27b875 Start type checking commands/install.py and commands/wheel.py. 2019-08-11 11:33:18 -07:00
Chris Jerdonek 23446f6d0e Remove the unneeded name argument from populate_requirement_set(). 2019-08-08 17:29:02 -07:00
Chris Jerdonek da9ebed9df Move RequirementCommand to req_command.py. 2019-08-04 02:05:33 -07:00
Prabakaran Kumaresshan b562531cc5 Add make_resolver() to RequirementCommand base class (#6826). 2019-08-03 23:47:50 -07:00
Prabakaran Kumaresshan 82dbcdae87 Add make_requirement_preparer() to RequirementCommand base class (#6810) 2019-08-01 20:29:44 -07:00
Pradyun Gedam dc7f2b91d5
Document that `--ignore-installed` is dangerous (#6794) 2019-07-30 13:32:04 +05:30
Chris Jerdonek 1f09e67f34 Only import a Command class when it is actually needed.
This resulted in an approximate 24% speed-up of a vanilla `pip`
invocation on one system (0.477 secs before, 0.363 secs after).
2019-07-26 23:30:26 -04:00
Ivan Pozdeev 6c7d309a1c fix flake8 violation 2019-07-27 03:19:11 +03:00
Ivan Pozdeev d948f63fe2 Document that `--ignore-installed` is dangerous 2019-07-27 02:46:08 +03:00
Pradyun Gedam 537b0fca12
Change isort multi_line_output to 3 2019-07-22 10:15:27 +05:30
Xavier Fernandez fc618bf3b1 Move virtualenv detection functions into their own module 2019-07-19 10:03:22 +02:00
Chris Jerdonek db213c04d7 Add add_target_python_options() and make_target_python(). 2019-06-23 09:28:54 -07:00
Chris Jerdonek 798d814629 Change PackageFinder to use Tuple[int, ...] instead of List[str] for --python-version. 2019-05-28 03:05:14 -07:00
Pradyun Gedam b05c66722e
Move Resolver to a legacy_resolve module 2019-05-25 12:35:31 -04:00
Chris Jerdonek ad2b07898d Fix pip-install to respect --ignore-requires-python. 2019-05-22 21:34:41 -07:00
Chris Jerdonek a163ae5af1
Fix some formatting issues in the pip-install docs (#6432) 2019-05-07 09:13:56 -04:00
Chris Jerdonek a2ed253788 Whether to build wheels is no longer affected by --no-cache-dir. 2019-02-27 20:38:09 -08:00
Chris Jerdonek 8e531be255 Refactor out build_wheels(), and test. 2019-02-27 20:36:25 -08:00
Nick Timkovich ab53c8209c Fix error formatting
`+` has a lower precedence than the `.format`, so the formatting doesn't actually insert anything. Implicit string concatenation has higher (highest?) precedence.
2019-02-06 22:01:05 +01:00
Paul Moore e8f7aa1446 Pass use_pep517 option to resolver 2018-11-14 14:06:35 +00:00
Paul Moore 9d2b17854d Add --[no-]use-pep517 command line flag 2018-10-29 23:33:21 +01:00
Paul Moore c8d8e37ea4 Fix copy and paste error 2018-10-29 23:32:13 +01:00
Paul Moore 48e9cb693f Address test failures 2018-10-29 23:32:13 +01:00
Paul Moore b62284a81b Build PEP 517 and legacy wheels separately 2018-10-29 23:32:13 +01:00
Paul Moore b9e92a70fd With build isolation, we shouldn't check if wheel is installed to decide if we build wheels 2018-10-29 23:32:13 +01:00
Paul Moore 8fbf78d407 Phase 2 - generate metadata using PEP 517 hook 2018-10-29 23:28:23 +01:00
Thomas Kluyver 32b8a797cb Remove unused variable 2018-10-02 14:29:58 +02:00
Thomas Kluyver 3ec6775e1f Catch errors checking for conflicts, don't crash install 2018-10-02 12:07:48 +02:00
Loren Carvalho cddcb1407f Open up plat/abi/impl options to `install --target`
* Move dist restriction options to be re-usable (between install/download)
* Make dist restriction options usable in `install` (exclusively with --target)
* Add a check_supported_wheels bool to RequiriementSet for non-resolved (full path) dependencies
2018-08-05 16:13:20 -05:00
Pradyun Gedam 1694a5f1bf
Move status_codes to pip._internal.cli 2018-07-30 09:43:53 +05:30