-
-
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
termux_step_get_dependencies_python.sh: adding path to python-crossenv modules #21590
base: master
Are you sure you want to change the base?
Conversation
@@ -30,6 +30,9 @@ termux_step_get_dependencies_python() { | |||
|
|||
# adding and setting values to work properly with python modules | |||
export PYTHONPATH=$TERMUX_PYTHON_HOME/site-packages | |||
if [ "$TERMUX_ON_DEVICE_BUILD" = "false" ]; then | |||
export PYTHONPATH+=":$TERMUX_PYTHON_CROSSENV_PREFIX/build/lib/python${TERMUX_PYTHON_VERSION}/site-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.
This will mess up the target python. Can you give a case why this PR is needed?
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 will mess up the target python.
Could you explain this in more detail?
Can you give a case why this PR is needed?
I'm trying to rebuild some glibc packages with new python-glibc
(3.12.6), and I encountered a problem with gobject-introspection-glibc
package. The problem is that gobject-introspection-glibc
package works with python-glibc
directly, and it started requiring setuptools
module in new python-glibc
. The module can be installed via termux_step_get_dependencies_python
function, but python-glibc
doesn't see it, because it is installed for python-crossenv
. So I think it would be good if python-glibc
could find modules from python-crossenv
. Here is the PR (it already tested with this change) - termux-pacman/glibc-packages#287
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.
Could you explain this in more detail?
crossenv
uses virtualenv to simulate a python interceptor for the target python. If PYTHONPATH
is set, then the simulated python will search it first, and some packages installed in the cross-virtualenv will never get searched -- packages in the build-virtualenv will be used instead, and this may lead to some issues.
If crossenv
is used, the python
command should be redirected to $TERMUX_PYTHON_CROSSENV_PREFIX/cross/bin/python
. It seems that $PREFIX/bin/python
is used in the build script of gobject-introspection-glibc
(https://github.com/termux-pacman/glibc-packages/blob/ac3a9354b29a20dcff8f33740e564dcffa582612/gpkg/gobject-introspection/build.sh#L22)
If it is really necessay for python-glibc
, you can guard it with "$TERMUX_ON_DEVICE_BUILD" = "false" && "${TERMUX_PACKAGE_LIBRARY}" = "glibc"
.
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.
Ok, thanks for the explanation. I took this into account and made some changes in the python-glibc
package. There I added a special variable TERMUX_PYTHON_MAINPATH
, which works like the PYTHONPATH
variable. But when using this new variable, the PYTHONPATH
variable will be ignored.
…v modules so termux python can work with them
d1707a7
to
465ba08
Compare
so termux python can work with them