Name:             python-zmq
Version:          25.1.0
Release:          2
Summary:          Python bindings for zeromq
License:          LGPLv3+ and ASL 2.0 and BSD
URL:              http://www.zeromq.org/bindings:python
Source0:          https://github.com/zeromq/pyzmq/archive/v%{version}/pyzmq-%{version}.tar.gz
Patch0:           backport-patch-for-secure_allocator.patch
BuildRequires:    zeromq-devel python3-Cython
BuildRequires:    python%{python3_pkgversion}-devel python%{python3_pkgversion}-setuptools
BuildRequires:    chrpath python3-devel gcc python3-packaging

%description
This package contains the Python bindings for 0MQ.0MQ is a
lightweight and fast messaging implementation.

%package -n python%{python3_pkgversion}-zmq
Summary:          Python bindings for zeromq
License:          LGPLv3+
%{?python_provide:%python_provide python%{python3_pkgversion}-zmq}

%description -n python%{python3_pkgversion}-zmq
This package contains the Python bindings for 0MQ.0MQ is a
lightweight and fast messaging implementation.

%package -n python%{python3_pkgversion}-zmq-devel
Summary:          Python bindings for zeromq
License:          LGPLv3+
Requires:         python%{python3_pkgversion}-zmq = %{version}-%{release}
Provides:         python%{python3_pkgversion}-zmq-tests = %{version}-%{release}
Obsoletes:        python%{python3_pkgversion}-zmq-tests < %{version}-%{release}

%description -n python%{python3_pkgversion}-zmq-devel
This package contains the testsuite for the 0MQ.0MQ is a
lightweight and fast messaging implementation.

%prep
%autosetup -n pyzmq-%{version} -p1
rm -rf bundled
for lib in zmq/eventloop/*.py; do sed -i '/\/usr\/bin\/env/d' $lib; done
chmod -x examples/pubsub/topics_{pub.py,sub.py}

%build
CFLAGS="%{optflags}" %{__python3} setup.py build_ext --inplace
%py3_build

%install
%global RPATH /zmq/{backend/cython,devices}
%py3_install
pathfix.py -pn -i %{__python3} %{buildroot}%{python3_sitearch}

%files -n python%{python3_pkgversion}-zmq
%doc README.md
%{python3_sitearch}/*
%exclude %{python3_sitearch}/zmq/tests

%files -n python%{python3_pkgversion}-zmq-devel
%{python3_sitearch}/zmq/tests

%changelog
* Fri May 10 2024 dongjiao <dongjiao@kylinos.cn> - 25.1.0-2
- backport-patch-for-secure_allocator.patch

* Wed Jul 26 2023 sunhui <sunhui@kylinos.cn> - 25.1.0-1
- Update package to version 25.1.0

* Fri Apr 07 2023 wangkai <13474090681@163.com> - 25.0.2-1
- Update to 25.0.2

* Mon May 31 2021 huanghaitao <huanghaitao8@huawei.com> - 17.0.0-6
- Completing build dependencies

* Mon Nov 9 2020 caodongxia <caodongxia@huawei.com> - 17.0.0-5
- Remove python2 subpackage

* Fri Mar 6 2020 likexin <likexin4@huawei.com> - 17.0.0-4
- package init
