python-qt-binding: support both

In e78372fd63,
the sip_configure.py cmake helper script in python-qt-binding was
updated to live-patch the QtCoremod.sip file in a temp directory. Which
is the same change that is applied from the aur here. The live patch
thing breaks the build as it is writing to a file outside of the nix
build area. Remove that write and apply the patch from the AUR.

Also moved the ros1 rviz pyqt patch into the regular python-qt-binding
overlay to allow any downstream packages to have functional pyqt if that
is what ends up being used.
This commit is contained in:
Mitchell Pleune 2024-05-30 13:37:57 -04:00 committed by Ben Wolsieffer
parent dc78c560eb
commit e309da560b
2 changed files with 24 additions and 33 deletions

View file

@ -171,12 +171,23 @@ let
pr2-tilt-laser-interface = patchBoostSignals rosSuper.pr2-tilt-laser-interface;
python-qt-binding = rosSuper.python-qt-binding.overrideAttrs ({
propagatedNativeBuildInputs ? [], ...
python-qt-binding = (rosSuper.python-qt-binding.override {
python3Packages = rosSelf.python3Packages.overrideScope (pyFinal: pyPrev: {
pyqt5 = pyPrev.pyqt5.overrideAttrs ({
patches ? [], ...
}: {
patches = patches ++ [ (self.fetchpatch {
url = "https://aur.archlinux.org/cgit/aur.git/plain/restore-sip4-support.patch?h=python-pyqt5-sip4&id=6e712e6c588d550a1a6f83c1b37c2c9135aae6ba";
hash = "sha256-NfMe/EK1Uj88S82xZSm+A6js3PK9mlgsaci/kinlsy8=";
}) ];
});
});
}).overrideAttrs ({
propagatedBuildInputs ? [], ...
}: {
propagatedNativeBuildInputs = propagatedNativeBuildInputs ++ (with rosSelf.pythonPackages; [
shiboken2
propagatedBuildInputs = propagatedBuildInputs ++ (with rosSelf.pythonPackages; [
pyside2
sip4
]);
dontWrapQtApps = true;
@ -188,6 +199,14 @@ let
}
preFixupHooks+=(_pythonQtBindingPreFixupHook)
'';
postPatch = ''
sed -e "1 i\\import PyQt5" \
-e "s#sipconfig\._pkg_config\['default_mod_dir'\], 'PyQt5'#PyQt5.__path__[0]#" \
-e "s#with open(os.path.join(tmpdirname, 'QtCore', 'QtCoremod.sip'), 'w') as outfp:##" \
-e "s#outfp.write(output)##" \
-i cmake/sip_configure.py
'';
});
rqt-console = rosSuper.rqt-console.overrideAttrs ({

View file

@ -168,35 +168,7 @@ rosSelf: rosSuper: with rosSelf.lib; {
'';
});
# rviz does not support shiboken/pyside2 and SIP4 is broken with the latest
# pyqt5. This applies a patch to make pyqt5 compatible with SIP 4 and uses
# SIP 4 with python-qt-binding for rviz only.
rviz = (rosSuper.rviz.override {
python-qt-binding = (rosSuper.python-qt-binding.override {
python3Packages = rosSelf.python3Packages.overrideScope (pyFinal: pyPrev: {
pyqt5 = pyPrev.pyqt5.overrideAttrs ({
patches ? [], ...
}: {
patches = patches ++ [ (self.fetchpatch {
url = "https://aur.archlinux.org/cgit/aur.git/plain/restore-sip4-support.patch?h=python-pyqt5-sip4&id=6e712e6c588d550a1a6f83c1b37c2c9135aae6ba";
hash = "sha256-NfMe/EK1Uj88S82xZSm+A6js3PK9mlgsaci/kinlsy8=";
}) ];
});
});
}).overrideAttrs({
propagatedNativeBuildInputs ? [],
postPatch ? "", ...
}: {
propagatedNativeBuildInputs = with rosSelf.pythonPackages;
(rosSelf.lib.subtractLists [ shiboken2 pyside2 ] propagatedNativeBuildInputs)
++ [ sip_4 ];
postPatch = ''
sed -e "1 i\\import PyQt5" \
-e "s#sipconfig\._pkg_config\['default_mod_dir'\], 'PyQt5'#PyQt5.__path__[0]#" \
-i cmake/sip_configure.py
'' + postPatch;
});
}).overrideAttrs ({
rviz = rosSuper.rviz.overrideAttrs ({
nativeBuildInputs ? [],
postFixup ? "", ...
}: {