54b74e4
%if 0%{?fedora} > 12 || 0%{?rhel} > 6
54b74e4
%global with_python3 1
54b74e4
%endif
54b74e4
54b74e4
a0075ca
%{?filter_setup:
a0075ca
%filter_provides_in %{python_sitearch}/.*\.so$
a0075ca
%filter_setup
a0075ca
}
54b74e4
54b74e4
%global checkout 18f5d061558a176f5496aa8e049182c1a7da64f6
54b74e4
54b74e4
%global srcname pyzmq
54b74e4
48bbb9f
%global run_tests 1
bc2b5f7
54b74e4
Name:           python-zmq
48bbb9f
Version:        2.1.4
a0075ca
Release:        1%{?dist}
54b74e4
Summary:        Software library for fast, message-based applications
54b74e4
54b74e4
Group:          Development/Libraries
54b74e4
License:        LGPLv3+ and ASL 2.0
54b74e4
URL:            http://www.zeromq.org/bindings:python
54b74e4
# VCS:          git:http://github.com/zeromq/pyzmq.git
54b74e4
# git checkout with the commands:
54b74e4
# git clone http://github.com/zeromq/pyzmq.git pyzmq.git
54b74e4
# cd pyzmq.git
54b74e4
# git archive --format=tar --prefix=pyzmq-%%{version}/ %%{checkout} | xz -z --force - > pyzmq-%%{version}.tar.xz
a0075ca
Source0:        http://cloud.github.com/downloads/zeromq/pyzmq/pyzmq-%{version}.tar.gz
48bbb9f
# upstream forgot to add this file into the tarball, fetched from current git
48bbb9f
Source1:        buildutils.py
54b74e4
54b74e4
BuildRequires:  python2-devel
54b74e4
BuildRequires:  python-setuptools
54b74e4
BuildRequires:  zeromq-devel
54b74e4
BuildRequires:  python-nose
54b74e4
54b74e4
%if 0%{?with_python3}
54b74e4
BuildRequires:  python3-devel
54b74e4
BuildRequires:  python3-setuptools
54b74e4
# needed for 2to3
54b74e4
BuildRequires:  python-tools
54b74e4
# not yet build
54b74e4
#BuildRequires:  python3-nose
54b74e4
%endif
54b74e4
54b74e4
%description
54b74e4
The 0MQ lightweight messaging kernel is a library which extends the
54b74e4
standard socket interfaces with features traditionally provided by
54b74e4
specialized messaging middle-ware products. 0MQ sockets provide an
54b74e4
abstraction of asynchronous message queues, multiple messaging
54b74e4
patterns, message filtering (subscriptions), seamless access to
54b74e4
multiple transport protocols and more.
54b74e4
54b74e4
This package contains the python bindings.
54b74e4
54b74e4
54b74e4
%if 0%{?with_python3}
54b74e4
%package -n python3-zmq
54b74e4
Summary:        Software library for fast, message-based applications
54b74e4
Group:          Development/Libraries
54b74e4
License:        LGPLv3+
54b74e4
%description -n python3-zmq
54b74e4
The 0MQ lightweight messaging kernel is a library which extends the
54b74e4
standard socket interfaces with features traditionally provided by
54b74e4
specialized messaging middle-ware products. 0MQ sockets provide an
54b74e4
abstraction of asynchronous message queues, multiple messaging
54b74e4
patterns, message filtering (subscriptions), seamless access to
54b74e4
multiple transport protocols and more.
54b74e4
54b74e4
This package contains the python bindings.
54b74e4
%endif
54b74e4
54b74e4
54b74e4
%prep
54b74e4
%setup -q -n %{srcname}-%{version}
54b74e4
# remove shebangs
54b74e4
for lib in zmq/eventloop/*.py; do
54b74e4
    sed '/\/usr\/bin\/env/d' $lib > $lib.new &&
54b74e4
    touch -r $lib $lib.new &&
54b74e4
    mv $lib.new $lib
54b74e4
done
54b74e4
54b74e4
# remove excecutable bits
54b74e4
chmod -x examples/pubsub/topics_pub.py
54b74e4
chmod -x examples/pubsub/topics_sub.py
54b74e4
342c17d
# delete hidden files
a0075ca
#find examples -name '.*' | xargs rm -v
a0075ca
48bbb9f
cp %{_sourcedir}/buildutils.py .
48bbb9f
342c17d
54b74e4
%if 0%{?with_python3}
54b74e4
rm -rf %{py3dir}
54b74e4
cp -a . %{py3dir}
54b74e4
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
54b74e4
rm -r %{py3dir}/examples
dc0d0df
54b74e4
%endif
54b74e4
54b74e4
54b74e4
%build
54b74e4
CFLAGS="%{optflags}" %{__python} setupegg.py build
54b74e4
54b74e4
%if 0%{?with_python3}
54b74e4
pushd %{py3dir}
dc0d0df
CFLAGS="%{optflags}" %{__python3} setup.py build
54b74e4
popd
54b74e4
%endif # with_python3
54b74e4
54b74e4
54b74e4
54b74e4
%install
54b74e4
# Must do the python3 install first because the scripts in /usr/bin are
54b74e4
# overwritten with every setup.py install (and we want the python2 version
54b74e4
# to be the default for now).
54b74e4
%if 0%{?with_python3}
54b74e4
pushd %{py3dir}
dc0d0df
%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
54b74e4
54b74e4
# remove tests doesn't work here, do that after running the tests
54b74e4
54b74e4
popd
54b74e4
%endif # with_python3
54b74e4
54b74e4
54b74e4
%{__python} setupegg.py install -O1 --skip-build --root %{buildroot}
54b74e4
54b74e4
# remove tests doesn't work here, do that after running the tests
54b74e4
54b74e4
54b74e4
54b74e4
%check
bc2b5f7
%if 0%{?run_tests}
bc2b5f7
    rm zmq/__*
bc2b5f7
    PYTHONPATH=%{buildroot}%{python_sitearch} \
a0075ca
    %{__python} setup.py test
bc2b5f7
    rm -r %{buildroot}%{python_sitearch}/zmq/tests
54b74e4
bc2b5f7
    %if 0%{?with_python3}
bc2b5f7
    # there is no python3-nose yet
bc2b5f7
    pushd %{py3dir}
54b74e4
    rm zmq/__*
a0075ca
    #PYTHONPATH=%{buildroot}%{python3_sitearch} \
a0075ca
    #    %{__python3} setup.py test
54b74e4
    rm -r %{buildroot}%{python3_sitearch}/zmq/tests
bc2b5f7
    popd
bc2b5f7
    %endif
54b74e4
%endif
54b74e4
54b74e4
54b74e4
%files
54b74e4
%defattr(-,root,root,-)
54b74e4
%doc README.rst COPYING.LESSER examples/
54b74e4
%{python_sitearch}/%{srcname}-*.egg-info
54b74e4
%{python_sitearch}/zmq
54b74e4
54b74e4
54b74e4
%if 0%{?with_python3}
54b74e4
%files -n python3-zmq
54b74e4
%defattr(-,root,root,-)
54b74e4
%doc README.rst COPYING.LESSER
54b74e4
# examples/
54b74e4
%{python3_sitearch}/%{srcname}-*.egg-info
54b74e4
%{python3_sitearch}/zmq
54b74e4
%endif
54b74e4
54b74e4
54b74e4
%changelog
48bbb9f
* Wed Apr  6 2011 Thomas Spura <tomspur@fedoraproject.org> - 2.1.4-1
48bbb9f
- update to new version (#690199)
48bbb9f
bc2b5f7
* Wed Mar 23 2011 Thomas Spura <tomspur@fedoraproject.org> - 2.1.1-1
bc2b5f7
- update to new version (#682201)
bc2b5f7
b9823d1
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.10.1-2
b9823d1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
b9823d1
dc0d0df
* Sun Jan 30 2011 Thomas Spura <tomspur@fedoraproject.org> - 2.0.10.1-1
dc0d0df
- update to new version (fixes memory leak)
dc0d0df
- no need to run 2to3 on python3 subpackage
dc0d0df
a0075ca
* Thu Jan 13 2011 Thomas Spura <tomspur@fedoraproject.org> - 2.0.10-1
a0075ca
- update to new version
a0075ca
- remove patch (is upstream)
a0075ca
- run tests differently
a0075ca
54b74e4
* Thu Aug  5 2010 Thomas Spura <tomspur@fedoraproject.org> - 0.1.20100725git18f5d06-3
54b74e4
- add missing BR for 2to3
54b74e4
54b74e4
* Tue Aug  3 2010 Thomas Spura <tomspur@fedoraproject.org> - 0.1.20100725git18f5d06-2
54b74e4
- build python3 subpackage
54b74e4
- rename to from pyzmq to python-zmq
54b74e4
- change license
54b74e4
54b74e4
* Sun Jul 25 2010 Thomas Spura <tomspur@fedoraproject.org> - 0.1.20100725git18f5d06-1
54b74e4
- renew git snapshot
54b74e4
- start from version 0.1 like upstream (not the version from zeromq)
54b74e4
- remove buildroot / %%clean
54b74e4
54b74e4
* Sat Jun 12 2010 Thomas Spura 
54b74e4
- initial package (based on upstreams example one)