After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 654044 - Improve python-finding code
Improve python-finding code
Status: RESOLVED OBSOLETE
Product: planner
Classification: Other
Component: General
0.14.x
Other Linux
: Normal normal
: ---
Assigned To: planner-maint
planner-maint
cleanup
Depends on:
Blocks:
 
 
Reported: 2011-07-05 19:34 UTC by Pacho Ramos
Modified: 2021-06-09 20:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
planner-0.14.5-find-python.patch (996 bytes, patch)
2011-07-05 19:34 UTC, Pacho Ramos
needs-work Details | Review
planner-0.14.6-find-python.patch (1.03 KB, patch)
2011-12-31 19:41 UTC, Pacho Ramos
none Details | Review
planner-0.14.6-find-python.patch (1.04 KB, patch)
2012-01-04 19:54 UTC, Pacho Ramos
none Details | Review
0001-Speed-up-python-path-detection.patch (1.37 KB, patch)
2012-12-29 18:25 UTC, Gilles Dartiguelongue
none Details | Review

Description Pacho Ramos 2011-07-05 19:34:30 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
Comment 1 Alexandre Franke 2011-10-18 13:53:28 UTC
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.
Comment 2 Pacho Ramos 2011-10-18 17:53:56 UTC
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 :-)
Comment 3 Arfrever Frehtes Taifersar Arahesis 2011-10-18 18:26:33 UTC
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]))'`
Comment 4 Pacho Ramos 2011-12-31 19:41:21 UTC
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


:/
Comment 5 Arfrever Frehtes Taifersar Arahesis 2011-12-31 20:44:01 UTC
Autoconf treats [ ] as some type of quoting. You should add additional [ ] quotes somewhere. Example:
[python_path=`$PYTHON -c '...'`]
Comment 6 Pacho Ramos 2012-01-04 19:54:04 UTC
Created attachment 204607 [details] [review]
planner-0.14.6-find-python.patch

You are true, this one looks to work fine :D
Comment 7 Gilles Dartiguelongue 2012-12-29 18:25:52 UTC
Created attachment 232376 [details] [review]
0001-Speed-up-python-path-detection.patch

Update patch to current git master.
Comment 8 GNOME Infrastructure Team 2021-06-09 20:45:32 UTC
-- 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.