[arch-commits] Commit in shiboken2/trunk (PKGBUILD python310.patch)
Antonio Rojas
arojas at gemini.archlinux.org
Sat Mar 5 12:23:19 UTC 2022
Date: Saturday, March 5, 2022 @ 12:23:18
Author: arojas
Revision: 438954
Update to 5.15.3
Modified:
shiboken2/trunk/PKGBUILD
shiboken2/trunk/python310.patch
-----------------+
PKGBUILD | 22 ++--
python310.patch | 247 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 258 insertions(+), 11 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2022-03-05 12:10:30 UTC (rev 438953)
+++ PKGBUILD 2022-03-05 12:23:18 UTC (rev 438954)
@@ -3,10 +3,10 @@
pkgbase=shiboken2
pkgname=(shiboken2 python-shiboken2)
-_qtver=5.15.2.1
+_qtver=5.15.3
_clangver=13.0.1
pkgver=${_qtver/-/}
-pkgrel=2
+pkgrel=1
arch=(x86_64)
url='https://www.qt.io'
license=(GPL2 LGPL)
@@ -13,13 +13,17 @@
pkgdesc='Generates bindings for C++ libraries using CPython source code'
makedepends=(clang llvm cmake libxslt qt5-xmlpatterns python-sphinx python-wheel)
_pkgfqn=pyside-setup-opensource-src-$_qtver
-source=(https://download.qt.io/official_releases/QtForPython/pyside2/PySide2-$pkgver-src/${_pkgfqn}.tar.gz
+source=(https://download.qt.io/official_releases/QtForPython/pyside2/PySide2-$pkgver-src/${_pkgfqn}.tar.xz
python310.patch)
-sha256sums=('91e78e4e3b31ebb0053c2e4f1029703e578615695450c0dd03072248d713b391'
- '20da52cf2a17da606a2d3aa82eb5ff3ccdb2367b7415289e1e33ac071a73d35b')
+sha256sums=('69481d137d80ed42461cbdb06cee06477f0a8cbe235d61b56472a66ed7982093'
+ '2b45d0707cfe2c60103d0d2679f21100bc5e9a6069cf9fbb2676eda7c5642c29')
+prepare() {
+ patch -d $_pkgfqn -p1 -i ../python310.patch # Fix build with Python 3.10
+}
+
build() {
- cmake -B build -S ${_pkgfqn%.*}/sources/shiboken2 \
+ cmake -B build -S $_pkgfqn/sources/shiboken2 \
-DCMAKE_INSTALL_PREFIX=/usr \
-DBUILD_TESTS=OFF \
-DUSE_PYTHON_VERSION=3
@@ -26,10 +30,6 @@
cmake --build build
}
-prepare() {
- patch -d ${_pkgfqn%.*} -p1 -i ../python310.patch # Fix build with Python 3.10
-}
-
package_shiboken2() {
depends=(clang=$_clangver llvm libxslt qt5-xmlpatterns)
@@ -48,7 +48,7 @@
rm -r "$pkgdir"/usr/{bin,include,lib/{cmake,pkgconfig}}
# Install egg-info
- cd ${_pkgfqn%.*}
+ cd $_pkgfqn
python setup.py egg_info --build-type=shiboken2
_pythonpath=`python -c "from sysconfig import get_path; print(get_path('platlib'))"`
cp -r shiboken2.egg-info "$pkgdir"/$_pythonpath
Modified: python310.patch
===================================================================
--- python310.patch 2022-03-05 12:10:30 UTC (rev 438953)
+++ python310.patch 2022-03-05 12:23:18 UTC (rev 438954)
@@ -1,3 +1,250 @@
+diff --git a/build_scripts/config.py b/build_scripts/config.py
+index b1b32068d..00cbd3fc9 100644
+--- a/build_scripts/config.py
++++ b/build_scripts/config.py
+@@ -93,6 +93,7 @@ class Config(object):
+ 'Programming Language :: Python :: 3.7',
+ 'Programming Language :: Python :: 3.8',
+ 'Programming Language :: Python :: 3.9',
++ 'Programming Language :: Python :: 3.10',
+ ]
+
+ self.setup_script_dir = None
+@@ -135,7 +136,7 @@ class Config(object):
+ setup_kwargs['zip_safe'] = False
+ setup_kwargs['cmdclass'] = cmd_class_dict
+ setup_kwargs['version'] = package_version
+- setup_kwargs['python_requires'] = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <3.10"
++ setup_kwargs['python_requires'] = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <3.11"
+
+ if quiet:
+ # Tells distutils / setuptools to be quiet, and only print warnings or errors.
+diff --git a/build_scripts/wheel_override.py b/build_scripts/wheel_override.py
+index 66141763b..3f3c12a2e 100644
+--- a/build_scripts/wheel_override.py
++++ b/build_scripts/wheel_override.py
+@@ -90,7 +90,7 @@ class PysideBuildWheel(_bdist_wheel, DistUtilsCommandMixin):
+ limited_api_enabled = (OPTION["LIMITED_API"] == 'yes'
+ and sys.version_info[0] >= 3)
+ if limited_api_enabled:
+- self.py_limited_api = "cp35.cp36.cp37.cp38.cp39"
++ self.py_limited_api = "cp35.cp36.cp37.cp38.cp39.cp310"
+
+ self._package_version = get_package_version()
+
+diff --git a/sources/pyside2/libpyside/feature_select.cpp b/sources/pyside2/libpyside/feature_select.cpp
+index 6a21d168d..3da7dde38 100644
+--- a/sources/pyside2/libpyside/feature_select.cpp
++++ b/sources/pyside2/libpyside/feature_select.cpp
+@@ -405,6 +405,8 @@ static inline PyObject *SelectFeatureSet(PyTypeObject *type)
+ if (!SelectFeatureSetSubtype(sub_type, select_id))
+ break;
+ }
++ // PYSIDE-1436: Clear all caches for the type and subtypes.
++ PyType_Modified(type);
+ }
+ return type->tp_dict;
+ }
+diff --git a/sources/pyside2/tests/QtWidgets/signature_test.py b/sources/pyside2/tests/QtWidgets/signature_test.py
+index 57fcf3874..cacb576d7 100644
+--- a/sources/pyside2/tests/QtWidgets/signature_test.py
++++ b/sources/pyside2/tests/QtWidgets/signature_test.py
+@@ -65,8 +65,9 @@ class PySideSignatureTest(unittest.TestCase):
+ for thing in obj.__signature__:
+ self.assertEqual(type(thing), inspect.Signature)
+ sm = PySide2.QtWidgets.QApplication.__dict__["palette"]
+- self.assertFalse(callable(sm))
+- self.assertEqual(sm.__func__, obj)
++ # PYSIDE-1436: staticmethod is a callable since Python 3.10
++ # Instead of checking callable(sm), we check the type:
++ self.assertEqual(type(sm), staticmethod)
+ self.assertTrue(hasattr(sm, "__signature__") and
+ sm.__signature__ is not None)
+
+diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+index 05d9d97d6..38b596a5f 100644
+--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
++++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+@@ -5193,6 +5193,9 @@ void CppGenerator::writeFlagsBinaryOperator(QTextStream &s, const AbstractMetaEn
+ << ">(int(PyLong_AsLong(self)));\n";
+ s << INDENT << "cppArg = static_cast<" << flagsEntry->originalName() << ">(int(PyLong_AsLong("
+ << PYTHON_ARG << ")));\n";
++ // PYSIDE-1436: Need to error check self as well because operators are used
++ // sometimes with swapped args.
++ s << INDENT << "if (PyErr_Occurred())\n" << INDENT << "return nullptr;\n";
+ s << "#else\n";
+ s << INDENT << CPP_SELF_VAR << " = static_cast<::" << flagsEntry->originalName()
+ << ">(int(PyInt_AsLong(self)));\n";
+diff --git a/sources/shiboken2/libshiboken/pep384impl.cpp b/sources/shiboken2/libshiboken/pep384impl.cpp
+index cb8042561..66df0fd94 100644
+--- a/sources/shiboken2/libshiboken/pep384impl.cpp
++++ b/sources/shiboken2/libshiboken/pep384impl.cpp
+@@ -754,11 +754,13 @@ _Pep_PrivateMangle(PyObject *self, PyObject *name)
+ #ifndef Py_LIMITED_API
+ return _Py_Mangle(privateobj, name);
+ #else
+- // For some reason, _Py_Mangle is not in the Limited API. Why?
+- size_t plen = PyUnicode_GET_LENGTH(privateobj);
++ // PYSIDE-1436: _Py_Mangle is no longer exposed; implement it always.
++ // The rest of this function is our own implementation of _Py_Mangle.
++ // Please compare the original function in compile.c .
++ size_t plen = PyUnicode_GET_LENGTH(privateobj.object());
+ /* Strip leading underscores from class name */
+ size_t ipriv = 0;
+- while (PyUnicode_READ_CHAR(privateobj, ipriv) == '_')
++ while (PyUnicode_READ_CHAR(privateobj.object(), ipriv) == '_')
+ ipriv++;
+ if (ipriv == plen) {
+ Py_INCREF(name);
+diff --git a/sources/shiboken2/libshiboken/pep384impl.h b/sources/shiboken2/libshiboken/pep384impl.h
+index 7a6f57fcd..eb65596cc 100644
+--- a/sources/shiboken2/libshiboken/pep384impl.h
++++ b/sources/shiboken2/libshiboken/pep384impl.h
+@@ -40,6 +40,11 @@
+ #ifndef PEP384IMPL_H
+ #define PEP384IMPL_H
+
++// PYSIDE-1436: Adapt to Python 3.10
++#if PY_VERSION_HEX < 0x030900A4
++# define Py_SET_REFCNT(obj, refcnt) ((Py_REFCNT(obj) = (refcnt)), (void)0)
++#endif
++
+ extern "C"
+ {
+
+@@ -327,7 +332,7 @@ LIBSHIBOKEN_API PyObject *PyRun_String(const char *, int, PyObject *, PyObject *
+ // But this is no problem as we check it's validity for every version.
+
+ #define PYTHON_BUFFER_VERSION_COMPATIBLE (PY_VERSION_HEX >= 0x03030000 && \
+- PY_VERSION_HEX < 0x0309FFFF)
++ PY_VERSION_HEX < 0x030AFFFF)
+ #if !PYTHON_BUFFER_VERSION_COMPATIBLE
+ # error Please check the buffer compatibility for this python version!
+ #endif
+diff --git a/sources/shiboken2/libshiboken/sbkstring.cpp b/sources/shiboken2/libshiboken/sbkstring.cpp
+index 918aae756..077fb531b 100644
+--- a/sources/shiboken2/libshiboken/sbkstring.cpp
++++ b/sources/shiboken2/libshiboken/sbkstring.cpp
+@@ -247,7 +247,7 @@ static void finalizeStaticStrings()
+ {
+ auto &set = staticStrings();
+ for (PyObject *ob : set) {
+- Py_REFCNT(ob) = 1;
++ Py_SET_REFCNT(ob, 1);
+ Py_DECREF(ob);
+ }
+ set.clear();
+diff --git a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/lib/tool.py b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/lib/tool.py
+index 24e75e42c..c8dbd51cc 100644
+--- a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/lib/tool.py
++++ b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/lib/tool.py
+@@ -47,6 +47,7 @@ On the function with_metaclass see the answer from Martijn Pieters on
+ https://stackoverflow.com/questions/18513821/python-metaclass-understanding-the-with-metaclass
+ """
+
++from inspect import currentframe
+ from textwrap import dedent
+
+
+@@ -151,4 +152,11 @@ def with_metaclass(meta, *bases):
+ return meta.__prepare__(name, bases)
+ return type.__new__(metaclass, 'temporary_class', (), {})
+
++
++# A handy tool that shows the current line number and indents.
++def lno(level):
++ lineno = currentframe().f_back.f_lineno
++ spaces = level * " "
++ return "{}{}".format(lineno, spaces)
++
+ # eof
+diff --git a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py
+index 6fadd19d5..f701d83c8 100644
+--- a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py
++++ b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py
+@@ -300,6 +300,7 @@ type_map.update({
+ "zero(object)": None,
+ "zero(str)": "",
+ "zero(typing.Any)": None,
++ "zero(Any)": None,
+ })
+
+ type_map.update({
+diff --git a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py
+index 20c791cc1..7200dc270 100644
+--- a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py
++++ b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py
+@@ -43,10 +43,11 @@ import sys
+ import re
+ import warnings
+ import types
++import typing
+ import keyword
+ import functools
+ from shibokensupport.signature.mapping import (type_map, update_mapping,
+- namespace, typing, _NotCalled, ResultVariable, ArrayLikeVariable)
++ namespace, _NotCalled, ResultVariable, ArrayLikeVariable)
+ from shibokensupport.signature.lib.tool import (SimpleNamespace,
+ build_brace_pattern)
+
+@@ -222,7 +223,7 @@ def _resolve_arraytype(thing, line):
+ def to_string(thing):
+ if isinstance(thing, str):
+ return thing
+- if hasattr(thing, "__name__"):
++ if hasattr(thing, "__name__") and thing.__module__ != "typing":
+ dot = "." in str(thing)
+ name = get_name(thing)
+ return thing.__module__ + "." + name if dot else name
+@@ -239,16 +240,6 @@ def handle_matrix(arg):
+ return eval(result, namespace)
+
+
+-debugging_aid = """
+-from inspect import currentframe
+-
+-def lno(level):
+- lineno = currentframe().f_back.f_lineno
+- spaces = level * " "
+- return "{lineno}{spaces}".format(**locals())
+-"""
+-
+-
+ def _resolve_type(thing, line, level, var_handler):
+ # Capture total replacements, first. Happens in
+ # "PySide2.QtCore.QCborStreamReader.StringResult[PySide2.QtCore.QByteArray]"
+diff --git a/sources/shiboken2/tests/samplebinding/time_test.py b/sources/shiboken2/tests/samplebinding/time_test.py
+index f8b35e7b7..3b8f232c7 100644
+--- a/sources/shiboken2/tests/samplebinding/time_test.py
++++ b/sources/shiboken2/tests/samplebinding/time_test.py
+@@ -130,6 +130,7 @@ class TimeTest(unittest.TestCase):
+ result = time.somethingCompletelyDifferent(1, 2, ImplicitConv.CtorOne)
+ self.assertEqual(result, Time.ThreeArgs)
+
++ # PYSIDE-1436: These tests crash at shutdown due to `assert(Not)?Equal`.
+ def testCompareWithPythonTime(self):
+ time = Time(12, 32, 5)
+ py = datetime.time(12, 32, 5)
+diff --git a/sources/shiboken2/tests/samplebinding/typesystem_sample.xml b/sources/shiboken2/tests/samplebinding/typesystem_sample.xml
+index 595afb9ae..70fabcf73 100644
+--- a/sources/shiboken2/tests/samplebinding/typesystem_sample.xml
++++ b/sources/shiboken2/tests/samplebinding/typesystem_sample.xml
+@@ -1953,6 +1953,7 @@
+ %PYARG_0 = Py_False;
+ else
+ %PYARG_0 = Py_True;
++ Py_INCREF(%PYARG_0);
+ }
+ </inject-code>
+ </add-function>
+@@ -1970,6 +1971,7 @@
+ %PYARG_0 = Py_True;
+ else
+ %PYARG_0 = Py_False;
++ Py_INCREF(%PYARG_0);
+ }
+ </inject-code>
+ </add-function>
diff -upr pyside-setup-opensource-src-5.15.2.orig/sources/shiboken2/libshiboken/pep384impl.cpp pyside-setup-opensource-src-5.15.2/sources/shiboken2/libshiboken/pep384impl.cpp
--- pyside-setup-opensource-src-5.15.2.orig/sources/shiboken2/libshiboken/pep384impl.cpp 2020-11-11 14:51:30.000000000 +0200
+++ pyside-setup-opensource-src-5.15.2/sources/shiboken2/libshiboken/pep384impl.cpp 2021-12-01 15:17:21.444888977 +0200
More information about the arch-commits
mailing list