-
Notifications
You must be signed in to change notification settings - Fork 312
Print a warning when mixing $EBPYTHONPREFIXES and $PYTHONPATH modules
#3521
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
base: develop
Are you sure you want to change the base?
Conversation
2777a95 to
2323b76
Compare
$EBPYTHONPREFIXES and $PYTHONPATH modules
| conflicts = [dep['name'] for dep in self.cfg.dependencies() if is_in_pythonpaths(dep)] | ||
| if conflicts: | ||
| print_warning('The following modules set $PYTHONPATH but $%s is also used: %s\n' | ||
| 'Mixing such modules might cause unexpected results during the build of Python packages. ' |
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.
Should we use problems instead of results here?
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.
I wanted to be more generic because the result may not be a problem but still not what is expected or even intended
|
Looks OK to me at first glance, but I would like @Micket to pitch in here too... |
|
ping @Micket |
Micket
left a comment
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.
looks fine to me, i'll upload a test report
|
Hm, i wanted to test this in conjunction with --prefer-python-search-path, it would help me if this targeted 5.0.x instead for testing. |
2323b76 to
df5a827
Compare
|
Rebased and retargeted to 5.0x |
|
@Flamefire I changed to target branch in this PR from |
$PYTHONPATH takes precedence which might lead to unexpected or wrong packages being used especially when a dependency includes a newer package than another dependency. As it is very hard to find this as the cause print a warning when this situation is found.
44104d5 to
e5b7430
Compare
$PYTHONPATH takes precedence which might lead to unexpected or wrong packages being used especially when a dependency includes a newer package than another dependency.
As it is very hard to find this as the cause print a warning when this situation is found.
I ran into this while building
scipyof theSciPy-bundlewhich includes patches that require a newerCythonas the build dependency then what is available in thePython-bundle-PyPImodule. As only Python-bundle used$PYTHONPATHthe package from theCythonmodule was ignored even thoughwhich cythonpoints to the right binary.The error wasn't helpful:
The least we can do is to detect such issues and warn the user.
The check is triggered for direct dependencies when both
$PYTHONPATHand$EBPYTHONPREFIXESare set and the Python module is loaded.I only check for modules that have a
lib/python*/site-packagesfolder and specifically exclude the Python module which sets$PYTHONPATHfor thesite-customize.pyThis should catch most false positives while still catching enough real issues