-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Help debugging entry_points failure #1174
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
Comments
This was a stupid issue. Closing. |
Entry points are loaded from active distributions. On import, I took a stab at monkey-patching the backend to use There are some issues with the method used by setuptools' backend to run
Both those issues are resolved with the following patch: setuptools/build_meta.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git i/setuptools/build_meta.py w/setuptools/build_meta.py
index 54f2987b..f89f82d6 100644
--- i/setuptools/build_meta.py
+++ w/setuptools/build_meta.py
@@ -65,10 +65,11 @@ def _run_setup(setup_script='setup.py'):
# Note that we can reuse our build directory between calls
# Correctness comes first, then optimization later
__file__ = setup_script
+ __name__ = '__main__'
f = getattr(tokenize, 'open', open)(__file__)
code = f.read().replace('\\r\\n', '\\n')
f.close()
- exec(compile(code, __file__, 'exec'))
+ exec(compile(code, __file__, 'exec'), locals())
def _fix_config(config_settings): |
I don't think it was stupid :) IMHO, calling |
So there are several points:
|
Look here. |
Also, yes but no. We (pip) control all modules that are loaded before we modify the environment. I don't understand why pkg_resources is even loaded, because I thought pip used a vendored version. |
Unfortunately, a lot of distributions like to mess with vendored stuff (e.g. setuptools and pip, among others), and this mean that setuptools/pkg_resources will be loaded before you get a chance to patch the path. It's the same issue with setuptools handling of |
Here's what I'm doing: I patch the path here: Then I spawn the subprocess here: The environment is the same, so sys.path has to be modified before the subprocess interpreter even starts. |
To be clear, I:
Why is this not working? |
I'll see if I can find a way to check, using the code I had made to fix unvendored tests. Did you take a look at my other changes? |
Which changes are you talking about? To be clear, I think reloading pkg_resources is not necessarily the "correct" fix, but it:
|
Thanks. My plan of action is from here is to:
Also, the subprocess might be the better solution. But there's just something satisfying about not having to touch the command line and letting Python handle the problem. And also it gives me an excuse to get concurrent.futures into pip. |
Actually, on second thought, you have the better solution. I'll just merge your changes in. |
While trying to get pip to use the new
build_meta
, I ran into a problem: setuptools loaded the entry points from the global environment rather than the temporary build environment: see here. How doespkg_resources
discoverentry_points
and how can I override it?The text was updated successfully, but these errors were encountered: