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

# For EPEL5 make a python26 package.
%if %{?rhel}%{!?rhel:0} == 5
%global altpython python26
%global __altpython %{_bindir}/python2.6
# 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

%if %{?fedora}%{!?fedora:0} >= 13
%global altpython python3
%global __altpython %{_bindir}/python3
%endif 

%if %{?altpython:1}%{!?altpython:0}
%{!?altpydir: %global altpydir %{_builddir}/%{altpython}-%{name}-%{version}-%{release}}
%{!?altpython_sitelib: %global altpython_sitelib %(%{__altpython} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%endif 

%global srcname dirq

Name:           python-dirq
Version:        1.8
Release:        1%{?dist}
Summary:        Directory based queue

Group:          Development/Languages
License:        ASL 2.0
URL:            https://github.com/cern-mig/%{name}
Source0:        http://pypi.python.org/packages/source/d/%{srcname}/%{srcname}-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildArch:      noarch
BuildRequires:  python2-devel

%if %{?altpython:1}%{!?altpython:0}
BuildRequires:  %{altpython}-devel
%endif #end of altpython.

%description
The goal of this module is to offer a simple queue system using the 
underlying file system for storage, security and to prevent race 
conditions via atomic operations.  It focuses on simplicity, 
robustness and the ability to scale.

The python module dirq is compatible with the Perl 
module Directory::Queue.

%if %{?altpython:1}%{!?altpython:0}
%package -n %{altpython}-dirq
Summary:        Directory based queue for %{altpython}
Group:          Development/Languages
%if %{?rhel}%{!?rhel:0} == 5
Requires: python(abi) = 2.6
%endif

%description -n %{altpython}-dirq
The goal of this module is to offer a simple queue system using the 
underlying file system for storage, security and to prevent race 
conditions via atomic operations.  It focuses on simplicity, 
robustness and the ability to scale.

The python module dirq is compatible with the Perl 
module Directory::Queue.
%endif #end of altpython.

%prep
%setup -q -n %{srcname}-%{version}
chmod 644 examples/dirq_simple.py examples/dirqset_simple.py

%if %{?altpython:1}%{!?altpython:0}
rm -rf   %{altpydir}
cp -a .  %{altpydir}
find %{altpydir} -name '*.py' | xargs sed -i '1s|^#!/usr/bin/env python|#!%{_bindir}/%{altpython}|'
%endif #end of altpython.

find -name '*.py' | xargs sed -i '1s|^#!/usr/bin/env python|#!%{__python}|'

%build
%{__python} setup.py build

%if %{?altpython:1}%{!?altpython:0}
pushd %{altpydir}
%{__altpython} setup.py build
popd
%endif #end of altpython.

%install
rm -rf $RPM_BUILD_ROOT
%if %{?altpython:1}%{!?altpython:0}
pushd %{altpydir}
%{__altpython} setup.py install --skip-build --root $RPM_BUILD_ROOT
popd
%endif #end of altpython.

%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT

%check
ls -al
ls -al test
%{__python} setup.py test
# And remove compiled documentation.
rm -f test/*.pyc

%if %{?altpython:1}%{!?altpython:0}
pushd %{altpydir}
%{__altpython} setup.py test
# And remove compiled documentation.
rm -f test/*.pyc
popd
%endif #end of altpython.

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%doc README.rst CHANGES examples test
%{python_sitelib}/%{srcname}/
%if 0%{?rhel} != 5
%{python_sitelib}/%{srcname}-%{version}-py?.?.egg-info
%endif

%if %{?altpython:1}%{!?altpython:0}
%files -n %{altpython}-dirq
%defattr(-,root,root,-)
%doc README.rst CHANGES examples test
%{altpython_sitelib}/%{srcname}/
%{altpython_sitelib}/%{srcname}-%{version}-py?.?.egg-info
%endif #end of altpython.

%changelog
* Thu Nov  4 2021 Lionel Cons <lionel.cons@cern.ch> - 1.8-1
- Updated to 1.8 (rhbz #2020220)

* Tue Nov  1 2016 Lionel Cons <lionel.cons@cern.ch> - 1.7.1-1
- Update to upstream version, rhbz #1389920.

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.7-3
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.7-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Fri Nov 13 2015 Lionel Cons <lionel.cons@cern.ch> - 1.7-1
- Update to upstream version, rhbz #1281769.

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6.1-5
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Wed May 28 2014 Kalev Lember <kalevlember@gmail.com> - 1.6.1-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4

* Tue Feb 25 2014 Massimo Paladin <massimo.paladin@gmail.com> - 1.6.1-1
- Update to upstream version, rhbz #1069202.

* Sat Jan 11 2014 Massimo Paladin <massimo.paladin@gmail.com> - 1.5-1
- Update to upstream version, rhbz #1049761.

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Tue Jun 25 2013 Massimo Paladin <massimo.paladin@gmail.com> - 1.4-1
- Update to upstream version, rhbz #976198.

* Wed May 29 2013 Massimo Paladin <massimo.paladin@gmail.com> - 1.3-1
- Update to upstream version, rhbz #967707.

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Sat Aug 04 2012 David Malcolm <dmalcolm@redhat.com> - 1.2.2-3
- rebuild for https://fedoraproject.org/wiki/Features/Python_3.3

* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Mon Jun 11 2012 Massimo Paladin <massimo.paladin@gmail.com> - 1.2.2-1
- Update to 1.2.2.

* Wed May 09 2012 Massimo Paladin <massimo.paladin@gmail.com> - 1.2.1-2
- Cleaning specfile and dependency error fixed on rhel5.

* Mon May 07 2012 Massimo Paladin <massimo.paladin@gmail.com> - 1.2.1-1
- Update to 1.2.1.

* Fri Mar 30 2012 Massimo Paladin <massimo.paladin@gmail.com> - 1.1.2-1
- Update to 1.1.2.

* Tue Mar 20 2012 Massimo Paladin <massimo.paladin@gmail.com> - 1.1.1-1
- Update to 1.1.1.

* Tue Feb 14 2012 Steve Traylen <steve.traylen@cern.ch> - 1.0.1-2
- Empty release for revision control error.

* Tue Feb 14 2012 Steve Traylen <steve.traylen@cern.ch> - 1.0.1-1
- Update to 1.0.1.
- Enable python3 support with patch dirq-1.0.1-dist-tag.patch.

* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.0.5-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.0.5-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Sat Jul 31 2010 Thomas Spura <tomspur@fedoraproject.org> - 0.0.5-4
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild

* Wed Jul 28 2010 Steve Traylen <steve.traylen@cern.ch> - 0.0.5-3
- Really disable python3 support.
- Change /usr/bin/env python to /usr/bin/python everywhere.

* Tue Jun 29 2010 Steve Traylen <steve.traylen@cern.ch> - 0.0.5-2
- Disable python3 support and add link to bug.

* Mon Jun 28 2010 Steve Traylen <steve.traylen@cern.ch> - 0.0.5-1
- Initial packaging.