Skip to content

Commit

Permalink
python-qt-binding: support both
Browse files Browse the repository at this point in the history
In ros-visualization/python_qt_binding@e78372f,
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.
  • Loading branch information
Mitchell Pleune authored and lopsided98 committed Sep 14, 2024
1 parent dc78c56 commit e309da5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 33 deletions.
27 changes: 23 additions & 4 deletions distros/distro-overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 ({
Expand Down
30 changes: 1 addition & 29 deletions distros/ros1-overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? "", ...
}: {
Expand Down

0 comments on commit e309da5

Please sign in to comment.