GNOME Bugzilla – Bug 654044
Improve python-finding code
Last modified: 2021-06-09 20:45:32 UTC
Created attachment 191358 [details] [review] planner-0.14.5-find-python.patch Hello, as you can see in downstream bug: http://bugs.gentoo.org/show_bug.cgi?id=344231 We are trying for a long time to try to solve the problem of python-finding code being really really slow on some packages (gnome-python-extras, planner...), and we would like to find an way to fix it in a way that would be upstreamable for all that cases. Attached patch fixes this for us, please commit if possible, thanks a lot
Review of attachment 191358 [details] [review]: I'm not sure your proposed change has the same features as existing code. ::: acinclude.m4.old @@ +87,3 @@ AC_MSG_CHECKING([for Python library path]) + python_path=`$PYTHON -c 'import distutils.sysconfig; \ + print(distutils.sysconfig.get_python_inc())'` That code is looking for /usr/include/ style directory. Don't you mean get_python_lib()? Note that it returns /usr/lib/python2.7/dist-packages and not just /usr/lib/python2.7/. @@ -93,3 @@ - fi - done - python_path=`echo $python_path | sed "s,/libpython.*$,,"` That code was looking for /usr/lib/ style directory.
Arfrever, could you please take a look on this as I am sure you will know much more than me about this problem? Thanks a lot :-)
This patch is wrong. I suggest to use: python_path=`$PYTHON -c 'import distutils.sysconfig, os; print(os.path.sep.join(distutils.sysconfig.get_python_lib(standard_lib=True).split(os.path.sep)[:-1]))'`
Created attachment 204397 [details] [review] planner-0.14.6-find-python.patch After applying this configure fails with: checking for Python library path... File "<string>", line 1 import distutils.sysconfig, os; print(os.path.sep.join(distutils.sysconfig.get_python_lib(standard_lib=True).split(os.path.sep):-1)) ^ SyntaxError: invalid syntax :/
Autoconf treats [ ] as some type of quoting. You should add additional [ ] quotes somewhere. Example: [python_path=`$PYTHON -c '...'`]
Created attachment 204607 [details] [review] planner-0.14.6-find-python.patch You are true, this one looks to work fine :D
Created attachment 232376 [details] [review] 0001-Speed-up-python-path-detection.patch Update patch to current git master.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/World/planner/-/issues/201.