lol

Update pyside2/shiboken2 and sip4 to Python 3.12

These are both Python QT 5 modules, which have issues with Python 3.12
that are fixed in never versions, yet many packages depend on them.

Sip4 was as simple as installing and switching over to setuptools (to
replace the now removed distutils).

pyside/shiboken was much more involved. I ended up pulling the required
patches from the Ubuntu release repositories. The existing patch to fix
clang's include headers needed an update as well, but was still
required.

There is some unsightly find-and-replace going on to replace distutils
with setuptools. This is because, although setuptools now creates the
"distutils" import module, it has to be itself imported first before
that can happen. I Used this widespread find-and-replace as it does
function properly, and should be extremly flexable for future versions
(no needing to update patches on each release).

+1238 -49
+28
pkgs/development/python-modules/pyside2/Final-details-to-enable-3.12-wheel-compatibility.patch
··· 1 + From: =?utf-8?q?Cristi=C3=A1n_Maureira-Fredes?= 2 + <Cristian.Maureira-Fredes@qt.io> 3 + Date: Tue, 10 Oct 2023 15:52:09 +0200 4 + Subject: Final details to enable 3.12 wheel compatibility 5 + 6 + Change-Id: I0252c4e73e8c214ef8aa418ddf88bc452c0fdf53 7 + Pick-to: 6.6 8 + Task-number: PYSIDE-2230 9 + Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> 10 + (cherry picked from commit 6c7bb7b6e1008909e49bc04d2a48024309a784cc) 11 + --- 12 + build_scripts/config.py | 2 +- 13 + 1 file changed, 1 insertion(+), 1 deletion(-) 14 + 15 + diff --git a/build_scripts/config.py b/build_scripts/config.py 16 + index 5fc23d4..fb27394 100644 17 + --- a/build_scripts/config.py 18 + +++ b/build_scripts/config.py 19 + @@ -138,7 +138,7 @@ class Config(object): 20 + setup_kwargs['zip_safe'] = False 21 + setup_kwargs['cmdclass'] = cmd_class_dict 22 + setup_kwargs['version'] = package_version 23 + - setup_kwargs['python_requires'] = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <3.12" 24 + + setup_kwargs['python_requires'] = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <3.13" 25 + 26 + if quiet: 27 + # Tells distutils / setuptools to be quiet, and only print warnings or errors. 28 +
+41
pkgs/development/python-modules/pyside2/Modify-sendCommand-signatures.patch
··· 1 + From: Dmitry Shachnev <mitya57@debian.org> 2 + Date: Sun, 4 Feb 2024 00:29:00 +0300 3 + Subject: Modify sendCommand signatures to use 0 as default value 4 + 5 + The original default value was QNodeCommand::CommandId(), and shiboken 6 + copies it verbatim from the header file, however it does not work because 7 + we do not generate "using namespace Qt3DCore;". 8 + 9 + 0 is the same as QNodeCommand::CommandId(). 10 + --- 11 + sources/pyside2/PySide2/Qt3DCore/typesystem_3dcore.xml | 10 ++++++++++ 12 + 1 file changed, 10 insertions(+) 13 + 14 + diff --git a/sources/pyside2/PySide2/Qt3DCore/typesystem_3dcore.xml b/sources/pyside2/PySide2/Qt3DCore/typesystem_3dcore.xml 15 + index 8696a12..310595f 100644 16 + --- a/sources/pyside2/PySide2/Qt3DCore/typesystem_3dcore.xml 17 + +++ b/sources/pyside2/PySide2/Qt3DCore/typesystem_3dcore.xml 18 + @@ -58,6 +58,11 @@ 19 + <object-type name="QAspectJob"/> 20 + <object-type name="QBackendNode"> 21 + <enum-type name="Mode"/> 22 + + <modify-function signature="sendCommand(const QString&amp;,const QVariant&amp;,unsigned long long)"> 23 + + <modify-argument index="3"> 24 + + <replace-default-expression with="0"/> 25 + + </modify-argument> 26 + + </modify-function> 27 + </object-type> 28 + <!-- TODO: Solve issues related to windows and a unresolved 29 + external symbol 30 + @@ -82,6 +87,11 @@ 31 + </object-type> 32 + <object-type name="QNode"> 33 + <enum-type name="PropertyTrackingMode"/> 34 + + <modify-function signature="sendCommand(const QString&amp;,const QVariant&amp;,unsigned long long)"> 35 + + <modify-argument index="3"> 36 + + <replace-default-expression with="0"/> 37 + + </modify-argument> 38 + + </modify-function> 39 + </object-type> 40 + <object-type name="QNodeCommand" since="5.10"/> 41 + <object-type name="QNodeCreatedChangeBase"/>
+37
pkgs/development/python-modules/pyside2/Python-3.12-Fix-the-structure-of-class-property.patch
··· 1 + From: Christian Tismer <tismer@stackless.com> 2 + Date: Tue, 14 Feb 2023 14:46:22 +0100 3 + Subject: Python 3.12: Fix the structure of class property 4 + 5 + There is a PySide bug in Python 3.10 already: The structure for 6 + classproperty derives from the property structure. This was extended 7 + in Python 3.10, already, but the type generation check was made more 8 + exhaustive in Python 3.12 and recognized that. 9 + 10 + This change is only for making the compiler/C API happy. 11 + In order to use the extension field, it is necessary to do a runtime 12 + check because of the Limited API. 13 + 14 + Task-number: PYSIDE-2230 15 + Change-Id: I88dcaa11589ff41852f08fa2defa5200a0dd4eb6 16 + Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> 17 + Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> 18 + (cherry picked from commit edfd9a5ad174a48f8d7da511dc6a1c69e931a418) 19 + --- 20 + sources/pyside2/libpyside/feature_select.cpp | 5 +++++ 21 + 1 file changed, 5 insertions(+) 22 + 23 + diff --git a/sources/pyside2/libpyside/feature_select.cpp b/sources/pyside2/libpyside/feature_select.cpp 24 + index 3011b35..b9e1470 100644 25 + --- a/sources/pyside2/libpyside/feature_select.cpp 26 + +++ b/sources/pyside2/libpyside/feature_select.cpp 27 + @@ -671,6 +671,11 @@ typedef struct { 28 + PyObject *prop_set; 29 + PyObject *prop_del; 30 + PyObject *prop_doc; 31 + +#if PY_VERSION_HEX >= 0x030A0000 32 + + // Note: This is a problem with Limited API: We have no direct access. 33 + + // You need to pick it from runtime info. 34 + + PyObject *prop_name; 35 + +#endif 36 + int getter_doc; 37 + } propertyobject;
+298
pkgs/development/python-modules/pyside2/Support-running-PySide-on-Python-3.12.patch
··· 1 + From: Christian Tismer <tismer@stackless.com> 2 + Date: Tue, 14 Feb 2023 14:46:22 +0100 3 + Subject: Support running PySide on Python 3.12 4 + 5 + Builtin types no longer have tp_dict set. We need to 6 + use PyType_GetDict, instead. This works without Limited API 7 + at the moment. 8 + 9 + With some great cheating, this works with Limited API, too. 10 + We emulate PyType_GetDict by tp_dict if that is not 0. 11 + Otherwise we create an empty dict. 12 + 13 + Some small changes to Exception handling and longer 14 + warm-up in leaking tests were found, too. 15 + 16 + Pick-to: 6.6 6.5 6.2 17 + Task-number: PYSIDE-2230 18 + Change-Id: I8a56de6208ec00979255b39b5784dfc9b4b92def 19 + Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> 20 + (cherry picked from commit 441ffbd4fc622e67acd81e9c1c6d3a0b0fbcacf0) 21 + --- 22 + build_scripts/config.py | 3 +- 23 + sources/pyside2/PySide2/support/generate_pyi.py | 8 ++++-- 24 + sources/pyside2/libpyside/feature_select.cpp | 10 ++++--- 25 + sources/pyside2/libpyside/pysideproperty.cpp | 4 +-- 26 + sources/pyside2/libpyside/pysidesignal.cpp | 4 +-- 27 + sources/pyside2/tests/QtWidgets/bug_662.py | 3 +- 28 + sources/pyside2/tests/signals/bug_79.py | 5 ++++ 29 + sources/shiboken2/libshiboken/pep384impl.cpp | 33 ++++++++++++++++++++++ 30 + sources/shiboken2/libshiboken/pep384impl.h | 8 ++++++ 31 + .../shiboken2/libshiboken/signature/signature.cpp | 2 +- 32 + .../libshiboken/signature/signature_helper.cpp | 6 ++-- 33 + .../shibokensupport/signature/errorhandler.py | 6 ++++ 34 + sources/shiboken2/tests/samplebinding/enum_test.py | 2 +- 35 + 13 files changed, 78 insertions(+), 16 deletions(-) 36 + 37 + diff --git a/build_scripts/config.py b/build_scripts/config.py 38 + index f2b4c40..5fc23d4 100644 39 + --- a/build_scripts/config.py 40 + +++ b/build_scripts/config.py 41 + @@ -94,7 +94,8 @@ class Config(object): 42 + 'Programming Language :: Python :: 3.8', 43 + 'Programming Language :: Python :: 3.9', 44 + 'Programming Language :: Python :: 3.10', 45 + - 'Programming Language :: Python :: 3.11' 46 + + 'Programming Language :: Python :: 3.11', 47 + + 'Programming Language :: Python :: 3.12', 48 + ] 49 + 50 + self.setup_script_dir = None 51 + diff --git a/sources/pyside2/PySide2/support/generate_pyi.py b/sources/pyside2/PySide2/support/generate_pyi.py 52 + index 1956533..fd05b1f 100644 53 + --- a/sources/pyside2/PySide2/support/generate_pyi.py 54 + +++ b/sources/pyside2/PySide2/support/generate_pyi.py 55 + @@ -116,8 +116,12 @@ class Formatter(Writer): 56 + """ 57 + def _typevar__repr__(self): 58 + return "typing." + self.__name__ 59 + - typing.TypeVar.__repr__ = _typevar__repr__ 60 + - 61 + + # This is no longer necessary for modern typing versions. 62 + + # Ignore therefore if the repr is read-only and cannot be changed. 63 + + try: 64 + + typing.TypeVar.__repr__ = _typevar__repr__ 65 + + except TypeError: 66 + + pass 67 + # Adding a pattern to substitute "Union[T, NoneType]" by "Optional[T]" 68 + # I tried hard to replace typing.Optional by a simple override, but 69 + # this became _way_ too much. 70 + diff --git a/sources/pyside2/libpyside/feature_select.cpp b/sources/pyside2/libpyside/feature_select.cpp 71 + index b9e1470..533c09d 100644 72 + --- a/sources/pyside2/libpyside/feature_select.cpp 73 + +++ b/sources/pyside2/libpyside/feature_select.cpp 74 + @@ -358,7 +358,8 @@ static bool SelectFeatureSetSubtype(PyTypeObject *type, PyObject *select_id) 75 + * This is the selector for one sublass. We need to call this for 76 + * every subclass until no more subclasses or reaching the wanted id. 77 + */ 78 + - if (Py_TYPE(type->tp_dict) == Py_TYPE(PyType_Type.tp_dict)) { 79 + + static const auto *pyTypeType_tp_dict = PepType_GetDict(&PyType_Type); 80 + + if (Py_TYPE(type->tp_dict) == Py_TYPE(pyTypeType_tp_dict)) { 81 + // On first touch, we initialize the dynamic naming. 82 + // The dict type will be replaced after the first call. 83 + if (!replaceClassDict(type)) { 84 + @@ -385,7 +386,8 @@ static inline PyObject *SelectFeatureSet(PyTypeObject *type) 85 + * Generated functions call this directly. 86 + * Shiboken will assign it via a public hook of `basewrapper.cpp`. 87 + */ 88 + - if (Py_TYPE(type->tp_dict) == Py_TYPE(PyType_Type.tp_dict)) { 89 + + static const auto *pyTypeType_tp_dict = PepType_GetDict(&PyType_Type); 90 + + if (Py_TYPE(type->tp_dict) == Py_TYPE(pyTypeType_tp_dict)) { 91 + // We initialize the dynamic features by using our own dict type. 92 + if (!replaceClassDict(type)) 93 + return nullptr; 94 + @@ -721,11 +723,11 @@ static bool patch_property_impl() 95 + // Turn `__doc__` into a computed attribute without changing writability. 96 + auto gsp = property_getset; 97 + auto type = &PyProperty_Type; 98 + - auto dict = type->tp_dict; 99 + + AutoDecRef dict(PepType_GetDict(type)); 100 + AutoDecRef descr(PyDescr_NewGetSet(type, gsp)); 101 + if (descr.isNull()) 102 + return false; 103 + - if (PyDict_SetItemString(dict, gsp->name, descr) < 0) 104 + + if (PyDict_SetItemString(dict.object(), gsp->name, descr) < 0) 105 + return false; 106 + // Replace property_descr_get/set by slightly changed versions 107 + return true; 108 + diff --git a/sources/pyside2/libpyside/pysideproperty.cpp b/sources/pyside2/libpyside/pysideproperty.cpp 109 + index 86909d3..d2e2c68 100644 110 + --- a/sources/pyside2/libpyside/pysideproperty.cpp 111 + +++ b/sources/pyside2/libpyside/pysideproperty.cpp 112 + @@ -445,8 +445,8 @@ namespace { 113 + 114 + static PyObject *getFromType(PyTypeObject *type, PyObject *name) 115 + { 116 + - PyObject *attr = nullptr; 117 + - attr = PyDict_GetItem(type->tp_dict, name); 118 + + AutoDecRef tpDict(PepType_GetDict(type)); 119 + + auto *attr = PyDict_GetItem(tpDict.object(), name); 120 + if (!attr) { 121 + PyObject *bases = type->tp_bases; 122 + int size = PyTuple_GET_SIZE(bases); 123 + diff --git a/sources/pyside2/libpyside/pysidesignal.cpp b/sources/pyside2/libpyside/pysidesignal.cpp 124 + index 6824a71..f15d7aa 100644 125 + --- a/sources/pyside2/libpyside/pysidesignal.cpp 126 + +++ b/sources/pyside2/libpyside/pysidesignal.cpp 127 + @@ -670,8 +670,8 @@ void updateSourceObject(PyObject *source) 128 + Py_ssize_t pos = 0; 129 + PyObject *value; 130 + PyObject *key; 131 + - 132 + - while (PyDict_Next(objType->tp_dict, &pos, &key, &value)) { 133 + + Shiboken::AutoDecRef tpDict(PepType_GetDict(objType)); 134 + + while (PyDict_Next(tpDict, &pos, &key, &value)) { 135 + if (PyObject_TypeCheck(value, PySideSignalTypeF())) { 136 + Shiboken::AutoDecRef signalInstance(reinterpret_cast<PyObject *>(PyObject_New(PySideSignalInstance, PySideSignalInstanceTypeF()))); 137 + instanceInitialize(signalInstance.cast<PySideSignalInstance *>(), key, reinterpret_cast<PySideSignal *>(value), source, 0); 138 + diff --git a/sources/pyside2/tests/QtWidgets/bug_662.py b/sources/pyside2/tests/QtWidgets/bug_662.py 139 + index 7fb97de..ec0e6f9 100644 140 + --- a/sources/pyside2/tests/QtWidgets/bug_662.py 141 + +++ b/sources/pyside2/tests/QtWidgets/bug_662.py 142 + @@ -40,7 +40,8 @@ from PySide2.QtWidgets import QTextEdit, QApplication 143 + import sys 144 + 145 + class testQTextBlock(unittest.TestCase): 146 + - def tesIterator(self): 147 + + 148 + + def testIterator(self): 149 + edit = QTextEdit() 150 + cursor = edit.textCursor() 151 + fmt = QTextCharFormat() 152 + diff --git a/sources/pyside2/tests/signals/bug_79.py b/sources/pyside2/tests/signals/bug_79.py 153 + index ca25fb3..b70c8c5 100644 154 + --- a/sources/pyside2/tests/signals/bug_79.py 155 + +++ b/sources/pyside2/tests/signals/bug_79.py 156 + @@ -60,6 +60,11 @@ class ConnectTest(unittest.TestCase): 157 + gc.collect() 158 + # if this is no debug build, then we check at least that 159 + # we do not crash any longer. 160 + + for idx in range(200): 161 + + # PYSIDE-2230: Warm-up is necessary before measuring, because 162 + + # the code changes the constant parts after some time. 163 + + o.selectionModel().destroyed.connect(self.callback) 164 + + o.selectionModel().destroyed.disconnect(self.callback) 165 + if not skiptest: 166 + total = gettotalrefcount() 167 + for idx in range(1000): 168 + diff --git a/sources/shiboken2/libshiboken/pep384impl.cpp b/sources/shiboken2/libshiboken/pep384impl.cpp 169 + index d12dae3..fed2716 100644 170 + --- a/sources/shiboken2/libshiboken/pep384impl.cpp 171 + +++ b/sources/shiboken2/libshiboken/pep384impl.cpp 172 + @@ -810,6 +810,39 @@ init_PepRuntime() 173 + PepRuntime_38_flag = 1; 174 + } 175 + 176 + +#ifdef Py_LIMITED_API 177 + +static PyObject *emulatePyType_GetDict(PyTypeObject *type) 178 + +{ 179 + + if (_PepRuntimeVersion() < 0x030C00 || type->tp_dict) { 180 + + auto *res = type->tp_dict; 181 + + Py_XINCREF(res); 182 + + return res; 183 + + } 184 + + // PYSIDE-2230: Here we are really cheating. We don't know how to 185 + + // access an internal dict, and so we simply pretend 186 + + // it were an empty dict. This works great for our types. 187 + + // This was an unexpectedly simple solution :D 188 + + return PyDict_New(); 189 + +} 190 + +#endif 191 + + 192 + +// PyType_GetDict: replacement for <static type>.tp_dict, which is 193 + +// zero for builtin types since 3.12. 194 + +PyObject *PepType_GetDict(PyTypeObject *type) 195 + +{ 196 + +#if !defined(Py_LIMITED_API) 197 + +# if PY_VERSION_HEX >= 0x030C0000 198 + + return PyType_GetDict(type); 199 + +# else 200 + + // pre 3.12 fallback code, mimicking the addref-behavior. 201 + + Py_XINCREF(type->tp_dict); 202 + + return type->tp_dict; 203 + +# endif 204 + +#else 205 + + return emulatePyType_GetDict(type); 206 + +#endif // Py_LIMITED_API 207 + +} 208 + + 209 + /***************************************************************************** 210 + * 211 + * Module Initialization 212 + diff --git a/sources/shiboken2/libshiboken/pep384impl.h b/sources/shiboken2/libshiboken/pep384impl.h 213 + index a870d6b..440784e 100644 214 + --- a/sources/shiboken2/libshiboken/pep384impl.h 215 + +++ b/sources/shiboken2/libshiboken/pep384impl.h 216 + @@ -567,6 +567,14 @@ extern LIBSHIBOKEN_API PyObject *PepMapping_Items(PyObject *o); 217 + 218 + extern LIBSHIBOKEN_API int PepRuntime_38_flag; 219 + 220 + +/***************************************************************************** 221 + + * 222 + + * Runtime support for Python 3.12 incompatibility 223 + + * 224 + + */ 225 + + 226 + +LIBSHIBOKEN_API PyObject *PepType_GetDict(PyTypeObject *type); 227 + + 228 + /***************************************************************************** 229 + * 230 + * Module Initialization 231 + diff --git a/sources/shiboken2/libshiboken/signature/signature.cpp b/sources/shiboken2/libshiboken/signature/signature.cpp 232 + index 191af3d..f817e47 100644 233 + --- a/sources/shiboken2/libshiboken/signature/signature.cpp 234 + +++ b/sources/shiboken2/libshiboken/signature/signature.cpp 235 + @@ -482,7 +482,7 @@ static PyObject *adjustFuncName(const char *func_name) 236 + 237 + // Find the feature flags 238 + auto type = reinterpret_cast<PyTypeObject *>(obtype.object()); 239 + - auto dict = type->tp_dict; 240 + + AutoDecRef dict(PepType_GetDict(type)); 241 + int id = SbkObjectType_GetReserved(type); 242 + id = id < 0 ? 0 : id; // if undefined, set to zero 243 + auto lower = id & 0x01; 244 + diff --git a/sources/shiboken2/libshiboken/signature/signature_helper.cpp b/sources/shiboken2/libshiboken/signature/signature_helper.cpp 245 + index 0246ec6..05eaa14 100644 246 + --- a/sources/shiboken2/libshiboken/signature/signature_helper.cpp 247 + +++ b/sources/shiboken2/libshiboken/signature/signature_helper.cpp 248 + @@ -105,7 +105,8 @@ int add_more_getsets(PyTypeObject *type, PyGetSetDef *gsp, PyObject **doc_descr) 249 + */ 250 + assert(PyType_Check(type)); 251 + PyType_Ready(type); 252 + - PyObject *dict = type->tp_dict; 253 + + AutoDecRef tpDict(PepType_GetDict(type)); 254 + + auto *dict = tpDict.object(); 255 + for (; gsp->name != nullptr; gsp++) { 256 + PyObject *have_descr = PyDict_GetItemString(dict, gsp->name); 257 + if (have_descr != nullptr) { 258 + @@ -346,7 +347,8 @@ static int _build_func_to_type(PyObject *obtype) 259 + * We also check for hidden methods, see below. 260 + */ 261 + auto *type = reinterpret_cast<PyTypeObject *>(obtype); 262 + - PyObject *dict = type->tp_dict; 263 + + AutoDecRef tpDict(PepType_GetDict(type)); 264 + + auto *dict = tpDict.object(); 265 + PyMethodDef *meth = type->tp_methods; 266 + 267 + if (meth == nullptr) 268 + diff --git a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py 269 + index 47ab89a..3e1266c 100644 270 + --- a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py 271 + +++ b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py 272 + @@ -113,6 +113,12 @@ def seterror_argument(args, func_name, info): 273 + msg = "{func_name}(): {info}".format(**locals()) 274 + err = AttributeError 275 + return err, msg 276 + + if isinstance(info, Exception): 277 + + # PYSIDE-2230: Python 3.12 seems to always do normalization. 278 + + err = type(info) 279 + + info = info.args[0] 280 + + msg = f"{func_name}(): {info}" 281 + + return err, msg 282 + if info and type(info) is dict: 283 + keyword = tuple(info)[0] 284 + msg = "{func_name}(): unsupported keyword '{keyword}'".format(**locals()) 285 + diff --git a/sources/shiboken2/tests/samplebinding/enum_test.py b/sources/shiboken2/tests/samplebinding/enum_test.py 286 + index 0beb720..f2606a4 100644 287 + --- a/sources/shiboken2/tests/samplebinding/enum_test.py 288 + +++ b/sources/shiboken2/tests/samplebinding/enum_test.py 289 + @@ -95,7 +95,7 @@ class EnumTest(unittest.TestCase): 290 + 291 + def testEnumConstructorWithTooManyParameters(self): 292 + '''Calling the constructor of non-extensible enum with the wrong number of parameters.''' 293 + - self.assertRaises(TypeError, SampleNamespace.InValue, 13, 14) 294 + + self.assertRaises((TypeError, ValueError), SampleNamespace.InValue, 13, 14) 295 + 296 + def testEnumConstructorWithNonNumberParameter(self): 297 + '''Calling the constructor of non-extensible enum with a string.''' 298 +
+41 -6
pkgs/development/python-modules/pyside2/default.nix
··· 1 1 { 2 2 python, 3 + pythonAtLeast, 3 4 fetchurl, 4 5 lib, 5 6 stdenv, ··· 11 12 }: 12 13 stdenv.mkDerivation rec { 13 14 pname = "pyside2"; 14 - version = "5.15.11"; 15 + version = "5.15.14"; 15 16 16 17 src = fetchurl { 17 18 url = "https://download.qt.io/official_releases/QtForPython/pyside2/PySide2-${version}-src/pyside-setup-opensource-src-${version}.tar.xz"; 18 - sha256 = "sha256-2lZ807eFTSegtK/j6J3osvmLem1XOTvlbx/BP3cPryk="; 19 + hash = "sha256-MmURlPamt7zkLwTmixQBrSCH5HiaTI8/uGSehhicY3I="; 19 20 }; 20 21 21 - patches = [ ./dont_ignore_optional_modules.patch ]; 22 + patches = [ 23 + ./nix_compile_cflags.patch 24 + ./Final-details-to-enable-3.12-wheel-compatibility.patch 25 + ./Python-3.12-Fix-the-structure-of-class-property.patch 26 + ./Support-running-PySide-on-Python-3.12.patch 27 + ./shiboken2-clang-Fix-and-simplify-resolveType-helper.patch 28 + ./shiboken2-clang-Fix-build-with-clang-16.patch 29 + ./shiboken2-clang-Fix-clashes-between-type-name-and-enumera.patch 30 + ./shiboken2-clang-Record-scope-resolution-of-arguments-func.patch 31 + ./shiboken2-clang-Remove-typedef-expansion.patch 32 + ./shiboken2-clang-Suppress-class-scope-look-up-for-paramete.patch 33 + ./shiboken2-clang-Write-scope-resolution-for-all-parameters.patch 34 + ./dont_ignore_optional_modules.patch 35 + ./Modify-sendCommand-signatures.patch 36 + ]; 22 37 23 - postPatch = '' 24 - cd sources/pyside2 25 - ''; 38 + postPatch = 39 + (lib.optionalString (pythonAtLeast "3.12") '' 40 + substituteInPlace \ 41 + ez_setup.py \ 42 + build_scripts/main.py \ 43 + build_scripts/options.py \ 44 + build_scripts/utils.py \ 45 + build_scripts/wheel_override.py \ 46 + build_scripts/wheel_utils.py \ 47 + sources/pyside2/CMakeLists.txt \ 48 + --replace-fail "from distutils" "import setuptools; from distutils" 49 + substituteInPlace \ 50 + build_scripts/config.py \ 51 + build_scripts/main.py \ 52 + build_scripts/options.py \ 53 + build_scripts/setup_runner.py \ 54 + build_scripts/utils.py \ 55 + --replace-fail "import distutils" "import setuptools; import distutils" 56 + '') 57 + + '' 58 + cd sources/pyside2 59 + ''; 26 60 27 61 cmakeFlags = [ 28 62 "-DBUILD_TESTS=OFF" ··· 36 70 ninja 37 71 qt5.qmake 38 72 python 73 + python.pkgs.setuptools 39 74 ]; 40 75 41 76 buildInputs =
+23
pkgs/development/python-modules/pyside2/nix_compile_cflags.patch
··· 1 + diff --git a/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp b/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp 2 + index add278a..2626eb6 100644 3 + --- a/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp 4 + +++ b/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp 5 + @@ -349,11 +349,15 @@ QByteArrayList emulatedCompilerOptions() 6 + 7 + // Append the c++ include paths since Clang is unable to find 8 + // <type_traits> etc (g++ 11.3). 9 + - const HeaderPaths gppPaths = gppInternalIncludePaths(compilerFromCMake(QStringLiteral("g++"))); 10 + + const HeaderPaths gppPaths = gppInternalIncludePaths(QStringLiteral("g++")); 11 + for (const HeaderPath &h : gppPaths) { 12 + - if (h.path.contains("c++") 13 + - || h.path.contains("sysroot")) { // centOS 14 + + // PySide2 requires that Qt headers are not -isystem 15 + + // https://bugreports.qt.io/browse/PYSIDE-787 16 + + if (!h.path.contains("-qt")) { 17 + + // add using -isystem 18 + headerPaths.append(h); 19 + + } else { 20 + + headerPaths.append({h.path, HeaderType::Standard}); 21 + } 22 + } 23 + #else
+88
pkgs/development/python-modules/pyside2/shiboken2-clang-Fix-and-simplify-resolveType-helper.patch
··· 1 + From: Friedemann Kleint <Friedemann.Kleint@qt.io> 2 + Date: Tue, 25 Apr 2023 10:00:39 +0200 3 + Subject: shiboken2/clang: Fix and simplify resolveType() helper 4 + 5 + The function had a bug which only manifested with clang 16: 6 + "type" should have been assigned the type of the cursor 7 + obtained from clang_getTypeDeclaration(). With this, the complicated 8 + lookup code in getBaseClass() can be removed. 9 + 10 + Task-number: PYSIDE-2288 11 + Pick-to: 6.5 12 + Change-Id: I861e30451b3f4af2ec0c2e4ffa4179a429854533 13 + Reviewed-by: Christian Tismer <tismer@stackless.com> 14 + Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> 15 + --- 16 + .../ApiExtractor/clangparser/clangbuilder.cpp | 39 ++++++++++------------ 17 + 1 file changed, 18 insertions(+), 21 deletions(-) 18 + 19 + diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp 20 + index e8e5bcf..1b4c81c 100644 21 + --- a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp 22 + +++ b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp 23 + @@ -627,6 +627,9 @@ long clang_EnumDecl_isScoped4(BaseVisitor *bv, const CXCursor &cursor) 24 + #endif // CLANG_NO_ENUMDECL_ISSCOPED 25 + 26 + // Resolve declaration and type of a base class 27 + +// Note: TypeAliasTemplateDecl ("using QVector<T>=QList<T>") is automatically 28 + +// resolved by clang_getTypeDeclaration(), but it stops at 29 + +// TypeAliasDecl / TypedefDecl. 30 + 31 + struct TypeDeclaration 32 + { 33 + @@ -634,19 +637,23 @@ struct TypeDeclaration 34 + CXCursor declaration; 35 + }; 36 + 37 + +static inline bool isTypeAliasDecl(const CXCursor &cursor) 38 + +{ 39 + + const auto kind = clang_getCursorKind(cursor); 40 + + return kind == CXCursor_TypeAliasDecl || kind == CXCursor_TypedefDecl; 41 + +} 42 + + 43 + static TypeDeclaration resolveBaseSpecifier(const CXCursor &cursor) 44 + { 45 + Q_ASSERT(clang_getCursorKind(cursor) == CXCursor_CXXBaseSpecifier); 46 + CXType inheritedType = clang_getCursorType(cursor); 47 + CXCursor decl = clang_getTypeDeclaration(inheritedType); 48 + - if (inheritedType.kind != CXType_Unexposed) { 49 + - while (true) { 50 + - auto kind = clang_getCursorKind(decl); 51 + - if (kind != CXCursor_TypeAliasDecl && kind != CXCursor_TypedefDecl) 52 + - break; 53 + - inheritedType = clang_getTypedefDeclUnderlyingType(decl); 54 + - decl = clang_getTypeDeclaration(inheritedType); 55 + - } 56 + + auto resolvedType = clang_getCursorType(decl); 57 + + if (resolvedType.kind != CXType_Invalid && resolvedType.kind != inheritedType.kind) 58 + + inheritedType = resolvedType; 59 + + while (isTypeAliasDecl(decl)) { 60 + + inheritedType = clang_getTypedefDeclUnderlyingType(decl); 61 + + decl = clang_getTypeDeclaration(inheritedType); 62 + } 63 + return {inheritedType, decl}; 64 + } 65 + @@ -656,20 +663,10 @@ void BuilderPrivate::addBaseClass(const CXCursor &cursor) 66 + { 67 + Q_ASSERT(clang_getCursorKind(cursor) == CXCursor_CXXBaseSpecifier); 68 + // Note: spelling has "struct baseClass", use type 69 + - QString baseClassName; 70 + const auto decl = resolveBaseSpecifier(cursor); 71 + - if (decl.type.kind == CXType_Unexposed) { 72 + - // The type is unexposed when the base class is a template type alias: 73 + - // "class QItemSelection : public QList<X>" where QList is aliased to QVector. 74 + - // Try to resolve via code model. 75 + - TypeInfo info = createTypeInfo(decl.type); 76 + - auto parentScope = m_scopeStack.at(m_scopeStack.size() - 2); // Current is class. 77 + - auto resolved = TypeInfo::resolveType(info, parentScope); 78 + - if (resolved != info) 79 + - baseClassName = resolved.toString(); 80 + - } 81 + - if (baseClassName.isEmpty()) 82 + - baseClassName = getTypeName(decl.type); 83 + + QString baseClassName = getTypeName(decl.type); 84 + + if (baseClassName.startsWith(u"std::")) // Simplify "std::" types 85 + + baseClassName = createTypeInfo(decl.type).toString(); 86 + 87 + auto it = m_cursorClassHash.constFind(decl.declaration); 88 + const CodeModel::AccessPolicy access = accessPolicy(clang_getCXXAccessSpecifier(cursor));
+108
pkgs/development/python-modules/pyside2/shiboken2-clang-Fix-build-with-clang-16.patch
··· 1 + From: Friedemann Kleint <Friedemann.Kleint@qt.io> 2 + Date: Tue, 25 Apr 2023 14:01:45 +0200 3 + Subject: shiboken2/clang: Fix build with clang 16 4 + 5 + clang 16 returns more elaborated types instead of fully qualified type 6 + names. Qualify elaborated types when retrieving the type name. 7 + 8 + [ChangeLog][shiboken6] Support for libclang version 16 has been added. 9 + 10 + Task-number: PYSIDE-2288 11 + Pick-to: 6.5 5.15 12 + Change-Id: Ibd428280180967f11d82a72159e744c016afc927 13 + Reviewed-by: Christian Tismer <tismer@stackless.com> 14 + (cherry picked from commit 44ef1859214c66861a251d4a0faf5c38dc050850) 15 + --- 16 + .../ApiExtractor/clangparser/clangbuilder.cpp | 2 +- 17 + .../ApiExtractor/clangparser/clangutils.cpp | 23 ++++++++++++++++++++++ 18 + .../ApiExtractor/clangparser/clangutils.h | 1 + 19 + .../shiboken2/ApiExtractor/tests/testtemplates.cpp | 3 +-- 20 + 4 files changed, 26 insertions(+), 3 deletions(-) 21 + 22 + diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp 23 + index 332f1da..ed1e15d 100644 24 + --- a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp 25 + +++ b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp 26 + @@ -524,7 +524,7 @@ TypeInfo BuilderPrivate::createTypeInfoHelper(const CXType &type) const 27 + typeInfo.setConstant(clang_isConstQualifiedType(nestedType) != 0); 28 + typeInfo.setVolatile(clang_isVolatileQualifiedType(nestedType) != 0); 29 + 30 + - QString typeName = getTypeName(nestedType); 31 + + QString typeName = getResolvedTypeName(nestedType); 32 + while (TypeInfo::stripLeadingConst(&typeName) 33 + || TypeInfo::stripLeadingVolatile(&typeName)) { 34 + } 35 + diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangutils.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangutils.cpp 36 + index 57271ef..295ede3 100644 37 + --- a/sources/shiboken2/ApiExtractor/clangparser/clangutils.cpp 38 + +++ b/sources/shiboken2/ApiExtractor/clangparser/clangutils.cpp 39 + @@ -130,6 +130,23 @@ QString getCursorDisplayName(const CXCursor &cursor) 40 + return result; 41 + } 42 + 43 + +static inline bool isBuiltinType(CXTypeKind kind) 44 + +{ 45 + + return kind >= CXType_FirstBuiltin && kind <= CXType_LastBuiltin; 46 + +} 47 + + 48 + +// Resolve elaborated types occurring with clang 16 49 + +static CXType resolveType(const CXType &type) 50 + +{ 51 + + if (!isBuiltinType(type.kind)) { 52 + + CXCursor decl = clang_getTypeDeclaration(type); 53 + + auto resolvedType = clang_getCursorType(decl); 54 + + if (resolvedType.kind != CXType_Invalid && resolvedType.kind != type.kind) 55 + + return resolvedType; 56 + + } 57 + + return type; 58 + +} 59 + + 60 + QString getTypeName(const CXType &type) 61 + { 62 + CXString typeSpelling = clang_getTypeSpelling(type); 63 + @@ -138,6 +155,12 @@ QString getTypeName(const CXType &type) 64 + return result; 65 + } 66 + 67 + +// Resolve elaborated types occurring with clang 16 68 + +QString getResolvedTypeName(const CXType &type) 69 + +{ 70 + + return getTypeName(resolveType(type)); 71 + +} 72 + + 73 + Diagnostic::Diagnostic(const QString &m, const CXCursor &c, CXDiagnosticSeverity s) 74 + : message(m), source(Other), severity(s) 75 + { 76 + diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangutils.h b/sources/shiboken2/ApiExtractor/clangparser/clangutils.h 77 + index f7c230a..aacaf63 100644 78 + --- a/sources/shiboken2/ApiExtractor/clangparser/clangutils.h 79 + +++ b/sources/shiboken2/ApiExtractor/clangparser/clangutils.h 80 + @@ -52,6 +52,7 @@ QString getCursorKindName(CXCursorKind cursorKind); 81 + QString getCursorSpelling(const CXCursor &cursor); 82 + QString getCursorDisplayName(const CXCursor &cursor); 83 + QString getTypeName(const CXType &type); 84 + +QString getResolvedTypeName(const CXType &type); 85 + inline QString getCursorTypeName(const CXCursor &cursor) 86 + { return getTypeName(clang_getCursorType(cursor)); } 87 + inline QString getCursorResultTypeName(const CXCursor &cursor) 88 + diff --git a/sources/shiboken2/ApiExtractor/tests/testtemplates.cpp b/sources/shiboken2/ApiExtractor/tests/testtemplates.cpp 89 + index 9f929c4..fbc5c4c 100644 90 + --- a/sources/shiboken2/ApiExtractor/tests/testtemplates.cpp 91 + +++ b/sources/shiboken2/ApiExtractor/tests/testtemplates.cpp 92 + @@ -236,7 +236,6 @@ struct List { 93 + const AbstractMetaFunction *erase = list->findFunction(QStringLiteral("erase")); 94 + QVERIFY(erase); 95 + QCOMPARE(erase->arguments().size(), 1); 96 + - QEXPECT_FAIL("", "Clang: Some other code changes the parameter type", Abort); 97 + QCOMPARE(erase->arguments().at(0)->type()->cppSignature(), QLatin1String("List::Iterator")); 98 + } 99 + 100 + @@ -389,7 +388,7 @@ typedef BaseTemplateClass<TypeOne> TypeOneClass; 101 + const ComplexTypeEntry* oneType = one->typeEntry(); 102 + const ComplexTypeEntry* baseType = base->typeEntry(); 103 + QCOMPARE(oneType->baseContainerType(), baseType); 104 + - QCOMPARE(one->baseClassNames(), QStringList(QLatin1String("BaseTemplateClass<TypeOne>"))); 105 + + QCOMPARE(one->baseClassNames(), QStringList(QLatin1String("NSpace::BaseTemplateClass<NSpace::TypeOne>"))); 106 + 107 + QVERIFY(one->hasTemplateBaseClassInstantiations()); 108 + AbstractMetaTypeList instantiations = one->templateBaseClassInstantiations();
+92
pkgs/development/python-modules/pyside2/shiboken2-clang-Fix-clashes-between-type-name-and-enumera.patch
··· 1 + From: Friedemann Kleint <Friedemann.Kleint@qt.io> 2 + Date: Tue, 25 Apr 2023 15:30:30 +0200 3 + Subject: shiboken2/clang: Fix clashes between type name and enumeration 4 + values 5 + 6 + Remove all constant and enum value type entries found in the type lookup 7 + unless it is looking for template arguments; where it may be a 8 + non-type template argument. 9 + 10 + Task-number: PYSIDE-2288 11 + Pick-to: 6.5 5.15 12 + Change-Id: If0609ce0d0223f551ed6dee1d1e0ea3ef49d6917 13 + Reviewed-by: Christian Tismer <tismer@stackless.com> 14 + (cherry picked from commit e22f717153a5e9855531f45c0bf82ff2461a3f7e) 15 + --- 16 + .../shiboken2/ApiExtractor/abstractmetabuilder.cpp | 21 +++++++++++++++++++-- 17 + .../shiboken2/ApiExtractor/abstractmetabuilder.h | 3 ++- 18 + .../shiboken2/ApiExtractor/typesystem_typedefs.h | 1 + 19 + 3 files changed, 22 insertions(+), 3 deletions(-) 20 + 21 + diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp 22 + index 5a413ec..2f34e16 100644 23 + --- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp 24 + +++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp 25 + @@ -2144,6 +2144,13 @@ static bool isNumber(const QString &s) 26 + [](QChar c) { return c.isDigit(); }); 27 + } 28 + 29 + +// A type entry relevant only for non type template "X<5>" 30 + +static bool isNonTypeTemplateArgument(const TypeEntryCPtr &te) 31 + +{ 32 + + const auto type = te->type(); 33 + + return type == TypeEntry::EnumValue || type == TypeEntry::ConstantValueType; 34 + +} 35 + + 36 + AbstractMetaType *AbstractMetaBuilderPrivate::translateTypeStatic(const TypeInfo &_typei, 37 + AbstractMetaClass *currentClass, 38 + AbstractMetaBuilderPrivate *d, 39 + @@ -2271,7 +2278,15 @@ AbstractMetaType *AbstractMetaBuilderPrivate::translateTypeStatic(const TypeInfo 40 + typeInfo.clearInstantiations(); 41 + } 42 + 43 + - const TypeEntries types = findTypeEntries(qualifiedName, name, currentClass, d); 44 + + TypeEntries types = findTypeEntries(qualifiedName, name, currentClass, d); 45 + + if (!flags.testFlag(AbstractMetaBuilder::TemplateArgument)) { 46 + + // Avoid clashes between QByteArray and enum value QMetaType::QByteArray 47 + + // unless we are looking for template arguments. 48 + + auto end = std::remove_if(types.begin(), types.end(), 49 + + isNonTypeTemplateArgument); 50 + + types.erase(end, types.end()); 51 + + } 52 + + 53 + if (types.isEmpty()) { 54 + if (errorMessageIn) { 55 + *errorMessageIn = 56 + @@ -2293,7 +2308,9 @@ AbstractMetaType *AbstractMetaBuilderPrivate::translateTypeStatic(const TypeInfo 57 + const auto &templateArguments = typeInfo.instantiations(); 58 + for (int t = 0, size = templateArguments.size(); t < size; ++t) { 59 + const TypeInfo &ti = templateArguments.at(t); 60 + - AbstractMetaType *targType = translateTypeStatic(ti, currentClass, d, flags, &errorMessage); 61 + + AbstractMetaType *targType = translateTypeStatic(ti, currentClass, d, 62 + + flags | AbstractMetaBuilder::TemplateArgument, 63 + + &errorMessage); 64 + // For non-type template parameters, create a dummy type entry on the fly 65 + // as is done for classes. 66 + if (!targType) { 67 + diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.h b/sources/shiboken2/ApiExtractor/abstractmetabuilder.h 68 + index d2dc080..8916eaf 100644 69 + --- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.h 70 + +++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.h 71 + @@ -93,7 +93,8 @@ public: 72 + void setSkipDeprecated(bool value); 73 + 74 + enum TranslateTypeFlag { 75 + - DontResolveType = 0x1 76 + + DontResolveType = 0x1, 77 + + TemplateArgument = 0x2 78 + }; 79 + Q_DECLARE_FLAGS(TranslateTypeFlags, TranslateTypeFlag); 80 + 81 + diff --git a/sources/shiboken2/ApiExtractor/typesystem_typedefs.h b/sources/shiboken2/ApiExtractor/typesystem_typedefs.h 82 + index 73f92b2..5dcc65c 100644 83 + --- a/sources/shiboken2/ApiExtractor/typesystem_typedefs.h 84 + +++ b/sources/shiboken2/ApiExtractor/typesystem_typedefs.h 85 + @@ -48,6 +48,7 @@ using CodeSnipList = QVector<CodeSnip>; 86 + using DocModificationList = QVector<DocModification>; 87 + using FieldModificationList = QVector<FieldModification>; 88 + using FunctionModificationList = QVector<FunctionModification>; 89 + +using TypeEntryCPtr = const TypeEntry *; 90 + using TypeEntries = QVector<const TypeEntry *>; 91 + 92 + #endif // TYPESYSTEM_TYPEDEFS_H
+178
pkgs/development/python-modules/pyside2/shiboken2-clang-Record-scope-resolution-of-arguments-func.patch
··· 1 + From: Friedemann Kleint <Friedemann.Kleint@qt.io> 2 + Date: Thu, 27 Apr 2023 12:44:10 +0200 3 + Subject: shiboken2/clang: Record scope resolution of arguments/function 4 + return 5 + 6 + Add a flag indicating whether a type was specified with a leading "::" 7 + (scope resolution). Such parameters previously caused the function to 8 + rejected due to the "::TypeName" not being found. The type resolution 9 + added for clang 16 strips these qualifiers though, so, the information 10 + needs to be stored. 11 + 12 + Task-number: PYSIDE-2288 13 + Pick-to: 6.5 5.15 14 + Change-Id: I27d27c94ec43bcc4cb3b79e6e9ce6706c749a1e9 15 + Reviewed-by: Christian Tismer <tismer@stackless.com> 16 + (cherry picked from commit 075d8ad4660f05e6d2583ff1c05e9987ad624bfe) 17 + --- 18 + .../ApiExtractor/clangparser/clangbuilder.cpp | 8 ++++++-- 19 + .../ApiExtractor/clangparser/clangutils.cpp | 11 ++++++++++ 20 + .../ApiExtractor/clangparser/clangutils.h | 1 + 21 + .../shiboken2/ApiExtractor/parser/codemodel.cpp | 24 ++++++++++++++++++++++ 22 + sources/shiboken2/ApiExtractor/parser/codemodel.h | 8 ++++++++ 23 + 5 files changed, 50 insertions(+), 2 deletions(-) 24 + 25 + diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp 26 + index ed1e15d..1b5cc5c 100644 27 + --- a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp 28 + +++ b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp 29 + @@ -294,7 +294,9 @@ FunctionModelItem BuilderPrivate::createFunction(const CXCursor &cursor, 30 + name = fixTypeName(name); 31 + FunctionModelItem result(new _FunctionModelItem(m_model, name)); 32 + setFileName(cursor, result.data()); 33 + - result->setType(createTypeInfoHelper(clang_getCursorResultType(cursor))); 34 + + const auto type = clang_getCursorResultType(cursor); 35 + + result->setType(createTypeInfoHelper(type)); 36 + + result->setScopeResolution(hasScopeResolution(type)); 37 + result->setFunctionType(t); 38 + result->setScope(m_scope); 39 + result->setStatic(clang_Cursor_getStorageClass(cursor) == CX_SC_Static); 40 + @@ -1031,7 +1033,9 @@ BaseVisitor::StartTokenResult Builder::startToken(const CXCursor &cursor) 41 + if (d->m_currentArgument.isNull() && !d->m_currentFunction.isNull()) { 42 + const QString name = getCursorSpelling(cursor); 43 + d->m_currentArgument.reset(new _ArgumentModelItem(d->m_model, name)); 44 + - d->m_currentArgument->setType(d->createTypeInfo(cursor)); 45 + + const auto type = clang_getCursorType(cursor); 46 + + d->m_currentArgument->setScopeResolution(hasScopeResolution(type)); 47 + + d->m_currentArgument->setType(d->createTypeInfo(type)); 48 + d->m_currentFunction->addArgument(d->m_currentArgument); 49 + QString defaultValueExpression = d->cursorValueExpression(this, cursor); 50 + if (!defaultValueExpression.isEmpty()) { 51 + diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangutils.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangutils.cpp 52 + index 295ede3..ec6d228 100644 53 + --- a/sources/shiboken2/ApiExtractor/clangparser/clangutils.cpp 54 + +++ b/sources/shiboken2/ApiExtractor/clangparser/clangutils.cpp 55 + @@ -155,6 +155,17 @@ QString getTypeName(const CXType &type) 56 + return result; 57 + } 58 + 59 + +// Quick check for "::Type" 60 + +bool hasScopeResolution(const CXType &type) 61 + +{ 62 + + CXString typeSpelling = clang_getTypeSpelling(type); 63 + + const QString spelling = QString::fromUtf8(clang_getCString(typeSpelling)); 64 + + const bool result = spelling.startsWith(QLatin1String("::")) 65 + + || spelling.contains(QLatin1String(" ::")); 66 + + clang_disposeString(typeSpelling); 67 + + return result; 68 + +} 69 + + 70 + // Resolve elaborated types occurring with clang 16 71 + QString getResolvedTypeName(const CXType &type) 72 + { 73 + diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangutils.h b/sources/shiboken2/ApiExtractor/clangparser/clangutils.h 74 + index aacaf63..33f362c 100644 75 + --- a/sources/shiboken2/ApiExtractor/clangparser/clangutils.h 76 + +++ b/sources/shiboken2/ApiExtractor/clangparser/clangutils.h 77 + @@ -52,6 +52,7 @@ QString getCursorKindName(CXCursorKind cursorKind); 78 + QString getCursorSpelling(const CXCursor &cursor); 79 + QString getCursorDisplayName(const CXCursor &cursor); 80 + QString getTypeName(const CXType &type); 81 + +bool hasScopeResolution(const CXType &type); 82 + QString getResolvedTypeName(const CXType &type); 83 + inline QString getCursorTypeName(const CXCursor &cursor) 84 + { return getTypeName(clang_getCursorType(cursor)); } 85 + diff --git a/sources/shiboken2/ApiExtractor/parser/codemodel.cpp b/sources/shiboken2/ApiExtractor/parser/codemodel.cpp 86 + index dea0812..ba07a01 100644 87 + --- a/sources/shiboken2/ApiExtractor/parser/codemodel.cpp 88 + +++ b/sources/shiboken2/ApiExtractor/parser/codemodel.cpp 89 + @@ -1121,11 +1121,23 @@ void _ArgumentModelItem::setDefaultValue(bool defaultValue) 90 + m_defaultValue = defaultValue; 91 + } 92 + 93 + +bool _ArgumentModelItem::scopeResolution() const 94 + +{ 95 + + return m_scopeResolution; 96 + +} 97 + + 98 + +void _ArgumentModelItem::setScopeResolution(bool v) 99 + +{ 100 + + m_scopeResolution = v; 101 + +} 102 + + 103 + #ifndef QT_NO_DEBUG_STREAM 104 + void _ArgumentModelItem::formatDebug(QDebug &d) const 105 + { 106 + _CodeModelItem::formatDebug(d); 107 + d << ", type=" << m_type; 108 + + if (m_scopeResolution) 109 + + d << ", [m_scope resolution]"; 110 + if (m_defaultValue) 111 + d << ", defaultValue=\"" << m_defaultValueExpression << '"'; 112 + } 113 + @@ -1200,6 +1212,16 @@ void _FunctionModelItem::setVariadics(bool isVariadics) 114 + m_isVariadics = isVariadics; 115 + } 116 + 117 + +bool _FunctionModelItem::scopeResolution() const 118 + +{ 119 + + return m_scopeResolution; 120 + +} 121 + + 122 + +void _FunctionModelItem::setScopeResolution(bool v) 123 + +{ 124 + + m_scopeResolution = v; 125 + +} 126 + + 127 + bool _FunctionModelItem::isNoExcept() const 128 + { 129 + return m_exceptionSpecification == ExceptionSpecification::NoExcept; 130 + @@ -1343,6 +1365,8 @@ void _FunctionModelItem::formatDebug(QDebug &d) const 131 + d << " [explicit]"; 132 + if (m_isInvokable) 133 + d << " [invokable]"; 134 + + if (m_scopeResolution) 135 + + d << " [scope resolution]"; 136 + formatModelItemList(d, ", arguments=", m_arguments); 137 + if (m_isVariadics) 138 + d << ",..."; 139 + diff --git a/sources/shiboken2/ApiExtractor/parser/codemodel.h b/sources/shiboken2/ApiExtractor/parser/codemodel.h 140 + index b990ad9..85f298c 100644 141 + --- a/sources/shiboken2/ApiExtractor/parser/codemodel.h 142 + +++ b/sources/shiboken2/ApiExtractor/parser/codemodel.h 143 + @@ -499,6 +499,10 @@ public: 144 + QString defaultValueExpression() const { return m_defaultValueExpression; } 145 + void setDefaultValueExpression(const QString &expr) { m_defaultValueExpression = expr; } 146 + 147 + + // Argument type has scope resolution "::ArgumentType" 148 + + bool scopeResolution() const; 149 + + void setScopeResolution(bool v); 150 + + 151 + #ifndef QT_NO_DEBUG_STREAM 152 + void formatDebug(QDebug &d) const override; 153 + #endif 154 + @@ -507,6 +511,7 @@ private: 155 + TypeInfo m_type; 156 + QString m_defaultValueExpression; 157 + bool m_defaultValue = false; 158 + + bool m_scopeResolution = false; 159 + }; 160 + 161 + class _MemberModelItem: public _CodeModelItem 162 + @@ -623,6 +628,8 @@ public: 163 + bool isVariadics() const; 164 + void setVariadics(bool isVariadics); 165 + 166 + + bool scopeResolution() const; // Return type has scope resolution "::ReturnType" 167 + + void setScopeResolution(bool v); 168 + 169 + bool isSimilar(const FunctionModelItem &other) const; 170 + 171 + @@ -652,6 +659,7 @@ private: 172 + uint m_isExplicit: 1; 173 + uint m_isVariadics: 1; 174 + uint m_isInvokable : 1; // Qt 175 + + uint m_scopeResolution: 1; 176 + }; 177 + uint m_flags; 178 + };
+101
pkgs/development/python-modules/pyside2/shiboken2-clang-Remove-typedef-expansion.patch
··· 1 + From: Friedemann Kleint <Friedemann.Kleint@qt.io> 2 + Date: Thu, 20 Apr 2023 11:16:15 +0200 3 + Subject: shiboken2/clang: Remove typedef expansion 4 + 5 + The functionality will be re-added by a subsequent change 6 + expanding elaborated types. 7 + 8 + Task-number: PYSIDE-2288 9 + Pick-to: 6.5 5.15 10 + Change-Id: I3245c6dccba7de0ed1ce0e7820e1edb4567ca3c2 11 + Reviewed-by: Christian Tismer <tismer@stackless.com> 12 + (cherry picked from commit 24742dca014109bd3c2a9775fc15ca306ab22c9c) 13 + --- 14 + .../ApiExtractor/clangparser/clangbuilder.cpp | 39 ---------------------- 15 + 1 file changed, 39 deletions(-) 16 + 17 + diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp 18 + index 1b4c81c..332f1da 100644 19 + --- a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp 20 + +++ b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp 21 + @@ -140,7 +140,6 @@ static bool isSigned(CXTypeKind kind) 22 + class BuilderPrivate { 23 + public: 24 + using CursorClassHash = QHash<CXCursor, ClassModelItem>; 25 + - using CursorTypedefHash = QHash<CXCursor, TypeDefModelItem>; 26 + using TypeInfoHash = QHash<CXType, TypeInfo>; 27 + 28 + explicit BuilderPrivate(BaseVisitor *bv) : m_baseVisitor(bv), m_model(new CodeModel) 29 + @@ -197,9 +196,6 @@ public: 30 + QString cursorValueExpression(BaseVisitor *bv, const CXCursor &cursor) const; 31 + void addBaseClass(const CXCursor &cursor); 32 + 33 + - template <class Item> 34 + - void qualifyTypeDef(const CXCursor &typeRefCursor, const QSharedPointer<Item> &item) const; 35 + - 36 + bool visitHeader(const char *cFileName) const; 37 + 38 + void setFileName(const CXCursor &cursor, _CodeModelItem *item); 39 + @@ -213,7 +209,6 @@ public: 40 + // classes can be correctly parented in case of forward-declared inner classes 41 + // (QMetaObject::Connection) 42 + CursorClassHash m_cursorClassHash; 43 + - CursorTypedefHash m_cursorTypedefHash; 44 + 45 + mutable TypeInfoHash m_typeInfoHash; // Cache type information 46 + mutable QHash<QString, TemplateTypeAliasModelItem> m_templateTypeAliases; 47 + @@ -561,7 +556,6 @@ void BuilderPrivate::addTypeDef(const CXCursor &cursor, const CXType &cxType) 48 + item->setType(createTypeInfo(cxType)); 49 + item->setScope(m_scope); 50 + m_scopeStack.back()->addTypeDef(item); 51 + - m_cursorTypedefHash.insert(cursor, item); 52 + } 53 + 54 + void BuilderPrivate::startTemplateTypeAlias(const CXCursor &cursor) 55 + @@ -703,31 +697,6 @@ static inline CXCursor definitionFromTypeRef(const CXCursor &typeRefCursor) 56 + return clang_getTypeDeclaration(clang_getCursorType(typeRefCursor)); 57 + } 58 + 59 + -// Qualify function arguments or fields that are typedef'ed from another scope: 60 + -// enum ConversionFlag {}; 61 + -// typedef QFlags<ConversionFlag> ConversionFlags; 62 + -// class QTextCodec { 63 + -// enum ConversionFlag {}; 64 + -// typedef QFlags<ConversionFlag> ConversionFlags; 65 + -// struct ConverterState { 66 + -// explicit ConverterState(ConversionFlags); 67 + -// ^^ qualify to QTextCodec::ConversionFlags 68 + -// ConversionFlags m_flags; 69 + -// ^^ ditto 70 + - 71 + -template <class Item> // ArgumentModelItem, VariableModelItem 72 + -void BuilderPrivate::qualifyTypeDef(const CXCursor &typeRefCursor, const QSharedPointer<Item> &item) const 73 + -{ 74 + - TypeInfo type = item->type(); 75 + - if (type.qualifiedName().size() == 1) { // item's type is unqualified. 76 + - const auto it = m_cursorTypedefHash.constFind(definitionFromTypeRef(typeRefCursor)); 77 + - if (it != m_cursorTypedefHash.constEnd() && !it.value()->scope().isEmpty()) { 78 + - type.setQualifiedName(it.value()->scope() + type.qualifiedName()); 79 + - item->setType(type); 80 + - } 81 + - } 82 + -} 83 + - 84 + void BuilderPrivate::setFileName(const CXCursor &cursor, _CodeModelItem *item) 85 + { 86 + const SourceRange range = getCursorRange(cursor); 87 + @@ -1120,14 +1089,6 @@ BaseVisitor::StartTokenResult Builder::startToken(const CXCursor &cursor) 88 + } 89 + break; 90 + case CXCursor_TypeRef: 91 + - if (!d->m_currentFunction.isNull()) { 92 + - if (d->m_currentArgument.isNull()) 93 + - d->qualifyTypeDef(cursor, d->m_currentFunction); // return type 94 + - else 95 + - d->qualifyTypeDef(cursor, d->m_currentArgument); 96 + - } else if (!d->m_currentField.isNull()) { 97 + - d->qualifyTypeDef(cursor, d->m_currentField); 98 + - } 99 + break; 100 + case CXCursor_CXXFinalAttr: 101 + if (!d->m_currentFunction.isNull())
+96
pkgs/development/python-modules/pyside2/shiboken2-clang-Suppress-class-scope-look-up-for-paramete.patch
··· 1 + From: Friedemann Kleint <Friedemann.Kleint@qt.io> 2 + Date: Thu, 27 Apr 2023 13:00:37 +0200 3 + Subject: shiboken2/clang: Suppress class scope look up for parameters with 4 + scope resolution 5 + 6 + Add a flag to AbstractMetaBuilderPrivate::findTypeEntriesHelper() 7 + to suppress the class scope look in case scope resolution. 8 + 9 + Task-number: PYSIDE-2288 10 + Pick-to: 6.5 5.15 11 + Change-Id: I04a4810d03845fb48393c5efed3641220bd12d87 12 + Reviewed-by: Christian Tismer <tismer@stackless.com> 13 + --- 14 + sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp | 16 ++++++++++++---- 15 + sources/shiboken2/ApiExtractor/abstractmetabuilder.h | 3 ++- 16 + sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h | 1 + 17 + 3 files changed, 15 insertions(+), 5 deletions(-) 18 + 19 + diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp 20 + index 2f34e16..4bf4ab4 100644 21 + --- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp 22 + +++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp 23 + @@ -1845,7 +1845,10 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio 24 + return nullptr; 25 + } 26 + 27 + - AbstractMetaType *type = translateType(returnType, currentClass, {}, &errorMessage); 28 + + TranslateTypeFlags flags; 29 + + if (functionItem->scopeResolution()) 30 + + flags.setFlag(AbstractMetaBuilder::NoClassScopeLookup); 31 + + AbstractMetaType *type = translateType(returnType, currentClass, flags, &errorMessage); 32 + if (!type) { 33 + const QString reason = msgUnmatchedReturnType(functionItem, errorMessage); 34 + qCWarning(lcShiboken, "%s", 35 + @@ -1880,7 +1883,10 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio 36 + return nullptr; 37 + } 38 + 39 + - AbstractMetaType *metaType = translateType(arg->type(), currentClass, {}, &errorMessage); 40 + + TranslateTypeFlags flags; 41 + + if (arg->scopeResolution()) 42 + + flags.setFlag(AbstractMetaBuilder::NoClassScopeLookup); 43 + + AbstractMetaType *metaType = translateType(arg->type(), currentClass, flags, &errorMessage); 44 + if (!metaType) { 45 + // If an invalid argument has a default value, simply remove it 46 + // unless the function is virtual (since the override in the 47 + @@ -2073,11 +2079,13 @@ static const TypeEntry* findTypeEntryUsingContext(const AbstractMetaClass* metaC 48 + // Helper for translateTypeStatic() 49 + TypeEntries AbstractMetaBuilderPrivate::findTypeEntries(const QString &qualifiedName, 50 + const QString &name, 51 + + TranslateTypeFlags flags, 52 + AbstractMetaClass *currentClass, 53 + AbstractMetaBuilderPrivate *d) 54 + { 55 + // 5.1 - Try first using the current scope 56 + - if (currentClass) { 57 + + if (currentClass != nullptr 58 + + && !flags.testFlag(AbstractMetaBuilder::NoClassScopeLookup)) { 59 + if (auto type = findTypeEntryUsingContext(currentClass, qualifiedName)) 60 + return {type}; 61 + 62 + @@ -2278,7 +2286,7 @@ AbstractMetaType *AbstractMetaBuilderPrivate::translateTypeStatic(const TypeInfo 63 + typeInfo.clearInstantiations(); 64 + } 65 + 66 + - TypeEntries types = findTypeEntries(qualifiedName, name, currentClass, d); 67 + + TypeEntries types = findTypeEntries(qualifiedName, name, flags, currentClass, d); 68 + if (!flags.testFlag(AbstractMetaBuilder::TemplateArgument)) { 69 + // Avoid clashes between QByteArray and enum value QMetaType::QByteArray 70 + // unless we are looking for template arguments. 71 + diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.h b/sources/shiboken2/ApiExtractor/abstractmetabuilder.h 72 + index 8916eaf..f333ad5 100644 73 + --- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.h 74 + +++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.h 75 + @@ -94,7 +94,8 @@ public: 76 + 77 + enum TranslateTypeFlag { 78 + DontResolveType = 0x1, 79 + - TemplateArgument = 0x2 80 + + TemplateArgument = 0x2, 81 + + NoClassScopeLookup = 0x4 82 + }; 83 + Q_DECLARE_FLAGS(TranslateTypeFlags, TranslateTypeFlag); 84 + 85 + diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h b/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h 86 + index 8468950..8ddd369 100644 87 + --- a/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h 88 + +++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h 89 + @@ -154,6 +154,7 @@ public: 90 + TranslateTypeFlags flags = {}, 91 + QString *errorMessageIn = nullptr); 92 + static TypeEntries findTypeEntries(const QString &qualifiedName, const QString &name, 93 + + TranslateTypeFlags flags = {}, 94 + AbstractMetaClass *currentClass = nullptr, 95 + AbstractMetaBuilderPrivate *d = nullptr); 96 +
+62
pkgs/development/python-modules/pyside2/shiboken2-clang-Write-scope-resolution-for-all-parameters.patch
··· 1 + From: Friedemann Kleint <Friedemann.Kleint@qt.io> 2 + Date: Thu, 27 Apr 2023 12:18:39 +0200 3 + Subject: shiboken2/clang: Write scope resolution for all parameters of native 4 + wrappers 5 + 6 + Make sure types are correct for cases like: 7 + 8 + - QtDBusHelper::QDBusReply::QDBusReply(::QDBusReply<void>) 9 + - Qt3DInput*Event constructors taking the equivalent QtGui classes 10 + (Qt3DInput::QMouseEvent(::QMouseEvent *); 11 + 12 + [ChangeLog][shiboken6] Support for parameters/function return 13 + types with scope resolution has been improved. 14 + 15 + Fixes: PYSIDE-2288 16 + Pick-to: 6.5 5.15 17 + Change-Id: Id29758fceb88188f4cd834fbd5a7cc0ab511fb1a 18 + Reviewed-by: Christian Tismer <tismer@stackless.com> 19 + (cherry picked from commit dd863857436bbeeba4c0a1077f5ad16653296277) 20 + --- 21 + sources/shiboken2/generator/generator.cpp | 24 +++++++++++++----------- 22 + 1 file changed, 13 insertions(+), 11 deletions(-) 23 + 24 + diff --git a/sources/shiboken2/generator/generator.cpp b/sources/shiboken2/generator/generator.cpp 25 + index 6028282..6147b8a 100644 26 + --- a/sources/shiboken2/generator/generator.cpp 27 + +++ b/sources/shiboken2/generator/generator.cpp 28 + @@ -899,21 +899,23 @@ QString Generator::translateType(const AbstractMetaType *cType, 29 + if (index >= (s.size() - (constLen + 1))) // (VarType const) or (VarType const[*|&]) 30 + s = s.remove(index, constLen); 31 + } 32 + - } else if (options & Generator::ExcludeConst || options & Generator::ExcludeReference) { 33 + + } else { 34 + AbstractMetaType *copyType = cType->copy(); 35 + + if (options & Generator::ExcludeConst || options & Generator::ExcludeReference) { 36 + + if (options & Generator::ExcludeConst) 37 + + copyType->setConstant(false); 38 + 39 + - if (options & Generator::ExcludeConst) 40 + - copyType->setConstant(false); 41 + - 42 + - if (options & Generator::ExcludeReference) 43 + - copyType->setReferenceType(NoReference); 44 + - 45 + + if (options & Generator::ExcludeReference) 46 + + copyType->setReferenceType(NoReference); 47 + + } 48 + s = copyType->cppSignature(); 49 + - if (!copyType->typeEntry()->isVoid() && !copyType->typeEntry()->isCppPrimitive()) 50 + - s.prepend(QLatin1String("::")); 51 + + const auto te = copyType->typeEntry(); 52 + + if (!te->isVoid() && !te->isCppPrimitive()) { // Add scope resolution 53 + + const auto pos = s.indexOf(te->qualifiedCppName()); // Skip const/volatile 54 + + Q_ASSERT(pos >= 0); 55 + + s.insert(pos, QLatin1String("::")); 56 + + } 57 + delete copyType; 58 + - } else { 59 + - s = cType->cppSignature(); 60 + } 61 + } 62 +
+29 -10
pkgs/development/python-modules/shiboken2/default.nix
··· 1 1 { 2 2 python, 3 + pythonAtLeast, 3 4 lib, 4 5 stdenv, 5 6 pyside2, ··· 7 8 qt5, 8 9 libxcrypt, 9 10 llvmPackages_15, 10 - pythonAtLeast, 11 11 }: 12 12 13 13 stdenv.mkDerivation { 14 14 pname = "shiboken2"; 15 15 16 - inherit (pyside2) version src; 16 + inherit (pyside2) version src patches; 17 17 18 - patches = [ ./nix_compile_cflags.patch ]; 19 - 20 - postPatch = '' 21 - cd sources/shiboken2 22 - ''; 18 + postPatch = 19 + (lib.optionalString (pythonAtLeast "3.12") '' 20 + substituteInPlace \ 21 + ez_setup.py \ 22 + build_scripts/main.py \ 23 + build_scripts/options.py \ 24 + build_scripts/utils.py \ 25 + build_scripts/wheel_override.py \ 26 + build_scripts/wheel_utils.py \ 27 + sources/shiboken2/CMakeLists.txt \ 28 + sources/shiboken2/data/shiboken_helpers.cmake \ 29 + --replace-fail "from distutils" "import setuptools; from distutils" 30 + substituteInPlace \ 31 + build_scripts/config.py \ 32 + build_scripts/main.py \ 33 + build_scripts/options.py \ 34 + build_scripts/setup_runner.py \ 35 + build_scripts/utils.py \ 36 + --replace-fail "import distutils" "import setuptools; import distutils" 37 + '') 38 + + '' 39 + cd sources/shiboken2 40 + ''; 23 41 24 42 CLANG_INSTALL_DIR = llvmPackages_15.libclang.out; 25 43 26 - nativeBuildInputs = [ cmake ]; 44 + nativeBuildInputs = [ 45 + cmake 46 + (python.withPackages (ps: with ps; [ setuptools ])) 47 + ]; 27 48 28 49 buildInputs = 29 50 [ 30 51 llvmPackages_15.libclang 31 - python 32 52 python.pkgs.setuptools 33 53 qt5.qtbase 34 54 qt5.qtxmlpatterns ··· 59 79 ]; 60 80 homepage = "https://wiki.qt.io/Qt_for_Python"; 61 81 maintainers = with maintainers; [ gebner ]; 62 - broken = pythonAtLeast "3.12"; 63 82 }; 64 83 }
-30
pkgs/development/python-modules/shiboken2/nix_compile_cflags.patch
··· 1 - --- pyside-setup-everywhere-src-5.12.6/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp~ 2020-07-08 14:37:13.022476435 -0700 2 - +++ pyside-setup-everywhere-src-5.12.6/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp 2020-07-08 14:37:18.271484269 -0700 3 - @@ -330,17 +330,15 @@ 4 - } 5 - #endif // NEED_CLANG_BUILTIN_INCLUDES 6 - 7 - - // Append the c++ include paths since Clang is unable to find <list> etc 8 - - // on RHEL 7 with g++ 6.3 or CentOS 7.2. 9 - - // A fix for this has been added to Clang 5.0, so, the code can be removed 10 - - // once Clang 5.0 is the minimum version. 11 - - if (needsGppInternalHeaders()) { 12 - - const HeaderPaths gppPaths = gppInternalIncludePaths(compilerFromCMake(QStringLiteral("g++"))); 13 - - for (const HeaderPath &h : gppPaths) { 14 - - if (h.path.contains("c++") 15 - - || h.path.contains("sysroot")) { // centOS 16 - - headerPaths.append(h); 17 - - } 18 - + const HeaderPaths gppPaths = gppInternalIncludePaths(QStringLiteral("g++")); 19 - + for (const HeaderPath &h : gppPaths) { 20 - + // PySide2 requires that Qt headers are not -isystem 21 - + // https://bugreports.qt.io/browse/PYSIDE-787 22 - + if (!h.path.contains("-qt")) { 23 - + // add using -isystem 24 - + headerPaths.append(h); 25 - + } else { 26 - + headerPaths.append({h.path, HeaderType::Standard}); 27 - } 28 - } 29 - #else 30 -
+16 -3
pkgs/development/python-modules/sip/4.x.nix
··· 6 6 python, 7 7 isPyPy, 8 8 pythonAtLeast, 9 + pythonOlder, 9 10 sip-module ? "sip", 11 + setuptools, 10 12 }: 11 13 12 14 buildPythonPackage rec { ··· 14 16 version = "4.19.25"; 15 17 format = "other"; 16 18 17 - # relies on distutils 18 - disabled = isPyPy || pythonAtLeast "3.12"; 19 + disabled = isPyPy; 19 20 20 21 src = fetchurl { 21 22 url = "https://www.riverbankcomputing.com/static/Downloads/sip/${version}/sip-${version}.tar.gz"; ··· 30 31 }) 31 32 ]; 32 33 34 + postPatch = lib.optionalString (pythonAtLeast "3.12") '' 35 + substituteInPlace configure.py --replace-fail "from distutils" "from setuptools._distutils" 36 + ''; 37 + 38 + propagatedBuildInputs = lib.optional (pythonAtLeast "3.12") setuptools; 39 + 33 40 configurePhase = '' 34 41 ${python.executable} ./configure.py \ 35 42 --sip-module ${sip-module} \ ··· 40 47 enableParallelBuilding = true; 41 48 42 49 pythonImportsCheck = [ 43 - sip-module 50 + # https://www.riverbankcomputing.com/pipermail/pyqt/2023-January/045094.html 51 + # the import check for "sip" will fail, as it segfaults as the interperter is shutting down. 52 + # This is an upstream bug with sip4 on python3.12, and happens in the ubuntu packages version as well. 53 + # As the pacakge works fine until exit, just remove the import check for now. 54 + # See discussion at https://github.com/NixOS/nixpkgs/pull/327976#discussion_r1706488319 55 + (lib.optional (pythonOlder "3.12") sip-module) 56 + 44 57 "sipconfig" 45 58 ]; 46 59