[arch-commits] Commit in shiboken2/repos (4 files)

Evangelos Foutras foutrelis at gemini.archlinux.org
Tue Nov 30 22:30:49 UTC 2021


    Date: Tuesday, November 30, 2021 @ 22:30:49
  Author: foutrelis
Revision: 429852

archrelease: copy trunk to staging-x86_64

Added:
  shiboken2/repos/staging-x86_64/
  shiboken2/repos/staging-x86_64/PKGBUILD
    (from rev 429851, shiboken2/trunk/PKGBUILD)
  shiboken2/repos/staging-x86_64/python3.10.patch
    (from rev 429851, shiboken2/trunk/python3.10.patch)
  shiboken2/repos/staging-x86_64/python_ver_classifier.patch
    (from rev 429851, shiboken2/trunk/python_ver_classifier.patch)

-----------------------------+
 PKGBUILD                    |   62 ++++++++++++++
 python3.10.patch            |  181 ++++++++++++++++++++++++++++++++++++++++++
 python_ver_classifier.patch |   21 ++++
 3 files changed, 264 insertions(+)

Copied: shiboken2/repos/staging-x86_64/PKGBUILD (from rev 429851, shiboken2/trunk/PKGBUILD)
===================================================================
--- staging-x86_64/PKGBUILD	                        (rev 0)
+++ staging-x86_64/PKGBUILD	2021-11-30 22:30:49 UTC (rev 429852)
@@ -0,0 +1,62 @@
+# Maintainer: Antonio Rojas <arojas at archlinux.org>
+# Maintainer: Felix Yan <felixonmars at archlinux.org>
+
+pkgbase=shiboken2
+pkgname=(shiboken2 python-shiboken2)
+_qtver=5.15.2
+_clangver=13.0.0
+pkgver=${_qtver/-/}
+pkgrel=11
+arch=(x86_64)
+url='https://www.qt.io'
+license=(GPL2 LGPL)
+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.xz"
+        python3.10.patch
+        python_ver_classifier.patch)
+sha256sums=('b306504b0b8037079a8eab772ee774b9e877a2d84bab2dbefbe4fa6f83941418'
+            'dd18a7ed1d4196b48ddfd7cf1dcbebe4c600dcedb45baba4c852131e221cf4bc'
+            '6acf282b18b6881d313b398991b7871b4ccacc45d88c7abde064da3a5a501bac')
+
+prepare() {
+  cd ${_pkgfqn}
+
+  # Fix build with Python 3.10 (patches from Fedora)
+  patch -Np1 -i ../python3.10.patch
+  patch -Np1 -i ../python_ver_classifier.patch
+}
+
+build() {
+  cmake -B build -S ${_pkgfqn}/sources/shiboken2 \
+    -DCMAKE_INSTALL_PREFIX=/usr \
+    -DBUILD_TESTS=OFF \
+    -DUSE_PYTHON_VERSION=3
+  cmake --build build
+}
+
+package_shiboken2() {
+  depends=(clang=$_clangver llvm libxslt qt5-xmlpatterns)
+
+  DESTDIR="$pkgdir" cmake --install build
+# Provided in python-shiboken2
+  rm -r "$pkgdir"/usr/lib/{python*,libshiboken*}
+# Conflicts with shiboken6 and doesn't work anyway
+  rm "$pkgdir"/usr/bin/shiboken_tool.py
+}
+
+package_python-shiboken2() {
+  depends=(python)
+
+  DESTDIR="$pkgdir" cmake --install build
+# Provided in shiboken2
+  rm -r "$pkgdir"/usr/{bin,include,lib/{cmake,pkgconfig}}
+
+# Install egg-info
+  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
+}

Copied: shiboken2/repos/staging-x86_64/python3.10.patch (from rev 429851, shiboken2/trunk/python3.10.patch)
===================================================================
--- staging-x86_64/python3.10.patch	                        (rev 0)
+++ staging-x86_64/python3.10.patch	2021-11-30 22:30:49 UTC (rev 429852)
@@ -0,0 +1,181 @@
+diff --git a/sources/pyside2/tests/QtCore/qenum_test.py b/sources/pyside2/tests/QtCore/qenum_test.py
+index f99a893..45e8efa 100644
+--- a/sources/pyside2/tests/QtCore/qenum_test.py
++++ b/sources/pyside2/tests/QtCore/qenum_test.py
+@@ -195,16 +195,18 @@ class SomeClass(QObject):
+     QEnum(SomeEnum)     # works even without the decorator assignment
+ 
+ 
++ENUM_META = "EnumMeta" if sys.version_info < (3, 10) else "EnumType"
++
+ @unittest.skipUnless(HAVE_ENUM, "requires 'enum' module (use 'pip install enum34' for Python 2)")
+ class TestQEnumMacro(unittest.TestCase):
+     def testTopLevel(self):
+         self.assertEqual(type(OuterEnum).__module__, "enum")
+-        self.assertEqual(type(OuterEnum).__name__, "EnumMeta")
++        self.assertEqual(type(OuterEnum).__name__, ENUM_META)
+         self.assertEqual(len(OuterEnum.__members__), 2)
+ 
+     def testSomeClass(self):
+         self.assertEqual(type(SomeClass.SomeEnum).__module__, "enum")
+-        self.assertEqual(type(SomeClass.SomeEnum).__name__, "EnumMeta")
++        self.assertEqual(type(SomeClass.SomeEnum).__name__, ENUM_META)
+         self.assertEqual(len(SomeClass.SomeEnum.__members__), 3)
+         with self.assertRaises(TypeError):
+             int(SomeClass.SomeEnum.C) == 6
+diff --git a/sources/shiboken2/libshiboken/pep384impl.cpp b/sources/shiboken2/libshiboken/pep384impl.cpp
+index cb80425..c4e7301 100644
+--- a/sources/shiboken2/libshiboken/pep384impl.cpp
++++ b/sources/shiboken2/libshiboken/pep384impl.cpp
+@@ -707,6 +707,76 @@ PyObject *PepMapping_Items(PyObject *o)
+  *
+  */
+ 
++#if PY_VERSION_HEX >= 0x03000000
++PyObject *
++_Py_Mangle(PyObject *privateobj, PyObject *ident)
++{
++    /* Name mangling: __private becomes _classname__private.
++       This is independent from how the name is used. */
++    PyObject *result;
++    size_t nlen, plen, ipriv;
++    Py_UCS4 maxchar;
++    if (privateobj == NULL || !PyUnicode_Check(privateobj) ||
++        PyUnicode_READ_CHAR(ident, 0) != '_' ||
++        PyUnicode_READ_CHAR(ident, 1) != '_') {
++        Py_INCREF(ident);
++        return ident;
++    }
++    nlen = PyUnicode_GET_LENGTH(ident);
++    plen = PyUnicode_GET_LENGTH(privateobj);
++    /* Don't mangle __id__ or names with dots.
++
++       The only time a name with a dot can occur is when
++       we are compiling an import statement that has a
++       package name.
++
++       TODO(jhylton): Decide whether we want to support
++       mangling of the module name, e.g. __M.X.
++    */
++    if ((PyUnicode_READ_CHAR(ident, nlen-1) == '_' &&
++         PyUnicode_READ_CHAR(ident, nlen-2) == '_') ||
++        PyUnicode_FindChar(ident, '.', 0, nlen, 1) != -1) {
++        Py_INCREF(ident);
++        return ident; /* Don't mangle __whatever__ */
++    }
++    /* Strip leading underscores from class name */
++    ipriv = 0;
++    while (PyUnicode_READ_CHAR(privateobj, ipriv) == '_')
++        ipriv++;
++    if (ipriv == plen) {
++        Py_INCREF(ident);
++        return ident; /* Don't mangle if class is just underscores */
++    }
++    plen -= ipriv;
++
++    if (plen + nlen >= PY_SSIZE_T_MAX - 1) {
++        PyErr_SetString(PyExc_OverflowError,
++                        "private identifier too large to be mangled");
++        return NULL;
++    }
++
++    maxchar = PyUnicode_MAX_CHAR_VALUE(ident);
++    if (PyUnicode_MAX_CHAR_VALUE(privateobj) > maxchar)
++        maxchar = PyUnicode_MAX_CHAR_VALUE(privateobj);
++
++    result = PyUnicode_New(1 + nlen + plen, maxchar);
++    if (!result)
++        return 0;
++    /* ident = "_" + priv[ipriv:] + ident # i.e. 1+plen+nlen bytes */
++    PyUnicode_WRITE(PyUnicode_KIND(result), PyUnicode_DATA(result), 0, '_');
++    if (PyUnicode_CopyCharacters(result, 1, privateobj, ipriv, plen) < 0) {
++        Py_DECREF(result);
++        return NULL;
++    }
++    if (PyUnicode_CopyCharacters(result, plen+1, ident, 0, nlen) < 0) {
++        Py_DECREF(result);
++        return NULL;
++    }
++    assert(_PyUnicode_CheckConsistency(result, 1));
++    return result;
++}
++#endif
++
+ #ifdef Py_LIMITED_API
+ // We keep these definitions local, because they don't work in Python 2.
+ # define PyUnicode_GET_LENGTH(op)    PyUnicode_GetLength((PyObject *)(op))
+diff --git a/sources/shiboken2/libshiboken/pep384impl.h b/sources/shiboken2/libshiboken/pep384impl.h
+index 7a6f57f..eb65596 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 918aae7..2ac3f5c 100644
+--- a/sources/shiboken2/libshiboken/sbkstring.cpp
++++ b/sources/shiboken2/libshiboken/sbkstring.cpp
+@@ -233,6 +233,8 @@ Py_ssize_t len(PyObject *str)
+ //     PyObject *attr = PyObject_GetAttr(obj, name());
+ //
+ 
++#if PY_VERSION_HEX < 0x030A0000
++
+ using StaticStrings = std::unordered_set<PyObject *>;
+ 
+ static void finalizeStaticStrings();    // forward
+@@ -247,19 +249,23 @@ static void finalizeStaticStrings()
+ {
+     auto &set = staticStrings();
+     for (PyObject *ob : set) {
+-        Py_REFCNT(ob) = 1;
++        Py_SET_REFCNT(ob, 1);
+         Py_DECREF(ob);
+     }
+     set.clear();
+ }
+ 
++#endif // PY_VERSION_HEX < 0x030A0000
++
+ PyObject *createStaticString(const char *str)
+ {
++#if PY_VERSION_HEX < 0x030A0000
+     static bool initialized = false;
+     if (!initialized) {
+         Py_AtExit(finalizeStaticStrings);
+         initialized = true;
+     }
++#endif // PY_VERSION_HEX < 0x030A0000
+ #if PY_VERSION_HEX >= 0x03000000
+     PyObject *result = PyUnicode_InternFromString(str);
+ #else
+@@ -270,9 +276,11 @@ PyObject *createStaticString(const char *str)
+         PyErr_Print();
+         Py_FatalError("unexpected error in createStaticString()");
+     }
++#if PY_VERSION_HEX < 0x030A0000
+     auto it = staticStrings().find(result);
+     if (it == staticStrings().end())
+         staticStrings().insert(result);
++#endif // PY_VERSION_HEX < 0x030A0000
+     /*
+      * Note: We always add one reference even if we have a new string.
+      *       This makes the strings immortal, and we are safe if someone

Copied: shiboken2/repos/staging-x86_64/python_ver_classifier.patch (from rev 429851, shiboken2/trunk/python_ver_classifier.patch)
===================================================================
--- staging-x86_64/python_ver_classifier.patch	                        (rev 0)
+++ staging-x86_64/python_ver_classifier.patch	2021-11-30 22:30:49 UTC (rev 429852)
@@ -0,0 +1,21 @@
+Index: pyside-setup-opensource-src-5.15.2/build_scripts/config.py
+===================================================================
+--- pyside-setup-opensource-src-5.15.2.orig/build_scripts/config.py
++++ pyside-setup-opensource-src-5.15.2/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.



More information about the arch-commits mailing list