9107276
%if ! (0%{?fedora} > 12 || 0%{?rhel} > 5)
9107276
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
9107276
%endif
9107276
9107276
# For EPEL5 make a python26 package.
9107276
%if %{?rhel}%{!?rhel:0} == 5
9107276
%global altpython python26
9107276
%global __altpython %{_bindir}/python2.6
9107276
# Disable byte compiling. Do ourselves later.
9107276
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') 
9107276
%endif
9107276
9107276
# python3 support not possible at the moment.
9107276
# http://code.google.com/p/dirq/issues/detail?id=1
9107276
#%%if %%{?fedora}%%{!?fedora:0} >= 13
9107276
#%%global altpython python3
9107276
#%%global __altpython %%{_bindir}/python3
9107276
#%%endif 
9107276
9107276
%if %{?altpython:1}%{!?altpython:0}
9107276
%{!?altpydir: %global altpydir %{_builddir}/%{altpython}-%{name}-%{version}-%{release}}
9107276
%{!?altpython_sitelib: %global altpython_sitelib %(%{__altpython} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
9107276
%endif 
9107276
9107276
Name:           python-dirq
9107276
Version:        0.0.5
9107276
Release:        3%{?dist}
9107276
Summary:        Directory based queue
9107276
9107276
Group:          Development/Languages
9107276
License:        ASL 2.0
9107276
URL:            http://code.google.com/p/dirq/
9107276
Source0:        http://dirq.googlecode.com/files/dirq-0.0.5.tar.gz
9107276
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
9107276
9107276
BuildArch:      noarch
9107276
BuildRequires:  python-devel
9107276
9107276
%if %{?altpython:1}%{!?altpython:0}
9107276
%if %{?rhel}%{!?rhel:0} == 5
9107276
Requires: python(abi) = 2.6
9107276
%endif
9107276
# Required for 2to3
9107276
%if %{?fedora}%{!?fedora:0} >= 13
9107276
BuildRequires:  python-tools
9107276
%endif
9107276
BuildRequires:  %{altpython}-devel
9107276
%endif #end of altpython.
9107276
9107276
%description
9107276
The goal of this module is to offer a simple queue system using the 
9107276
underlying file system for storage, security and to prevent race 
9107276
conditions via atomic operations.  It focuses on simplicity, 
9107276
robustness and the ability to scale.
9107276
9107276
The python module dirq is compatible with the Perl 
9107276
module Directory::Queue.
9107276
9107276
%if %{?altpython:1}%{!?altpython:0}
9107276
%package -n %{altpython}-dirq
9107276
Summary:        Directory based queue for %{altpython}
9107276
Group:          Development/Languages
9107276
9107276
%description -n %{altpython}-dirq
9107276
The goal of this module is to offer a simple queue system using the 
9107276
underlying file system for storage, security and to prevent race 
9107276
conditions via atomic operations.  It focuses on simplicity, 
9107276
robustness and the ability to scale.
9107276
9107276
The python module dirq is compatible with the perl 
9107276
module Directory::Queue.
9107276
%endif #end of altpython.
9107276
9107276
%prep
9107276
%setup -q -n dirq-%{version}
9107276
chmod 644 examples/dirq_simple.py \
9107276
          examples/dirqset_simple.py
9107276
sed -i '1s|#!%{_bindir}/env python|#!%{_bindir}/python|' \
9107276
           examples/dirqset_simple.py \
9107276
           examples/dirq_simple.py \
9107276
           test/test_dirq.py
9107276
9107276
%if %{?altpython:1}%{!?altpython:0}
9107276
rm -rf   %{altpydir}
9107276
mkdir -p %{altpydir}
9107276
cp -a *  %{altpydir}
9107276
pushd %{altpydir}
9107276
%if %{?fedora}%{!?fedora:0} >= 13
9107276
2to3 --write --nobackups .
9107276
%endif
9107276
sed -i '1s|#!%{_bindir}/python|#!%{_bindir}/%{altpython}|' \
9107276
           examples/dirqset_simple.py \
9107276
           examples/dirq_simple.py \
9107276
           test/test_dirq.py
9107276
popd
9107276
%endif
9107276
9107276
%build
9107276
%{__python} setup.py build
9107276
9107276
%if %{?altpython:1}%{!?altpython:0}
9107276
pushd %{altpydir}
9107276
%{__altpython} setup.py build
9107276
popd
9107276
%endif
9107276
9107276
9107276
%install
9107276
rm -rf $RPM_BUILD_ROOT
9107276
%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT
9107276
9107276
%if %{?altpython:1}%{!?altpython:0}
9107276
pushd %{altpydir}
9107276
%{__altpython} setup.py install --skip-build --root $RPM_BUILD_ROOT
9107276
popd
9107276
%endif
9107276
9107276
%if %{?fedora}%{!?fedora:0} < 5 && %{?rhel}%{!?rhel:0} < 6
9107276
%{__python} -c 'import compileall; compileall.compile_dir("'"$RPM_BUILD_ROOT"'", 10, "%{python_sitearch}", 1)' > /dev/null
9107276
%{__python} -O -c 'import compileall; compileall.compile_dir("'"$RPM_BUILD_ROOT"'", 10, "%{python_sitearch}", 1)' > /dev/null
9107276
%if %{?altpython:1}%{!?altpython:0}
9107276
%{__altpython} -c 'import compileall; compileall.compile_dir("'"$RPM_BUILD_ROOT%{altpython_sitearch}"'", 10, "%{altpython_sitearch}", 1)' > /dev/null
9107276
%{__altpython} -O -c 'import compileall; compileall.compile_dir("'"$RPM_BUILD_ROOT%{altpython_sitearch}"'", 10, "%{altpython_sitearch}", 1)' > /dev/null
9107276
%endif
9107276
%endif 
9107276
9107276
9107276
%check
9107276
%{__python} setup.py test
9107276
# And remove compiled documentation.
9107276
rm -f test/*.pyc
9107276
%if %{?altpython:1}%{!?altpython:0}
9107276
pushd %{altpydir}
9107276
%{__altpython} setup.py test
9107276
# And remove compiled documentation.
9107276
rm -f test/*.pyc
9107276
popd
9107276
%endif
9107276
9107276
%clean
9107276
rm -rf $RPM_BUILD_ROOT
9107276
9107276
%files
9107276
%defattr(-,root,root,-)
9107276
%doc README CHANGES examples test
9107276
%{python_sitelib}/*
9107276
9107276
%if %{?altpython:1}%{!?altpython:0}
9107276
%files -n %{altpython}-dirq
9107276
%defattr(-,root,root,-)
9107276
%doc README CHANGES examples test
9107276
%{altpython_sitelib}/*
9107276
%endif
9107276
9107276
%changelog
9107276
* Wed Jul 31 2010 Steve Traylen <steve.traylen@cern.ch> - 0.0.5-3
9107276
- Really disable python3 support.
9107276
- Change /usr/bin/env python to /usr/bin/python everywhere.
9107276
9107276
* Tue Jun 29 2010 Steve Traylen <steve.traylen@cern.ch> - 0.0.5-2
9107276
- Disable python3 support and add link to bug.
9107276
9107276
* Mon Jun 28 2010 Steve Traylen <steve.traylen@cern.ch> - 0.0.5-1
9107276
- Initial packaging.
9107276