diff --git a/python-parse.spec b/python-parse.spec index 8faf532..f505cb4 100644 --- a/python-parse.spec +++ b/python-parse.spec @@ -1,110 +1,94 @@ %global modname parse -%if 0%{?rhel} > 7 || 0%{?fedora} >= 12 -%bcond_without python3 -%else +%if 0%{?rhel} && 0%{?rhel} <= 7 %bcond_with python3 -%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from %distutils.sysconfig import get_python_lib; print(get_python_lib())")} +%else +%bcond_without python3 %endif -Name: python-parse -Version: 1.6.6 -Release: 2%{?dist} -Summary: Opposite of format() +Name: python-%{modname} +Version: 1.6.6 +Release: 3%{?dist} +Summary: Opposite of format() -Group: Development/Libraries -License: BSD -URL: http://pypi.python.org/pypi/parse -Source0: http://pypi.python.org/packages/source/p/%{modname}/%{modname}-%{version}.tar.gz +License: BSD +URL: http://pypi.python.org/pypi/parse +Source0: http://pypi.python.org/packages/source/p/%{modname}/%{modname}-%{version}.tar.gz # https://bugzilla.redhat.com/show_bug.cgi?id=1291218 -Patch0: parse-python-3.5-test.patch +Patch0: parse-python-3.5-test.patch -BuildArch: noarch -BuildRequires: python2-devel -BuildRequires: python-setuptools -%if %{with python3} -BuildRequires: python3-devel -BuildRequires: python3-setuptools -%endif +BuildArch: noarch + +%global _description \ +Parse strings using a specification based on the Python format() syntax.\ +\ +"parse()" is the opposite of "format()" + +%description %{_description} +%package -n python2-%{modname} +Summary: %{summary} +%{?python_provide:%python_provide python2-%{modname}} +BuildRequires: python2-devel -%description -Parse strings using a specification based on the Python format() syntax. +%description -n python2-%{modname} %{_description} -``parse()`` is the opposite of ``format()`` +Python 2 version. %if %{with python3} %package -n python3-%{modname} -Summary: Opposite of format() -Group: Development/Libraries - -%description -n python3-%{modname} -Parse strings using a specification based on the Python format() syntax. +Summary: %{summary} +%{?python_provide:%python_provide python3-%{modname}} +BuildRequires: python3-devel -``parse()`` is the opposite of ``format()`` +%description -n python3-%{modname} %{_description} -This package works with Python 3. +Python 3 version. %endif - %prep -%setup -q -n %{modname}-%{version} -%patch0 -p1 - -# Remove bundled egg-info in case it exists -rm -rf %{modname}.egg-info - -%if %{with python3} -rm -rf %{py3dir} -cp -a . %{py3dir} -find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' -%endif +%autosetup -n %{modname}-%{version} -p1 +chmod -x README.rst %build -%{__python} setup.py build - +%py2_build %if %{with python3} -pushd %{py3dir} -%{__python3} setup.py build -popd +%py3_build %endif - %install -# Must do the python3 install first because the scripts in /usr/bin are -# overwritten with every setup.py install (and we want the python2 -# version to be the default for now). +%py2_install %if %{with python3} -pushd %{py3dir} -%{__python3} setup.py install --skip-build --root=%{buildroot} -popd +%py3_install %endif -%{__python} setup.py install -O1 --skip-build --root=%{buildroot} - - %check -%{__python} test_parse.py - +%{__python2} test_parse.py %if %{with python3} -pushd %{py3dir} %{__python3} test_parse.py -popd %endif -%files +%files -n python2-%{modname} %doc README.rst -%{python_sitelib}/%{modname}* +%{python2_sitelib}/%{modname}-%{version}-*.egg-info +%{python2_sitelib}/%{modname}.py* %if %{with python3} %files -n python3-%{modname} %doc README.rst -%{python3_sitelib}/%{modname}* -%{python3_sitelib}/__pycache__/%{modname}* +%{python3_sitelib}/%{modname}-%{version}-*.egg-info +%{python3_sitelib}/%{modname}.py +%{python3_sitelib}/__pycache__/%{modname}.* %endif - %changelog +* Tue Apr 19 2016 Igor Gnatenko - 1.6.6-3 +- Remove unneded BuildRequires +- Use %%python_provde +- Correctly split to python2- subpkg +- Fix spurious-executable-perm +- Don't use %%py3dir + * Thu Feb 04 2016 Fedora Release Engineering - 1.6.6-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild