Blob Blame History Raw
%if ! (0%{?fedora} > 12 || 0%{?rhel} > 5)
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%endif

%if 0%{?fedora} > 12
%global with_python3 1
%endif

%if 0%{?el5}  
%global with_python26 1
%endif

%if 0%{?with_python26}
%global __python26 %{_bindir}/python2.6
%global py26dir  %{_builddir}/python26-%{name}-%{version}-%{release}
%global python26_sitelib     /usr/lib/python2.6/site-packages
# Disable byte compiling. Do ourselves later.
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') 
%endif


Name:           stomppy
Version:        3.0.3
Release:        1%{?dist}.1
Summary:        Python stomp client for messaging

Group:          Development/Libraries
License:        ASL 2.0
URL:            http://code.google.com/p/stomppy/
Source0:        http://stomppy.googlecode.com/files/stomp.py-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:      noarch

BuildRequires:  python2-devel
%if 0%{?with_python3}
BuildRequires:  python3-devel
%endif # if with_python3

%if 0%{?with_python26}
BuildRequires:  python26-devel
%endif # if with_python26

# Needs python-ssl for python 2.3 and 2.4.
%if 0%{?el4}%{?el5}
Requires: python-ssl
%endif

%description
stomp.py is a Python client library for accessing messaging servers 
(such as ActiveMQ or JBoss Messaging) using the STOMP protocol. It can also
be run as a standalone, command-line client for testing.

%if 0%{?with_python3}
%package -n python3-stomppy
Summary:        Python stomp client for messaging for python3
Group:          Development/Libraries

%description -n python3-stomppy
stomp.py is a Python client library for accessing messaging servers 
(such as ActiveMQ or JBoss Messaging) using the STOMP protocol. It can also
be run as a standalone, command-line client for testing.

This module is for the python3.
%endif

%if 0%{?with_python26}
%package -n python26-stomppy
Summary:        Python stomp client for messaging for python 2.6
Group:          Development/Libraries
Requires:       python(abi) = 2.6

%description -n python26-stomppy
stomp.py is a Python client library for accessing messaging servers 
(such as ActiveMQ or JBoss Messaging) using the STOMP protocol. It can also
be run as a standalone, command-line client for testing.

This module is for the python 2.6.
%endif


%prep
%setup -q -n stomp.py-%{version}
# Remove dos line feeds from tests.
sed -i 's/\r//' README
chmod 644 README

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif # with_python3

%if 0%{?with_python26}
rm -rf %{py26dir}
cp -a . %{py26dir}
%endif # with_python2


%build
%{__python} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif # with_python3

%if 0%{?with_python26}
pushd %{py26dir}
%{__python26} setup.py build
popd
%endif # with_python3



%install
rm -rf $RPM_BUILD_ROOT
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
rm -rf %{buildroot}%{python3_sitelib}/test
popd
%endif # with_python3

%if 0%{?with_python26}
pushd %{py26dir}
%{__python26} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
rm -rf %{buildroot}%{python26_sitelib}/test
popd
%endif # with_python26

%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
rm -rf $RPM_BUILD_ROOT%{python_sitelib}/test

%if 0%{?with_python26}
%{__python} -c 'import compileall; compileall.compile_dir("'"$RPM_BUILD_ROOT"'", 10, "%{python_sitelib}", 1)' > /dev/null
%{__python} -O -c 'import compileall; compileall.compile_dir("'"$RPM_BUILD_ROOT"'", 10, "%{python_sitelib}", 1)' > /dev/null
%{__python26} -c 'import compileall; compileall.compile_dir("'"$RPM_BUILD_ROOT%{python26_sitelib}"'", 10, "%{python26_sitelib}", 1)' > /dev/null
%{__python26} -O -c 'import compileall; compileall.compile_dir("'"$RPM_BUILD_ROOT%{python26_sitelib}"'", 10, "%{python26_sitelib}", 1)' > /dev/null
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%{python_sitelib}/*
%doc LICENSE CHANGELOG README

%if 0%{?with_python3}
%files -n python3-stomppy
%defattr(-,root,root,-)
%{python3_sitelib}/*
%doc LICENSE CHANGELOG README
%endif # with_python3

%if 0%{?with_python26}
%files -n python26-stomppy
%defattr(-,root,root,-)
%{python26_sitelib}/*
%doc LICENSE CHANGELOG README
%endif # with_python26

%changelog
* Sun Feb 6 2011 Steve Traylen <steve.traylen@cern.ch.com> - 3.0.3-1 1
- Only requre python26 on python26 subpackage.

* Sun Feb 6 2011 Steve Traylen <steve.traylen@cern.ch.com> - 3.0.3-1 
- Update to 3.0.3
- Add python 2.6 sub package.

* Tue Aug 24 2010 Steve Traylen <steve.traylen@cern.ch.com> - 3.0.2-0.1.a
- Update to source to 3.0.2a, a pre-release of 3.0.2.

* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 3.0.1-0.2.beta2.1
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild

* Fri May 14 2010 Steve Traylen <steve.traylen@cern.ch> -  3.0.1-0.2.beta2
- Build with correct file this time.

* Thu May 13 2010 Steve Traylen <steve.traylen@cern.ch> -  3.0.1-0.1.beta2
- Update to 3.0.2beta2
- Add new CHANGELOG and README files.
- Add python3 support.
- Remove python-rm-bang-python.patch, no longer a file to patch even.

* Wed Sep 30 2009 Steve Traylen <steve.traylen@cern.ch> -  2.0.4-1
- Update to 2.0.4
  remove patch to allow building with out network.

* Wed Sep 30 2009 Steve Traylen <steve.traylen@cern.ch> -  2.0.2-3
- Remove some dos line feeds

* Tue Sep 29 2009 Steve Traylen <steve.traylen@cern.ch> -  2.0.2-2
- Add patch to allow build without working network.

* Mon Sep 7 2009 Steve Traylen <steve.traylen@cern.ch> -  2.0.2-1
- Initial version.