-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 meta: fixes and cleanups #1175
Conversation
In some cases (specifically when pip imports this module in a virtualenv), pkg_resources can already be imported, causing setuptools to load entry_points from an older version. Here, we re-initialize the master working set to fix the case where the entry points from an older setuptools are loaded.
This change is a small simplification that simply creates the egg_info directory in the egg_base location; it's a minor cleanup that results in some read and it helps with read-only directories (the egg_info directory is uncontrollable).
Okay, this should be ready to go. |
setuptools/build_meta.py
Outdated
@@ -64,11 +66,13 @@ def patch(cls): | |||
def _run_setup(setup_script='setup.py'): | |||
# Note that we can reuse our build directory between calls | |||
# Correctness comes first, then optimization later | |||
_initialize_master_working_set() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not necessary anymore, no?
This PR needs more detail. In particular, it needs a bug report or comment describing the undesirable behavior this is correcting. I see some description in the commit message of the first commit (ffb2e69)... and I'd like to know more. In particular, what are the two setuptools versions under which different entry points are loaded? I feel like I've encountered some of these issues before and want to be sure we're coordinating approaches. |
Related: #1174. Adding 1 or 2 tests for the changes to variable = True
def function():
return variable assert __name__ == '__main__' |
@benoit-pierre Can you explain the |
In particular, some setup scripts (particularly here) failed because the The other change with respect to The |
Tests have been added. @jaraco Hopefully I've done the right thing. |
Also many thanks to @benoit-pierre for the excellent PR reviews. |
@benoit-pierre I have found another issue with the hook. To be perfectly clear, this pull request should still be merged even if it is not fixed because it fixes some of the bugs, but not all of them. Specifically, it appears that in some cases, (see here), What I'm going to to specifically here to resolve this problem is if there is no |
This code is a bit ugly, but it's also been tested with the pip test suite It's not the best solution long term (the best solution is to get the egg_info directory directly from egg_info), but it works for now and avoids technical risk.
@jaraco ping. |
Released as v36.7.3 |
Thanks. It looks like the pip side has gone off the rails though. |
Attached are some minor cleanups and fixes to the build_meta module that I added in #1143.