Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
ensure system python path is not pushed to front of PYTHONPATH #2144
First attempt at solving #1999.
Ensure that a system python path is never pushed to the front of
This seems to work as intended and doesn't break any tests (I think). However, definitely one of our python gurus should check it out.
Thanks @grondo for putting this together!
Gave this a spin, and it works well. My only concern is what happens when we configure flux for multiple pythons.
Right now, this is what happens when you configure/install for python3.7 and then again for python2.7:
Can we tweak
Isn't this the same as any other python package installed on the system? How do users normally import a system installed package without "polluting" their PYTHONPATH?
I don't think I had the use case in mind that users would want to use
That being said, there probably isn't any harm in adding the python version to
Yes, it is how other system-installed python packages are added. Normally, if a user wants to import a specific package without pulling in system packages, they will install it locally with
Yeah, this PR solves #1999 perfectly. So if we want to leave how it is, that is fine.
It "should be"
Yes, as you hinted, the following patch (pushed as a separate commit for now) just seems to work:
diff --git a/configure.ac b/configure.ac index 57d45b781..224ff43c3 100644 --- a/configure.ac +++ b/configure.ac @@ -360,7 +360,7 @@ AC_SUBST(fluxlibdir) # doesn't inadvertently insert system python paths (or any # other python path for that matter) first in PYTHONPATH. # -AS_VAR_SET(fluxpylinkdir, $fluxlibdir/python) +AS_VAR_SET(fluxpylinkdir, $fluxlibdir/python$PYTHON_VERSION) AC_SUBST(fluxpylinkdir) AS_VAR_SET(fluxmoddir, $libdir/flux/modules)
Let me know what you think and I can squash that one down.
Add a links to the Flux python modules installed under the standard python module path, pyexecdir, in a non-standard path. This will allow the flux(1) cmddriver to prepend a path to PYTHONPATH that *only* has the Flux python modules in it, instead of potentially pulling in other modules unnecessarily.
Change the INSTALLED_PYTHON_PATH conf variable to use `fluxpylinkdir` instead of `pexecdir`. This will allow the flux(1) cmddriver to push a non-standard path to the front of PYTHONPATH, pulling in just the flux python modules without inadvertently pulling in other unwanted modules. Fixes #1999
@@ Coverage Diff @@ ## master #2144 +/- ## ========================================== + Coverage 80.41% 80.45% +0.03% ========================================== Files 200 200 Lines 31781 31781 ========================================== + Hits 25557 25569 +12 + Misses 6224 6212 -12