[arch-commits] Commit in gst-python/repos/staging-x86_64 (3 files)
Felix Yan
felixonmars at gemini.archlinux.org
Fri Dec 3 22:19:00 UTC 2021
Date: Friday, December 3, 2021 @ 22:18:59
Author: felixonmars
Revision: 430674
archrelease: copy trunk to staging-x86_64
Added:
gst-python/repos/staging-x86_64/0001-python-Avoid-treating-float-as-int.patch
(from rev 430673, gst-python/trunk/0001-python-Avoid-treating-float-as-int.patch)
gst-python/repos/staging-x86_64/PKGBUILD
(from rev 430673, gst-python/trunk/PKGBUILD)
Deleted:
gst-python/repos/staging-x86_64/PKGBUILD
-----------------------------------------------+
0001-python-Avoid-treating-float-as-int.patch | 86 ++++++++++++++++++++++++
PKGBUILD | 83 ++++++++++++-----------
2 files changed, 129 insertions(+), 40 deletions(-)
Copied: gst-python/repos/staging-x86_64/0001-python-Avoid-treating-float-as-int.patch (from rev 430673, gst-python/trunk/0001-python-Avoid-treating-float-as-int.patch)
===================================================================
--- 0001-python-Avoid-treating-float-as-int.patch (rev 0)
+++ 0001-python-Avoid-treating-float-as-int.patch 2021-12-03 22:18:59 UTC (rev 430674)
@@ -0,0 +1,86 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Thibault Saunier <tsaunier at igalia.com>
+Date: Tue, 16 Nov 2021 23:36:10 -0300
+Subject: [PATCH] python: Avoid treating float as int
+
+Since python 3.10 implicit conversion to integers using `__int__` as
+been completely removed (was deprecated behavior in 3.9) so we need
+to cleanly handle it now.
+
+See https://gitlab.gnome.org/GNOME/pitivi/-/issues/2589
+
+Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1358>
+---
+ .../gst-python/gi/overrides/gstmodule.c | 54 ++++++++++++++++---
+ 1 file changed, 47 insertions(+), 7 deletions(-)
+
+diff --git a/subprojects/gst-python/gi/overrides/gstmodule.c b/subprojects/gst-python/gi/overrides/gstmodule.c
+index 167a1c27539a..2308eb7dcde6 100644
+--- a/subprojects/gst-python/gi/overrides/gstmodule.c
++++ b/subprojects/gst-python/gi/overrides/gstmodule.c
+@@ -104,18 +104,58 @@ gi_gst_fraction_from_value (const GValue * value)
+ static int
+ gi_gst_fraction_to_value (GValue * value, PyObject * object)
+ {
+- PyObject *numerator, *denominator;
++ glong numerator, denominator;
++ PyObject *numerator_obj, *denominator_obj, *is_integer;
+
+- numerator = PyObject_GetAttrString (object, "num");
+- if (numerator == NULL)
++ numerator_obj = PyObject_GetAttrString (object, "num");
++ if (numerator_obj == NULL)
+ goto fail;
+
+- denominator = PyObject_GetAttrString (object, "denom");
+- if (denominator == NULL)
++ is_integer = PyObject_CallMethod (numerator_obj, "is_integer", NULL);
++ if (is_integer != Py_True) {
++ PyErr_Format (PyExc_TypeError,
++ "numerator %f is not an integer.", PyFloat_AsDouble (numerator_obj));
++ Py_DECREF (is_integer);
++ goto fail;
++ }
++ Py_DECREF (is_integer);
++
++ numerator = PyFloat_AsDouble (numerator_obj);
++ if (numerator < -G_MAXINT || numerator > G_MAXINT) {
++ PyErr_Format (PyExc_ValueError,
++ "numerator %" G_GINT64_FORMAT " is out of bound. [-%d - %d]",
++ numerator, G_MAXINT, G_MAXINT);
++ goto fail;
++ }
++
++ denominator_obj = PyObject_GetAttrString (object, "denom");
++ if (denominator_obj == NULL)
+ goto fail;
+
+- gst_value_set_fraction (value,
+- PyLong_AsLong (numerator), PyLong_AsLong (denominator));
++ is_integer = PyObject_CallMethod (denominator_obj, "is_integer", NULL);
++ if (is_integer != Py_True) {
++ PyErr_Format (PyExc_TypeError,
++ "denominator %f is not an integer.",
++ PyFloat_AsDouble (denominator_obj));
++ Py_DECREF (is_integer);
++ goto fail;
++ }
++ Py_DECREF (is_integer);
++
++ denominator = PyFloat_AsDouble (denominator_obj);
++ if (denominator == 0) {
++ PyErr_SetString (PyExc_ValueError, "denominator is 0.");
++ goto fail;
++ }
++
++ if (denominator < -G_MAXINT || denominator > G_MAXINT) {
++ PyErr_Format (PyExc_ValueError,
++ "denominator %" G_GINT64_FORMAT " is out of bound. [-%d - %d]",
++ denominator, G_MAXINT, G_MAXINT);
++ goto fail;
++ }
++
++ gst_value_set_fraction (value, numerator, denominator);
+
+ return 0;
+
Deleted: PKGBUILD
===================================================================
--- PKGBUILD 2021-12-03 22:18:50 UTC (rev 430673)
+++ PKGBUILD 2021-12-03 22:18:59 UTC (rev 430674)
@@ -1,40 +0,0 @@
-# Maintainer: Jan Alexander Steffens (heftig) <heftig at archlinux.org>
-# Contributor: Sergej Pupykin <pupykin.s+arch at gmail.com>
-# Contributor: Jan de Groot <jgc at archlinux.org>
-
-pkgname=gst-python
-pkgver=1.18.5
-pkgrel=2
-pkgdesc="Multimedia graph framework - python bindings"
-url="https://gstreamer.freedesktop.org/"
-arch=(x86_64)
-license=(LGPL)
-depends=(python-gobject gst-plugins-base-libs)
-makedepends=(git meson)
-_commit=3d75c6b1eefc1a4190f58ac8d4610535f1acca3f # tags/1.18.5^0
-source=("git+https://gitlab.freedesktop.org/gstreamer/gst-python.git#commit=$_commit")
-sha256sums=('SKIP')
-
-pkgver() {
- cd $pkgname
- git describe --tags | sed 's/-/+/g'
-}
-
-prepare() {
- cd $pkgname
-}
-
-build() {
- arch-meson $pkgname build
- meson compile -C build
-}
-
-check() {
- meson test -C build --print-errorlogs
-}
-
-package() {
- meson install -C build --destdir "$pkgdir"
- python -m compileall -d /usr/lib "$pkgdir/usr/lib"
- python -O -m compileall -d /usr/lib "$pkgdir/usr/lib"
-}
Copied: gst-python/repos/staging-x86_64/PKGBUILD (from rev 430673, gst-python/trunk/PKGBUILD)
===================================================================
--- PKGBUILD (rev 0)
+++ PKGBUILD 2021-12-03 22:18:59 UTC (rev 430674)
@@ -0,0 +1,43 @@
+# Maintainer: Jan Alexander Steffens (heftig) <heftig at archlinux.org>
+# Contributor: Sergej Pupykin <pupykin.s+arch at gmail.com>
+# Contributor: Jan de Groot <jgc at archlinux.org>
+
+pkgname=gst-python
+pkgver=1.18.5
+pkgrel=3
+pkgdesc="Multimedia graph framework - python bindings"
+url="https://gstreamer.freedesktop.org/"
+arch=(x86_64)
+license=(LGPL)
+depends=(python-gobject gst-plugins-base-libs)
+makedepends=(git meson)
+_commit=3d75c6b1eefc1a4190f58ac8d4610535f1acca3f # tags/1.18.5^0
+source=("git+https://gitlab.freedesktop.org/gstreamer/gst-python.git#commit=$_commit"
+ 0001-python-Avoid-treating-float-as-int.patch)
+sha256sums=('SKIP'
+ '62f301faddb4c713bd21b2da95daec9b73b903da168d7c9649550a0678a1ff77')
+
+pkgver() {
+ cd $pkgname
+ git describe --tags | sed 's/-/+/g'
+}
+
+prepare() {
+ cd $pkgname
+ patch -Np3 -i ../0001-python-Avoid-treating-float-as-int.patch
+}
+
+build() {
+ arch-meson $pkgname build
+ meson compile -C build
+}
+
+check() {
+ meson test -C build --print-errorlogs
+}
+
+package() {
+ meson install -C build --destdir "$pkgdir"
+ python -m compileall -d /usr/lib "$pkgdir/usr/lib"
+ python -O -m compileall -d /usr/lib "$pkgdir/usr/lib"
+}
More information about the arch-commits
mailing list