diff --git a/.gitignore b/.gitignore index e69de29..611a2b3 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/aniso8601-0.82.tar.gz diff --git a/python-aniso8601.spec b/python-aniso8601.spec new file mode 100644 index 0000000..aa2a98c --- /dev/null +++ b/python-aniso8601.spec @@ -0,0 +1,88 @@ +%if 0%{?rhel} && 0%{?rhel} <= 6 +%{!?__python2: %global __python2 /usr/bin/python} +%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} +%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} +%endif + +%if (0%{?fedora} > 12) +%global with_python3 1 +%endif + +%global pkgname aniso8601 +%global tarball_name aniso8601 + +Name: python-aniso8601 +Version: 0.82 +Release: 1%{?dist} +Summary: Python 2 library for parsing ISO 8601 strings + +Group: Development/Languages +License: GPLv3+ +URL: https://bitbucket.org/nielsenb/aniso8601 +Source0: https://pypi.python.org/packages/source/a/aniso8601/%{tarball_name}-%{version}.tar.gz + +BuildArch: noarch +BuildRequires: python2-devel python-setuptools +%if 0%{?with_python3} +BuildRequires: python3-devel python3-setuptools +%endif + +%description +This is a Python 2 library for parsing date strings +in ISO 8601 format into datetime format. + +%if 0%{?with_python3} +%package -n python3-aniso8601 +Summary: Python 3 library for parsing ISO 8601 strings + +%description -n python3-aniso8601 +This is a Python 3 library for parsing date strings +in ISO 8601 format into datetime format. +%endif + +%prep +%setup -qn %{tarball_name}-%{version} +rm -rf %{tarball_name}.egg-info + +%if 0%{?with_python3} +rm -rf %{py3dir} +cp -a . %{py3dir} +find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' +%endif + +%build +%{__python2} setup.py build +%if 0%{?with_python3} +pushd %{py3dir} +%{__python3} setup.py build +popd +%endif + +%install +%{__python2} setup.py install --skip-build --root %{buildroot} +%if 0%{?with_python3} +pushd %{py3dir} +%{__python3} setup.py install --skip-build --root %{buildroot} +popd +%endif + +%check +PYTHONPATH=%{buildroot}/%{python_sitelib} %{__python2} -m unittest discover python2/aniso8601/tests/ +%if 0%{?with_python3} +PYTHONPATH=%{buildroot}/%{python3_sitelib} %{__python3} -m unittest discover python3/aniso8601/tests/ +%endif + +%files +%doc COPYING README.rst +%{python2_sitelib}/* + +%if 0%{?with_python3} +%files -n python3-aniso8601 +%doc COPYING README.rst +%{python3_sitelib}/* + +%endif + +%changelog +* Wed Jan 22 2014 Jan Sedlak - 0.82-1 +- initial packaging diff --git a/sources b/sources index e69de29..a0e26d4 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +044490d60a079d33eb01c19fd469efdb aniso8601-0.82.tar.gz