-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--build-dir is not respected when installing from an sdist without a req #4242
Comments
What is your usecase for using |
Unfortunately, I use |
Huh, interesting. Are any of them public? I'm curious what they're doing that leaks that into the output. |
A classic example is this numpy code generator that writes generator's I decided it was easier to systematically bandaid the problem by using a constant |
Am I correct in thinking that the leaked build directory name is not affecting the functionality of the resulting packages, it's just making the builds show as non-identical when rerun? |
I have never seen the build directory actually effect package behavior, no. However, I aim for byte-for-byte reproducibility of pip's output artifacts. (This is critical for e.g., avoiding unnecessary invalidation in content-addressable caching.) If |
I'd like to note that another use case for One particular use case here is asv, which needs to rebuild and reinstall Python projects very many times, and significantly benefits from ccache. (For instance, with proper caching Scipy build goes from 10min to <1min.) However, we have to jump through some extra hoops in the build automation because I wasn't aware that Another use case for ccache is in continuous integration (e.g. travis-CI). Here, one can sometimes avoid use of pip, but it's not so easy to find out the reason why ccache doesn't work properly when using pip. |
Confirmed the original behavior still occurs in 19.2.1. The fact that we don't respect
That may be better answered during the PR itself, but offhand it looks like that approach would run into issues:
|
The |
Now that |
Reproduction steps
Analysis
This bug only happens when a "req" is not given on the command line. (Indeed, it's possible work around the bug by passing a
file://
URL with a#egg=mydist
fragment.) When a "req" is not given, pip determines the distribution name by runningsetup.py egg_info
and parsing the distribution name from the resulting metadata.egg_info
is always run in a temporary directory selected by pip (seeInstallRequirement.build_location
). The bug is that this directory is then used for the actual build. The methodInstallRequirement._correct_build_location
is apparently supposed to address this very case by setting the build directory back to the user-specified one. However, it is always noop because it's early exit conditionself.source_dir is not None
is always true. (One can almost prove this because the singular caller of_correct_build_location
,run_egg_info
asserts thatself.source_dir
is notNone
.)Would it be possible to use the user-specified
--build-dir
to runegg_info
in and clean out the directory before running the real build? That would fix this bug, make the behavior more consistent, and likely simplifyInstallRequirement
's code.The text was updated successfully, but these errors were encountered: