9f21b9d
%global modname parse
9f21b9d
f291f54
%if 0%{?rhel} > 6 || 0%{?fedora} >= 12
9f21b9d
%bcond_without python3
9f21b9d
%else
9f21b9d
%bcond_with python3
f291f54
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from %distutils.sysconfig import get_python_lib; print(get_python_lib())")}
9f21b9d
%endif
9f21b9d
9f21b9d
Name:               python-parse
9f21b9d
Version:            1.6.2
f291f54
Release:            4%{?dist}
9f21b9d
Summary:            Opposite of format()
9f21b9d
9f21b9d
Group:              Development/Libraries
9f21b9d
License:            BSD
9f21b9d
URL:                http://pypi.python.org/pypi/parse
9f21b9d
Source0:            http://pypi.python.org/packages/source/p/%{modname}/%{modname}-%{version}.tar.gz
9f21b9d
9f21b9d
BuildArch:          noarch
9f21b9d
BuildRequires:      python2-devel
9f21b9d
BuildRequires:      python-setuptools
9f21b9d
%if %{with python3}
9f21b9d
BuildRequires:      python3-devel
9f21b9d
BuildRequires:      python3-setuptools
9f21b9d
%endif
9f21b9d
9f21b9d
9f21b9d
%description
9f21b9d
Parse strings using a specification based on the Python format() syntax.
9f21b9d
9f21b9d
``parse()`` is the opposite of ``format()``
9f21b9d
9f21b9d
%if %{with python3}
9f21b9d
%package -n python3-%{modname}
9f21b9d
Summary:        Opposite of format()
9f21b9d
Group:          Development/Libraries
9f21b9d
9f21b9d
%description -n python3-%{modname}
9f21b9d
Parse strings using a specification based on the Python format() syntax.
9f21b9d
9f21b9d
``parse()`` is the opposite of ``format()``
9f21b9d
9f21b9d
This package works with Python 3.
9f21b9d
%endif
9f21b9d
9f21b9d
9f21b9d
%prep
9f21b9d
%setup -q -n %{modname}-%{version}
9f21b9d
9f21b9d
# Remove bundled egg-info in case it exists
9f21b9d
rm -rf %{modname}.egg-info
9f21b9d
9f21b9d
%if %{with python3}
9f21b9d
rm -rf %{py3dir}
9f21b9d
cp -a . %{py3dir}
9f21b9d
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
9f21b9d
%endif
9f21b9d
9f21b9d
%build
9f21b9d
%{__python} setup.py build
9f21b9d
9f21b9d
%if %{with python3}
9f21b9d
pushd %{py3dir}
9f21b9d
%{__python3} setup.py build
9f21b9d
popd
9f21b9d
%endif
9f21b9d
9f21b9d
9f21b9d
%install
9f21b9d
# Must do the python3 install first because the scripts in /usr/bin are
9f21b9d
# overwritten with every setup.py install (and we want the python2
9f21b9d
# version to be the default for now).
9f21b9d
%if %{with python3}
9f21b9d
pushd %{py3dir}
9f21b9d
%{__python3} setup.py install --skip-build --root=%{buildroot}
9f21b9d
popd
9f21b9d
%endif
9f21b9d
9f21b9d
%{__python} setup.py install -O1 --skip-build --root=%{buildroot}
9f21b9d
9f21b9d
9f21b9d
%check
9f21b9d
%{__python} test_parse.py
9f21b9d
9f21b9d
%if %{with python3}
9f21b9d
pushd %{py3dir}
9f21b9d
%{__python3} test_parse.py
9f21b9d
popd
9f21b9d
%endif
9f21b9d
9f21b9d
%files
9f21b9d
%doc README.rst
9f21b9d
%{python_sitelib}/%{modname}*
9f21b9d
9f21b9d
%if %{with python3}
9f21b9d
%files -n python3-%{modname}
9f21b9d
%doc README.rst
9f21b9d
%{python3_sitelib}/%{modname}*
9f21b9d
%{python3_sitelib}/__pycache__/%{modname}*
9f21b9d
%endif
9f21b9d
9f21b9d
9f21b9d
%changelog
f291f54
* Tue Aug 27 2013 Matěj Cepl <mcepl@redhat.com> - 1.6.2-4
f291f54
- There is no official py3k support for RHEL-6.
f291f54
9f21b9d
* Wed Jul 24 2013 Matěj Cepl <mcepl@redhat.com> - 1.6.2-3
9f21b9d
- We actually don't need 2to3.
9f21b9d
9f21b9d
* Wed Jul 24 2013 Matěj Cepl <mcepl@redhat.com> - 1.6.2-2
9f21b9d
- make python3 package as well
9f21b9d
- BR python-setuptools
9f21b9d
- fix changelog
9f21b9d
9f21b9d
* Tue Jul 23 2013 Matěj Cepl <mcepl@redhat.com> - 1.6.2-1
9f21b9d
- initial package for Fedora