WIP: backports/freecad: upgrade to 0.20.2 #440
10 changed files with 34 additions and 444 deletions
|
@ -1,7 +1,7 @@
|
||||||
# Contributor: Aiden Grossman <agrossman154@yahoo.com>
|
# Contributor: Aiden Grossman <agrossman154@yahoo.com>
|
||||||
# Maintainer: Aiden Grossman <agrossman154@yahoo.com>
|
# Maintainer: Aiden Grossman <agrossman154@yahoo.com>
|
||||||
pkgname=freecad
|
pkgname=freecad
|
||||||
pkgver=0.21.0
|
pkgver=0.21.2
|
||||||
pkgrel=0
|
pkgrel=0
|
||||||
pkgdesc="Free and open source 3D parametric modeler"
|
pkgdesc="Free and open source 3D parametric modeler"
|
||||||
url="https://freecadweb.org/"
|
url="https://freecadweb.org/"
|
||||||
|
@ -15,10 +15,9 @@ depends="
|
||||||
py3-numpy
|
py3-numpy
|
||||||
py3-pivy
|
py3-pivy
|
||||||
py3-ply
|
py3-ply
|
||||||
py3-pyside2
|
py3-pyside6
|
||||||
py3-six
|
py3-six
|
||||||
py3-yaml
|
py3-yaml
|
||||||
python3
|
|
||||||
"
|
"
|
||||||
makedepends="
|
makedepends="
|
||||||
boost-dev
|
boost-dev
|
||||||
|
@ -30,25 +29,25 @@ makedepends="
|
||||||
glu-dev
|
glu-dev
|
||||||
hdf5-dev
|
hdf5-dev
|
||||||
libmedc-dev
|
libmedc-dev
|
||||||
libshiboken2-dev
|
libshiboken6-dev
|
||||||
onetbb-dev
|
onetbb-dev
|
||||||
opencascade-dev
|
opencascade-dev
|
||||||
py3-pyside2-dev
|
py3-pyside2-dev
|
||||||
python3-dev
|
python3-dev
|
||||||
shiboken2
|
shiboken6
|
||||||
qt5-qtsvg-dev
|
qt6-qtsvg-dev
|
||||||
qt5-qtwebengine-dev
|
qt6-qtwebengine-dev
|
||||||
qt5-qtxmlpatterns-dev
|
qt6-qtxmlpatterns-dev
|
||||||
samurai
|
samurai
|
||||||
swig
|
swig
|
||||||
vtk-dev
|
vtk-dev
|
||||||
xerces-c-dev
|
xerces-c-dev
|
||||||
"
|
"
|
||||||
options="!check" # Failing test units upstream as well
|
|
||||||
checkdepends="xvfb-run mesa mesa-dri-gallium font-opensans"
|
checkdepends="xvfb-run mesa mesa-dri-gallium font-opensans"
|
||||||
source="https://github.com/FreeCAD/FreeCAD/archive/$pkgver/freecad-$pkgver.tar.gz
|
source="https://github.com/FreeCAD/FreeCAD/archive/$pkgver/freecad-$pkgver.tar.gz
|
||||||
$pkgname-cstdint.patch::https://github.com/FreeCAD/FreeCAD/commit/f8f02f089537497a1bf46bc1057f01659b6636c1.patch
|
|
||||||
no-execinfo.patch
|
no-execinfo.patch
|
||||||
|
resourceDirectory.patch
|
||||||
|
missing-include-cstdint.patch
|
||||||
"
|
"
|
||||||
builddir="$srcdir/FreeCAD-$pkgver"
|
builddir="$srcdir/FreeCAD-$pkgver"
|
||||||
|
|
||||||
|
@ -90,7 +89,8 @@ package() {
|
||||||
}
|
}
|
||||||
|
|
||||||
sha512sums="
|
sha512sums="
|
||||||
f5b4428217d9abd18aed1dcd8a5c77132b90173d07627ff9164919a87f04d242f9d616e9655751ec06ff57fc3e242090cc4d7e1d7045fdae9bc2e281e7855281 freecad-0.21.0.tar.gz
|
bd7e9029b24d49ac0955797bcdbea1fd0826bdf9ab246135366dfc35b427004f103acccfc66d008e3ab3928f99e04200e335908a03166545554e2d3e969ae0f5 freecad-0.21.2.tar.gz
|
||||||
27dffdbb124096e7fcbec3589cdcfc587ea09bf039c1c1108edb68a9a4fd1278f66a39642636f98b8759a44da92485fd748f8b3d615b0625bc37fc717130e237 freecad-cstdint.patch
|
|
||||||
73aaba7015dce7048eb7d2456131b5b5ba4673cc980503331987be54d99daed5f61db015ca33d7d2ef0f02bd3192da8ce122c103c3b93f9959927deb4f0b933e no-execinfo.patch
|
73aaba7015dce7048eb7d2456131b5b5ba4673cc980503331987be54d99daed5f61db015ca33d7d2ef0f02bd3192da8ce122c103c3b93f9959927deb4f0b933e no-execinfo.patch
|
||||||
|
8ba13b17bad66316757d180c1b9e9e72a24382627eac7c43a2264b3b5101e6e8f701775f2b805ed733f500fbcd8b0e8e422ec58a9ab3d948d613b666157d4c52 resourceDirectory.patch
|
||||||
|
fec515cc63830f0e715527c7890173705b24e7d99d225821ec4300104cf3affdee49243bbd4d0a331a902cf04db756a1b8f18f0a17cc71f5757f8b5c73c78ede missing-include-cstdint.patch
|
||||||
"
|
"
|
||||||
|
|
11
backports/freecad/missing-include-cstdint.patch
Normal file
11
backports/freecad/missing-include-cstdint.patch
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
diff --color -rupN a/src/3rdParty/libE57Format/include/E57Format.h b/src/3rdParty/libE57Format/include/E57Format.h
|
||||||
|
--- a/src/3rdParty/libE57Format/include/E57Format.h 2022-12-07 03:35:37.000000000 +0100
|
||||||
|
+++ b/src/3rdParty/libE57Format/include/E57Format.h 2024-02-27 14:06:29.308892531 +0100
|
||||||
|
@@ -32,6 +32,7 @@
|
||||||
|
//! @file E57Format.h header file for the E57 API
|
||||||
|
|
||||||
|
#include <cfloat>
|
||||||
|
+#include <cstdint>
|
||||||
|
#include <memory>
|
||||||
|
#include <vector>
|
||||||
|
|
11
backports/freecad/resourceDirectory.patch
Normal file
11
backports/freecad/resourceDirectory.patch
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
--- ./cMake/FreeCAD_Helpers/ConfigureCMakeVariables.cmake.orig
|
||||||
|
+++ ./cMake/FreeCAD_Helpers/ConfigureCMakeVariables.cmake
|
||||||
|
@@ -23,7 +23,7 @@
|
||||||
|
"Path to the directory containing PyCXX's cxxextensions.c source file")
|
||||||
|
|
||||||
|
# used as compiler defines
|
||||||
|
- set(RESOURCEDIR "${CMAKE_INSTALL_DATADIR}")
|
||||||
|
+ set(RESOURCEDIR "../../share/freecad")
|
||||||
|
set(LIBRARYDIR "${CMAKE_INSTALL_LIBDIR}")
|
||||||
|
set(DOCDIR "${CMAKE_INSTALL_DOCDIR}")
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
--- ./src/Mod/Mesh/App/MeshTestsApp.py.orig
|
|
||||||
+++ ./src/Mod/Mesh/App/MeshTestsApp.py
|
|
||||||
@@ -423,30 +423,6 @@
|
|
||||||
self.planarMesh = []
|
|
||||||
FreeCAD.newDocument("MeshTest")
|
|
||||||
|
|
||||||
- def testRayPick(self):
|
|
||||||
- if not FreeCAD.GuiUp:
|
|
||||||
- return
|
|
||||||
- self.planarMesh.append( [-16.097176,-29.891157,15.987688] )
|
|
||||||
- self.planarMesh.append( [-16.176304,-29.859991,15.947966] )
|
|
||||||
- self.planarMesh.append( [-16.071451,-29.900553,15.912505] )
|
|
||||||
- self.planarMesh.append( [-16.092241,-29.893408,16.020439] )
|
|
||||||
- self.planarMesh.append( [-16.007210,-29.926180,15.967641] )
|
|
||||||
- self.planarMesh.append( [-16.064457,-29.904951,16.090832] )
|
|
||||||
- planarMeshObject = Mesh.Mesh(self.planarMesh)
|
|
||||||
-
|
|
||||||
- from pivy import coin; import FreeCADGui
|
|
||||||
- Mesh.show(planarMeshObject)
|
|
||||||
- view=FreeCADGui.ActiveDocument.ActiveView.getViewer()
|
|
||||||
- rp=coin.SoRayPickAction(view.getSoRenderManager().getViewportRegion())
|
|
||||||
- rp.setRay(coin.SbVec3f(-16.05,16.0,16.0),coin.SbVec3f(0,-1,0))
|
|
||||||
- rp.apply(view.getSoRenderManager().getSceneGraph())
|
|
||||||
- pp=rp.getPickedPoint()
|
|
||||||
- self.assertTrue(pp != None)
|
|
||||||
- det=pp.getDetail()
|
|
||||||
- self.assertTrue(det.getTypeId() == coin.SoFaceDetail.getClassTypeId())
|
|
||||||
- det=coin.cast(det, det.getTypeId().getName().getString())
|
|
||||||
- self.assertTrue(det.getFaceIndex() == 1)
|
|
||||||
-
|
|
||||||
def testPrimitiveCount(self):
|
|
||||||
if not FreeCAD.GuiUp:
|
|
||||||
return
|
|
|
@ -1,42 +0,0 @@
|
||||||
# Contributor: Aiden Grossman <agrossman154@yahoo.com>
|
|
||||||
# Maintainer: Aiden Grossman <agrossman154@yahoo.com>
|
|
||||||
pkgname=py3-pivy
|
|
||||||
_pkgname=pivy
|
|
||||||
pkgver=0.6.8
|
|
||||||
pkgrel=3
|
|
||||||
pkgdesc="Python3 bindings for coin"
|
|
||||||
url="https://github.com/coin3d/pivy"
|
|
||||||
# riscv64 blocked by qt5-qtwebengine via py3-pyside2
|
|
||||||
# py3-pyside2 is not available on armhf
|
|
||||||
# py3-pyside2 broken
|
|
||||||
#arch="all !armhf !riscv64"
|
|
||||||
license="ISC"
|
|
||||||
depends="py3-pyside2"
|
|
||||||
makedepends="swig soqt-dev qt5-qtbase-dev python3-dev glu-dev cmake samurai"
|
|
||||||
checkdepends="py3-pytest"
|
|
||||||
options="!check" # test suite is interactive and requires full installation
|
|
||||||
source="$pkgname-$pkgver.tar.gz::https://github.com/coin3d/pivy/archive/refs/tags/$pkgver.tar.gz
|
|
||||||
qt5.patch
|
|
||||||
"
|
|
||||||
builddir="$srcdir/$_pkgname-$pkgver"
|
|
||||||
|
|
||||||
build() {
|
|
||||||
if [ "$CBUILD" != "$CHOST" ]; then
|
|
||||||
CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
|
|
||||||
fi
|
|
||||||
cmake -B build -G Ninja \
|
|
||||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
|
||||||
-DBUILD_SHARED_LIBS=True \
|
|
||||||
-DCMAKE_BUILD_TYPE=None \
|
|
||||||
$CMAKE_CROSSOPTS
|
|
||||||
cmake --build build
|
|
||||||
}
|
|
||||||
|
|
||||||
package() {
|
|
||||||
DESTDIR="$pkgdir" cmake --install build
|
|
||||||
}
|
|
||||||
|
|
||||||
sha512sums="
|
|
||||||
723b09028f2e3075056b9588cebad0ddccbc98d0c15552b9565c177b0de764b9645f88ea2bc534ccf606f2e0b59f91e1d03551b55ece66c0654ce9cdf09a1a7c py3-pivy-0.6.8.tar.gz
|
|
||||||
7750ded3eb09da510ba5f84e7957c2ae1f92be0df280901fd9c9eba4164758a8f2d436e2d6ae7634a91aed12609f4eefd181922e6caed0b4906c6bc9dbd7b562 qt5.patch
|
|
||||||
"
|
|
|
@ -1,11 +0,0 @@
|
||||||
--- ./qtinfo.py
|
|
||||||
+++ ./qtinfo.py
|
|
||||||
@@ -7,7 +7,7 @@
|
|
||||||
if qmake_command:
|
|
||||||
self._qmake_command = qmake_command
|
|
||||||
else:
|
|
||||||
- self._qmake_command = [find_executable("qmake"),]
|
|
||||||
+ self._qmake_command = [find_executable("qmake-qt5"),]
|
|
||||||
self._dict = {}
|
|
||||||
# bind all variables early at __init__ time.
|
|
||||||
for thing in self.__class__.__dict__:
|
|
|
@ -1,75 +0,0 @@
|
||||||
# Maintainer: Luca Weiss <luca@z3ntu.xyz>
|
|
||||||
pkgname=py3-pyside2
|
|
||||||
pkgver=5.15.11
|
|
||||||
pkgrel=0
|
|
||||||
pkgdesc="Enables the use of Qt5 APIs in Python applications"
|
|
||||||
url="https://doc.qt.io/qtforpython-5/"
|
|
||||||
# armhf blocked by shiboken2
|
|
||||||
#arch="all !armhf"
|
|
||||||
license="LGPL-3.0-only AND GPL-2.0-only"
|
|
||||||
_llvmver=15
|
|
||||||
depends="py3-shiboken2"
|
|
||||||
makedepends="
|
|
||||||
clang$_llvmver-dev
|
|
||||||
cmake
|
|
||||||
libshiboken2-dev
|
|
||||||
qt5-qt3d-dev
|
|
||||||
qt5-qtbase-dev
|
|
||||||
qt5-qtcharts-dev
|
|
||||||
qt5-qtdatavis3d-dev
|
|
||||||
qt5-qtdeclarative-dev
|
|
||||||
qt5-qtlocation-dev
|
|
||||||
qt5-qtmultimedia-dev
|
|
||||||
qt5-qtquickcontrols2-dev
|
|
||||||
qt5-qtremoteobjects-dev
|
|
||||||
qt5-qtscript-dev
|
|
||||||
qt5-qtscxml-dev
|
|
||||||
qt5-qtsensors-dev
|
|
||||||
qt5-qtserialport-dev
|
|
||||||
qt5-qtspeech-dev
|
|
||||||
qt5-qtsvg-dev
|
|
||||||
qt5-qttools-dev
|
|
||||||
qt5-qtwebchannel-dev
|
|
||||||
qt5-qtwebsockets-dev
|
|
||||||
qt5-qtx11extras-dev
|
|
||||||
qt5-qtxmlpatterns-dev
|
|
||||||
samurai
|
|
||||||
shiboken2
|
|
||||||
py3-setuptools
|
|
||||||
py3-zope-event
|
|
||||||
"
|
|
||||||
case "$CARCH" in
|
|
||||||
armv7|aarch64|x86|x86_64)
|
|
||||||
makedepends="$makedepends qt5-qtwebengine-dev"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
subpackages="$pkgname-dev"
|
|
||||||
source="https://download.qt.io/official_releases/QtForPython/pyside2/PySide2-$pkgver-src/pyside-setup-opensource-src-$pkgver.tar.xz"
|
|
||||||
builddir="$srcdir/pyside-setup-opensource-src-$pkgver"
|
|
||||||
options="!check" # Tests fail
|
|
||||||
|
|
||||||
build() {
|
|
||||||
export LLVM_INSTALL_DIR=/usr/lib/llvm$_llvmver
|
|
||||||
cmake -B build -G Ninja \
|
|
||||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
|
||||||
-DBUILD_SHARED_LIBS=True \
|
|
||||||
-DCMAKE_BUILD_TYPE=None \
|
|
||||||
-DPYTHON_EXECUTABLE=/usr/bin/python3 \
|
|
||||||
-DBUILD_TESTS=OFF \
|
|
||||||
sources/pyside2
|
|
||||||
cmake --build build
|
|
||||||
}
|
|
||||||
|
|
||||||
package() {
|
|
||||||
DESTDIR="$pkgdir" cmake --install build
|
|
||||||
|
|
||||||
# Install egg info
|
|
||||||
export PATH="/usr/lib/qt5/bin:$PATH"
|
|
||||||
python3 setup.py egg_info --build-type=pyside2
|
|
||||||
pythonpath="$(python3 -c "from sysconfig import get_path; print(get_path('platlib'))")"
|
|
||||||
cp -r PySide2.egg-info "$pkgdir/$pythonpath"
|
|
||||||
}
|
|
||||||
|
|
||||||
sha512sums="
|
|
||||||
377b3f6a793313cf7f5bea0dcef6630bac32d79b247e213d0b1b719805b35692aa8dd9a8896c75c6266f05af38809f574051d64b1a2f958a48c90167feccfb91 pyside-setup-opensource-src-5.15.11.tar.xz
|
|
||||||
"
|
|
|
@ -1,94 +0,0 @@
|
||||||
# Contributor: Leo <thinkabit.ukim@gmail.com>
|
|
||||||
# Maintainer:
|
|
||||||
pkgname=shiboken2
|
|
||||||
pkgver=5.15.10
|
|
||||||
pkgrel=0
|
|
||||||
pkgdesc="CPython bindings generator for C++ libraries"
|
|
||||||
url="https://wiki.qt.io/Qt_for_Python/Shiboken"
|
|
||||||
arch="all !armhf" # qt5-qtxmlpatterns -> qt5-qtdeclarative
|
|
||||||
license="GPL-2.0-or-later"
|
|
||||||
_llvmver=15
|
|
||||||
depends_dev="python3-dev"
|
|
||||||
makedepends="
|
|
||||||
$depends_dev
|
|
||||||
clang$_llvmver-dev
|
|
||||||
cmake
|
|
||||||
libxml2-dev
|
|
||||||
libxslt-dev
|
|
||||||
llvm$_llvmver-dev
|
|
||||||
py3-numpy-dev
|
|
||||||
py3-setuptools
|
|
||||||
qt5-qtbase-dev
|
|
||||||
qt5-qtxmlpatterns-dev
|
|
||||||
samurai
|
|
||||||
"
|
|
||||||
subpackages="lib$pkgname:libs lib$pkgname-dev py3-$pkgname:py3"
|
|
||||||
source="https://download.qt.io/official_releases/QtForPython/pyside2/PySide2-$pkgver-src/pyside-setup-opensource-src-$pkgver.tar.xz
|
|
||||||
numpy-1.23.patch
|
|
||||||
py3.11.patch
|
|
||||||
"
|
|
||||||
builddir="$srcdir/pyside-setup-opensource-src-$pkgver"
|
|
||||||
|
|
||||||
provides="shiboken=$pkgver-r$pkgrel" # For backward compatibility
|
|
||||||
replaces="shiboken" # For backward compatibility
|
|
||||||
|
|
||||||
prepare() {
|
|
||||||
default_prepare
|
|
||||||
sed -e 's|0x030AFFFF|0x030BFFFF|' -i sources/shiboken2/libshiboken/pep384impl.h
|
|
||||||
}
|
|
||||||
|
|
||||||
build() {
|
|
||||||
export LLVM_INSTALL_DIR=/usr/lib/llvm$_llvmver
|
|
||||||
cmake -B build -S sources/shiboken2 \
|
|
||||||
-G Ninja \
|
|
||||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
|
||||||
-DCMAKE_BUILD_TYPE=None \
|
|
||||||
-DBUILD_TESTS=OFF \
|
|
||||||
-DUSE_PYTHON_VERSION=3
|
|
||||||
cmake --build build
|
|
||||||
}
|
|
||||||
|
|
||||||
package() {
|
|
||||||
DESTDIR="$pkgdir" cmake --install build
|
|
||||||
}
|
|
||||||
|
|
||||||
libs() {
|
|
||||||
license="LGPL-2.1-or-later"
|
|
||||||
default_libs
|
|
||||||
}
|
|
||||||
|
|
||||||
dev() {
|
|
||||||
license="LGPL-2.1-or-later"
|
|
||||||
default_dev
|
|
||||||
provides="shiboken-dev=$pkgver-r$pkgrel"
|
|
||||||
replaces="shiboken-dev"
|
|
||||||
depends="
|
|
||||||
$depends_dev
|
|
||||||
lib$pkgname=$pkgver-r$pkgrel
|
|
||||||
$pkgname=$pkgver-r$pkgrel
|
|
||||||
py3-$pkgname=$pkgver-r$pkgrel
|
|
||||||
"
|
|
||||||
}
|
|
||||||
|
|
||||||
py3() {
|
|
||||||
license="LGPL-2.1-or-later"
|
|
||||||
depends=""
|
|
||||||
pkgdesc="Python3 shiboken bindings"
|
|
||||||
mkdir -p "$subpkgdir"/usr/lib
|
|
||||||
mv "$pkgdir"/usr/lib/python3* "$subpkgdir"/usr/lib
|
|
||||||
provides="py3-shiboken=$pkgver-r$pkgrel" # For backward compatibility
|
|
||||||
replaces="py3-shiboken" # For backward compatibility
|
|
||||||
|
|
||||||
# Install egg info
|
|
||||||
cd "$builddir"
|
|
||||||
export PATH="/usr/lib/qt5/bin:$PATH"
|
|
||||||
python3 setup.py egg_info --build-type=shiboken2
|
|
||||||
pythonpath="$(python3 -c "from sysconfig import get_path; print(get_path('platlib'))")"
|
|
||||||
cp -r shiboken2.egg-info "$subpkgdir/$pythonpath"
|
|
||||||
}
|
|
||||||
|
|
||||||
sha512sums="
|
|
||||||
dc548ab870fcc5cc637de1bcb2f428527c650287fdb3720a3ade4638cc0bb12bc4a1ed87e7f6a4ec730a26742e08ceec806bcac6af91c7a01ddc0ce7980a79d2 pyside-setup-opensource-src-5.15.10.tar.xz
|
|
||||||
449b4f4b1717b131c05e798549d49186f73215b893843ccae4c434dd95ad3f4dce0f886fe5cbd3443100d4852cb6b3d6a6d2f0a102f69f2a095bb6c500d69244 numpy-1.23.patch
|
|
||||||
985ff9a10da017db2fcf1526aa1d3502a22c29c7a640e9f8a46bc67ed2acea74f6eec4daa1baf04b90fbdbffe80ecce07aaa0f267783ff66f279120f1ff64ec5 py3.11.patch
|
|
||||||
"
|
|
|
@ -1,15 +0,0 @@
|
||||||
diff --git a/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp b/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp
|
|
||||||
index 996968f..a072dfd 100644
|
|
||||||
--- a/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp
|
|
||||||
+++ b/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp
|
|
||||||
@@ -116,8 +116,8 @@ std::ostream &operator<<(std::ostream &str, PyArrayObject *o)
|
|
||||||
str << " NPY_ARRAY_NOTSWAPPED";
|
|
||||||
if ((flags & NPY_ARRAY_WRITEABLE) != 0)
|
|
||||||
str << " NPY_ARRAY_WRITEABLE";
|
|
||||||
- if ((flags & NPY_ARRAY_UPDATEIFCOPY) != 0)
|
|
||||||
- str << " NPY_ARRAY_UPDATEIFCOPY";
|
|
||||||
+ if ((flags & NPY_ARRAY_WRITEBACKIFCOPY) != 0)
|
|
||||||
+ str << " NPY_ARRAY_WRITEBACKIFCOPY";
|
|
||||||
} else {
|
|
||||||
str << '0';
|
|
||||||
}
|
|
|
@ -1,162 +0,0 @@
|
||||||
From b64ad27d8dfeeecaaa8a98051252a32c9d998df4 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
||||||
Date: Thu, 9 Jun 2022 16:50:41 +0200
|
|
||||||
Subject: [PATCH] libshiboken: Fix a crash in Shiboken::Object::isValid() for
|
|
||||||
Python 3.11
|
|
||||||
|
|
||||||
The function is passed type objects for class methods, which caused
|
|
||||||
it to crash.
|
|
||||||
|
|
||||||
The first clause did not catch this, and so it was cast to SbkObject
|
|
||||||
below.
|
|
||||||
|
|
||||||
Add a type check to prevent this.
|
|
||||||
|
|
||||||
Pick-to: 6.3 6.2 5.15
|
|
||||||
Task-number: PYSIDE-1960
|
|
||||||
Change-Id: Icfdd6fefb7156ac5961444bd5395109849a1d66e
|
|
||||||
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
||||||
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
|
|
||||||
---
|
|
||||||
sources/shiboken2/libshiboken/basewrapper.cpp | 1 +
|
|
||||||
1 file changed, 1 insertion(+)
|
|
||||||
|
|
||||||
diff --git a/build_scripts/config.py b/build_scripts/config.py
|
|
||||||
index 00cbd3f..63e52a2 100644
|
|
||||||
--- a/build_scripts/config.py
|
|
||||||
+++ b/build_scripts/config.py
|
|
||||||
@@ -94,6 +94,8 @@ class Config(object):
|
|
||||||
'Programming Language :: Python :: 3.8',
|
|
||||||
'Programming Language :: Python :: 3.9',
|
|
||||||
'Programming Language :: Python :: 3.10',
|
|
||||||
+ 'Programming Language :: Python :: 3.11',
|
|
||||||
+ 'Programming Language :: Python :: 3.12',
|
|
||||||
]
|
|
||||||
|
|
||||||
self.setup_script_dir = None
|
|
||||||
diff --git a/sources/pyside2/libpyside/pysideqflags.cpp b/sources/pyside2/libpyside/pysideqflags.cpp
|
|
||||||
index 8b224f2..784082a 100644
|
|
||||||
--- a/sources/pyside2/libpyside/pysideqflags.cpp
|
|
||||||
+++ b/sources/pyside2/libpyside/pysideqflags.cpp
|
|
||||||
@@ -192,7 +192,7 @@ namespace QFlags
|
|
||||||
}
|
|
||||||
newspec.slots = SbkNewQFlagsType_spec.slots;
|
|
||||||
PyTypeObject *type = (PyTypeObject *)SbkType_FromSpec(&newspec);
|
|
||||||
- Py_TYPE(type) = &PyType_Type;
|
|
||||||
+ Py_SET_TYPE(type, &PyType_Type);
|
|
||||||
|
|
||||||
PySideQFlagsType *flagsType = reinterpret_cast<PySideQFlagsType *>(type);
|
|
||||||
PepType_PFTP(flagsType)->converterPtr = &PepType_PFTP(flagsType)->converter;
|
|
||||||
diff --git a/sources/pyside2/libpyside/pysidesignal.cpp b/sources/pyside2/libpyside/pysidesignal.cpp
|
|
||||||
index b5069a0..ce89a9d 100644
|
|
||||||
--- a/sources/pyside2/libpyside/pysidesignal.cpp
|
|
||||||
+++ b/sources/pyside2/libpyside/pysidesignal.cpp
|
|
||||||
@@ -162,7 +162,7 @@ PyTypeObject *PySideSignalTypeF(void)
|
|
||||||
if (!type) {
|
|
||||||
type = reinterpret_cast<PyTypeObject *>(SbkType_FromSpec(&PySideSignalType_spec));
|
|
||||||
PyTypeObject *hold = Py_TYPE(type);
|
|
||||||
- Py_TYPE(type) = PySideMetaSignalTypeF();
|
|
||||||
+ Py_SET_TYPE(type, PySideMetaSignalTypeF());
|
|
||||||
Py_INCREF(Py_TYPE(type));
|
|
||||||
Py_DECREF(hold);
|
|
||||||
}
|
|
||||||
diff --git a/sources/pyside2/libpyside/pysideweakref.cpp b/sources/pyside2/libpyside/pysideweakref.cpp
|
|
||||||
index cd90634..730990f 100644
|
|
||||||
--- a/sources/pyside2/libpyside/pysideweakref.cpp
|
|
||||||
+++ b/sources/pyside2/libpyside/pysideweakref.cpp
|
|
||||||
@@ -90,7 +90,7 @@ PyObject *create(PyObject *obj, PySideWeakRefFunction func, void *userData)
|
|
||||||
|
|
||||||
if (Py_TYPE(PySideCallableObjectTypeF()) == 0)
|
|
||||||
{
|
|
||||||
- Py_TYPE(PySideCallableObjectTypeF()) = &PyType_Type;
|
|
||||||
+ Py_SET_TYPE(PySideCallableObjectTypeF(), &PyType_Type);
|
|
||||||
PyType_Ready(PySideCallableObjectTypeF());
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/sources/shiboken2/libshiboken/basewrapper.cpp b/sources/shiboken2/libshiboken/basewrapper.cpp
|
|
||||||
index 7ac7fad..e2eccd0 100644
|
|
||||||
--- a/sources/shiboken2/libshiboken/basewrapper.cpp
|
|
||||||
+++ b/sources/shiboken2/libshiboken/basewrapper.cpp
|
|
||||||
@@ -377,7 +377,7 @@ SbkObjectType *SbkObject_TypeF(void)
|
|
||||||
static PyTypeObject *type = nullptr;
|
|
||||||
if (!type) {
|
|
||||||
type = reinterpret_cast<PyTypeObject *>(SbkType_FromSpec(&SbkObject_Type_spec));
|
|
||||||
- Py_TYPE(type) = SbkObjectType_TypeF();
|
|
||||||
+ Py_SET_TYPE(type, SbkObjectType_TypeF());
|
|
||||||
Py_INCREF(Py_TYPE(type));
|
|
||||||
type->tp_weaklistoffset = offsetof(SbkObject, weakreflist);
|
|
||||||
type->tp_dictoffset = offsetof(SbkObject, ob_dict);
|
|
||||||
@@ -1160,7 +1160,7 @@ introduceWrapperType(PyObject *enclosingObject,
|
|
||||||
typeSpec->slots[0].pfunc = reinterpret_cast<void *>(baseType ? baseType : SbkObject_TypeF());
|
|
||||||
|
|
||||||
PyObject *heaptype = SbkType_FromSpecWithBases(typeSpec, baseTypes);
|
|
||||||
- Py_TYPE(heaptype) = SbkObjectType_TypeF();
|
|
||||||
+ Py_SET_TYPE(heaptype, SbkObjectType_TypeF());
|
|
||||||
Py_INCREF(Py_TYPE(heaptype));
|
|
||||||
auto *type = reinterpret_cast<SbkObjectType *>(heaptype);
|
|
||||||
#if PY_VERSION_HEX < 0x03000000
|
|
||||||
@@ -1525,6 +1525,7 @@ bool setCppPointer(SbkObject *sbkObj, PyTypeObject *desiredType, void *cptr)
|
|
||||||
bool isValid(PyObject *pyObj)
|
|
||||||
{
|
|
||||||
if (!pyObj || pyObj == Py_None
|
|
||||||
+ || PyType_Check(pyObj) != 0
|
|
||||||
|| Py_TYPE(Py_TYPE(pyObj)) != SbkObjectType_TypeF()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
diff --git a/sources/shiboken2/libshiboken/sbkenum.cpp b/sources/shiboken2/libshiboken/sbkenum.cpp
|
|
||||||
index 7dc73df..9459e42 100644
|
|
||||||
--- a/sources/shiboken2/libshiboken/sbkenum.cpp
|
|
||||||
+++ b/sources/shiboken2/libshiboken/sbkenum.cpp
|
|
||||||
@@ -754,7 +754,7 @@ newTypeWithName(const char *name,
|
|
||||||
PyTuple_SetItem(bases, 0, reinterpret_cast<PyObject *>(basetype));
|
|
||||||
auto *type = reinterpret_cast<PyTypeObject *>(SbkType_FromSpecWithBases(&newspec, bases));
|
|
||||||
PyErr_Print();
|
|
||||||
- Py_TYPE(type) = SbkEnumType_TypeF();
|
|
||||||
+ Py_SET_TYPE(type, SbkEnumType_TypeF());
|
|
||||||
|
|
||||||
auto *enumType = reinterpret_cast<SbkEnumType *>(type);
|
|
||||||
PepType_SETP(enumType)->cppName = cppName;
|
|
||||||
diff --git a/sources/shiboken2/libshiboken/sbkstring.cpp b/sources/shiboken2/libshiboken/sbkstring.cpp
|
|
||||||
index 077fb53..a9d451c 100644
|
|
||||||
--- a/sources/shiboken2/libshiboken/sbkstring.cpp
|
|
||||||
+++ b/sources/shiboken2/libshiboken/sbkstring.cpp
|
|
||||||
@@ -41,8 +41,14 @@
|
|
||||||
#include "sbkstaticstrings_p.h"
|
|
||||||
#include "autodecref.h"
|
|
||||||
|
|
||||||
-#include <vector>
|
|
||||||
-#include <unordered_set>
|
|
||||||
+#if PY_VERSION_HEX >= 0x030B0000 || defined(Py_LIMITED_API)
|
|
||||||
+# define USE_INTERN_STRINGS
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+#ifndef USE_INTERN_STRINGS
|
|
||||||
+# include <vector>
|
|
||||||
+# include <unordered_set>
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
namespace Shiboken
|
|
||||||
{
|
|
||||||
@@ -233,6 +239,13 @@ Py_ssize_t len(PyObject *str)
|
|
||||||
// PyObject *attr = PyObject_GetAttr(obj, name());
|
|
||||||
//
|
|
||||||
|
|
||||||
+#ifdef USE_INTERN_STRINGS
|
|
||||||
+PyObject *createStaticString(const char *str)
|
|
||||||
+{
|
|
||||||
+ return PyUnicode_InternFromString(str);
|
|
||||||
+}
|
|
||||||
+#else
|
|
||||||
+
|
|
||||||
using StaticStrings = std::unordered_set<PyObject *>;
|
|
||||||
|
|
||||||
static void finalizeStaticStrings(); // forward
|
|
||||||
@@ -283,6 +296,8 @@ PyObject *createStaticString(const char *str)
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
+#endif // !USE_INTERN_STRINGS
|
|
||||||
+
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// PYSIDE-1019: Helper function for snake_case vs. camelCase names
|
|
Loading…
Reference in a new issue