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 796092 - meson: use new python module
meson: use new python module
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-python
git master
Other All
: Normal normal
: 1.15.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 792873 797138 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2018-05-14 08:11 UTC by Håvard Graff (hgr)
Modified: 2018-10-31 00:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
meson: use new python module (10.34 KB, patch)
2018-05-14 08:11 UTC, Håvard Graff (hgr)
committed Details | Review

Description Håvard Graff (hgr) 2018-05-14 08:11:07 UTC
Created attachment 371989 [details] [review]
meson: use new python module

This patch makes the tests pass running uninstalled and installed, with
python2 and python3 on linux, windows and osx.

The main gist is to use the new python-module to do the lifting done
by pythondetector, and with that add support for python2 and windows.
Comment 1 Nicolas Dufresne (ndufresne) 2018-05-15 09:54:32 UTC
Review of attachment 371989 [details] [review]:

::: gi/overrides/meson.build
@@ +14,3 @@
 # Workaround to get uninstalled working.
 foreach source: pysources
+    run_command(python, '-c', 'import os; os.symlink("@0@/@1@", "@2@/@3@")'.format(

Are you convince this won't default to python 2 instead of 3 ? Would be a bit backward, since we are dropping python 2 in cerbero and eventually other build tools.
Comment 2 Håvard Graff (hgr) 2018-05-15 10:57:09 UTC
(In reply to Nicolas Dufresne (ndufresne) from comment #1)
> Review of attachment 371989 [details] [review] [review]:
> 
> ::: gi/overrides/meson.build
> @@ +14,3 @@
>  # Workaround to get uninstalled working.
>  foreach source: pysources
> +    run_command(python, '-c', 'import os; os.symlink("@0@/@1@",
> "@2@/@3@")'.format(
> 
> Are you convince this won't default to python 2 instead of 3 ? Would be a
> bit backward, since we are dropping python 2 in cerbero and eventually other
> build tools.

If you look in meson_options.txt you will see python3 is the default. It would be a good idea to support Python 2 until at least it is end-of-life: https://pythonclock.org/. A lot of frameworks (like twisted) still only works with Python 2.
Comment 3 Nicolas Dufresne (ndufresne) 2018-05-15 12:52:17 UTC
Ok, thanks for the clarification.
Comment 4 Thibault Saunier 2018-05-15 14:30:18 UTC
(In reply to Håvard Graff (hgr) from comment #2)
> It would be a good idea to support Python 2 until at least it is end-of-life:
> https://pythonclock.org/. A lot of frameworks (like twisted) still only
> works with Python 2.

I didn't know there was a set date, I guess we can keep supporting until 1/1/2020  indeed.
Comment 5 Håvard Graff (hgr) 2018-09-17 11:33:36 UTC
ping?
Comment 6 Jan Tojnar 2018-09-26 13:18:58 UTC
Review of attachment 371989 [details] [review]:

The meson_version attribute should be bumped:

    WARNING: Project specifies a minimum meson_version '>= 0.36.0' but uses features which were added in newer versions:
     * 0.37.0: {'shared_module'}
     * 0.46.0: {'Python Module'}

::: meson.build
@@ +23,2 @@
 pygobject_dep = dependency('pygobject-3.0', version : '>= 3.8')
 python_dep = dependency('python3')

This can be removed?

@@ +38,3 @@
 pygi_override_dir = get_option('pygi-overrides-dir')
 if pygi_override_dir == ''
+    cres = run_command(python, '-c','''

Why not save this to a separate file? It would support syntax highlighting other dev tools.

@@ +47,3 @@
+        print(path)
+        exit(0)
+exit(1)

This does not have the “Otherwise follow python's way of install site packages inside the provided prefix” branch from the original detector script, making it fail in cases where `gi.overrides.__path__` does not start with `prefix` (e.g. on NixOS). But since the  value can be fixed using meson option, it is probably alright.
Comment 7 Jan Tojnar 2018-09-26 13:20:59 UTC
*** Bug 797138 has been marked as a duplicate of this bug. ***
Comment 8 Mathieu Duponchelle 2018-10-31 00:01:18 UTC
Review of attachment 371989 [details] [review]:

I have committed this, and addressed the review comments in a separate commit, thanks Havard!
Comment 9 Mathieu Duponchelle 2018-10-31 00:03:51 UTC
*** Bug 792873 has been marked as a duplicate of this bug. ***