diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | ros-humble-python-qt-binding.spec | 105 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 107 insertions, 0 deletions
@@ -0,0 +1 @@ +/ros-humble-python-qt-binding-0.3.0.tar.gz diff --git a/ros-humble-python-qt-binding.spec b/ros-humble-python-qt-binding.spec new file mode 100644 index 0000000..cf53894 --- /dev/null +++ b/ros-humble-python-qt-binding.spec @@ -0,0 +1,105 @@ +# ROS humble Python 包:python_qt_binding +# 上游:https://github.com/ros-visualization/python_qt_binding(tag 0.3.0) +# 上游为 catkin 包(buildtool_depend=catkin),ROS 2 humble 无 catkin, +# 直接用 setup.py 构建 Python 包 + 手动安装 cmake 工件(catkin_package/ament_package 等价) +# topdir: ros-humble-python-qt-binding-0.3.0 +%define ros_distro humble +%define RosPkgName python-qt-binding + +Name: ros-%{ros_distro}-%{RosPkgName} +Version: 0.3.0 +Release: 1%{?dist} +Summary: Python bindings for Qt with PyQt/PySide adapter, used by ROS GUI tools +License: BSD +URL: https://github.com/ros-visualization/python_qt_binding +# --transform 统一顶层目录为 %%{name}-%%{version};#/ 强制 rpm 内部文件名 +Source0: https://github.com/ros-visualization/python_qt_binding/archive/refs/tags/0.3.0.tar.gz#/%{name}-%{version}.tar.gz + +# debug 子包无意义(/opt 前缀,strip/debugedit 路径非常规),SIG 模板统一关闭 +%global debug_package %{nil} +# /opt 下 python 字节码编译会写标准 sitelib 路径,摘掉 brp-python-bytecompile +%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') +# ROS 包不做自动依赖扫描(.so 全在 /opt/ros 下,由 ament 间接依赖模型替代) +%global __provides_exclude_from ^/opt/ros/%{ros_distro}/.*$ +%global __requires_exclude_from ^/opt/ros/%{ros_distro}/.*$ + +# 构建依赖:纯 Python 包(catkin 被 setup.py 直调替代),不编译 C/C++ +BuildRequires: python3-devel +BuildRequires: python3-setuptools +# package.xml <build_depend>qtbase5-dev</build_depend> -> openEuler qt5-qtbase-devel +# cmake 辅助文件(sip_helper.cmake 等)引用 Qt5,构建时需头文件存在 +BuildRequires: qt5-qtbase-devel + +# 运行时 Requires(/opt/ros 被 __requires_exclude_from 豁免、autodeps 扫不到,必须手写) +Requires: ros-%{ros_distro}-ros-workspace +Requires: ros-%{ros_distro}-ament-cmake +# package.xml <run_depend>python-qt5-bindings</run_depend> -> openEuler python3-qt5 +Requires: python3-qt5 + +# 单包策略:ROS 包严禁拆实体子包,用虚拟别名兼容依赖方 +Provides: %{name}-devel = %{version}-%{release} +Provides: %{name}-doc = %{version}-%{release} +Provides: %{name}-runtime = %{version}-%{release} + +%description +This stack provides Python bindings for Qt. There are two providers: pyside +and pyqt. PySide is released under the LGPL. PyQt is released under the GPL. +Both the bindings and tools to build bindings are included from each available +provider. For PySide, it is called "Shiboken". For PyQt, this is called "SIP". +Also provided is adapter code to make the user's Python code independent of +which binding provider was actually used. +This is the humble (ROS 2) release of the python_qt_binding package, installed +under /opt/ros/humble. + +%prep +%autosetup -n %{name}-%{version} + +%build +# ROS 基座环境(chroot 已配置 ROS SIG repo;setup.sh 不存在时用守卫) +[ -f /opt/ros/%{ros_distro}/setup.sh ] && source /opt/ros/%{ros_distro}/setup.sh || true +export PYTHONPATH=/opt/ros/%{ros_distro}/lib/python%{python3_version}/site-packages${PYTHONPATH:+:$PYTHONPATH} + +# 上游为 catkin 包(package.xml buildtool_depend=catkin),ROS 2 humble 无 catkin。 +# catkin_python_setup() 的等价手动实现:直接调 setup.py build。 +# setup.py 有 catkin_pkg 缺失时的 package.xml 解析 fallback,不依赖 catkin_pkg。 +%{__python3} setup.py build + +%install +# 安装 Python 包到 ROS 前缀(catkin_python_setup install 的等价手动实现) +%{__python3} setup.py install \ + --root=%{buildroot} \ + --install-lib=/opt/ros/%{ros_distro}/lib/python%{python3_version}/site-packages \ + --install-scripts=/opt/ros/%{ros_distro}/bin \ + --no-compile + +# 安装 cmake 辅助文件(CMakeLists.txt install(FILES cmake/... DESTINATION share/...) 的手动等价) +install -d %{buildroot}/opt/ros/%{ros_distro}/share/python_qt_binding/cmake +install -m644 cmake/shiboken_helper.cmake %{buildroot}/opt/ros/%{ros_distro}/share/python_qt_binding/cmake/ +install -m644 cmake/sip_configure.py %{buildroot}/opt/ros/%{ros_distro}/share/python_qt_binding/cmake/ +install -m644 cmake/sip_helper.cmake %{buildroot}/opt/ros/%{ros_distro}/share/python_qt_binding/cmake/ + +# 生成 python_qt_bindingConfig.cmake(catkin_package(CFG_EXTRAS ...) 正常生成此文件, +# ROS 2 无 catkin 故手动创建——qt_gui_cpp find_package(python_qt_binding REQUIRED) 依赖此文件) +cat > %{buildroot}/opt/ros/%{ros_distro}/share/python_qt_binding/cmake/python_qt_bindingConfig.cmake << 'CMEOF' +# Manually generated (catkin not available in ROS 2 humble) +set(python_qt_binding_DIR "${CMAKE_CURRENT_LIST_DIR}") +include("${python_qt_binding_DIR}/python_qt_binding-extras.cmake") +CMEOF + +# 生成 python_qt_binding-extras.cmake(从 .em 模板处理,installspace 模式) +cat > %{buildroot}/opt/ros/%{ros_distro}/share/python_qt_binding/cmake/python_qt_binding-extras.cmake << 'EXTRASEOF' +# location of cmake files in installspace +set(python_qt_binding_EXTRAS_DIR "${python_qt_binding_DIR}") +EXTRASEOF + +# 安装 package.xml(ament_index 注册 / find_package 资源定位需要) +install -d %{buildroot}/opt/ros/%{ros_distro}/share/python_qt_binding +install -m644 package.xml %{buildroot}/opt/ros/%{ros_distro}/share/python_qt_binding/ + +%files +# %%files 整树拥有 /opt/ros/%%{ros_distro}(对"装了没打包"类错误免疫) +/opt/ros/%{ros_distro} + +%changelog +* Thu Sep 24 2026 openEuler ROS SIG <ros@openeuler.org> - 0.3.0-1 +- Initial package for openEuler 24.03 LTS (ROS 2 humble) @@ -0,0 +1 @@ +764cafbb69f4bc06182b28094562c239 ros-humble-python-qt-binding-0.3.0.tar.gz |
