9f21b9d
%global modname parse
9f21b9d
fc35fb1
%if 0%{?rhel} > 7 || 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
63f70e2
Version:            1.6.4
3eb9dbb
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
3eb9dbb
# https://bugzilla.redhat.com/show_bug.cgi?id=1291218
3eb9dbb
Patch0:             parse-python-3.5-test.patch
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}
3eb9dbb
%patch0 -p1
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
3eb9dbb
* Mon Dec 14 2015 David King <amigadave@amigadave.com> - 1.6.4-4
3eb9dbb
- Fix test failure with Python 3.5 (#1291218)
3eb9dbb
3e28d51
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6.4-3
3e28d51
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
3e28d51
6d9d36d
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6.4-2
6d9d36d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
6d9d36d
63f70e2
* Thu Jun 19 2014 Matěj Cepl <mcepl@redhat.com> - 1.6.4-1
63f70e2
- New upstream release.
63f70e2
77255de
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6.2-6
77255de
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
77255de
0580a57
* Wed May 28 2014 Kalev Lember <kalevlember@gmail.com> - 1.6.2-5
0580a57
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
0580a57
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