6757fc
%global pypi_name packaging
6757fc
6757fc
%if 0%{?fedora} || 0%{?rhel} > 7
6757fc
%global build_wheel 1
6757fc
%global with_python3 1
6757fc
%endif
6757fc
6757fc
%if 0%{?rhel} > 7
6757fc
# Disable python2 build by default
6757fc
%bcond_with python2
6757fc
%else
6757fc
%bcond_without python2
6757fc
%endif
6757fc
6757fc
%global python2_wheelname %{pypi_name}-%{version}-py2.py3-none-any.whl
6757fc
%global python3_wheelname %python2_wheelname
6757fc
6757fc
Name:           python-%{pypi_name}
6757fc
Version:        16.8
6757fc
Release:        9%{?dist}
6757fc
Summary:        Core utilities for Python packages
6757fc
6757fc
License:        BSD or ASL 2.0
6757fc
URL:            https://github.com/pypa/packaging
6757fc
Source0:        https://files.pythonhosted.org/packages/source/p/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
6757fc
BuildArch:      noarch
6757fc
6757fc
# Dependencies with different names in Fedora and Epel7
6757fc
%if %{with python2}
6757fc
%if 0%{?fedora} || 0%{?rhel} > 7
6757fc
BuildRequires:  python2-setuptools
6757fc
BuildRequires:  python2-devel
6757fc
BuildRequires:  python2-pytest
6757fc
BuildRequires:  python2-pyparsing
6757fc
%else
6757fc
BuildRequires:  python-setuptools
6757fc
BuildRequires:  python-devel
6757fc
BuildRequires:  pytest
6757fc
BuildRequires:  pyparsing
6757fc
BuildRequires:  python-sphinx
6757fc
%endif
6757fc
6757fc
BuildRequires:  python-pretend
6757fc
BuildRequires:  python-six
6757fc
%endif # with python2
6757fc
6757fc
# Build Python 3 subpackage only for Fedora
6757fc
%if 0%{?with_python3}
6757fc
BuildRequires:  python%{python3_pkgversion}-setuptools
6757fc
BuildRequires:  python%{python3_pkgversion}-devel
6757fc
BuildRequires:  python%{python3_pkgversion}-pytest
6757fc
BuildRequires:  python%{python3_pkgversion}-pretend
6757fc
BuildRequires:  python%{python3_pkgversion}-pyparsing
6757fc
BuildRequires:  python%{python3_pkgversion}-six
6757fc
BuildRequires:  python%{python3_pkgversion}-sphinx
6757fc
%endif
6757fc
6757fc
%if 0%{?build_wheel}
6757fc
%if %{with python2}
6757fc
BuildRequires:  python2-pip
6757fc
BuildRequires:  python2-wheel
6757fc
%endif # with python2
6757fc
%if 0%{?with_python3}
6757fc
BuildRequires:  python%{python3_pkgversion}-pip
6757fc
BuildRequires:  python%{python3_pkgversion}-wheel
6757fc
%endif
6757fc
%endif
6757fc
6757fc
%description
6757fc
python-packaging provides core utilities for Python packages like utilities for
6757fc
dealing with versions, specifiers, markers etc.
6757fc
6757fc
%if %{with python2}
6757fc
%package -n python2-%{pypi_name}
6757fc
Summary:        %{summary}
6757fc
%{?python_provide:%python_provide python2-%{pypi_name}}
6757fc
6757fc
%if 0%{?fedora} || 0%{?rhel} > 7
6757fc
Requires:       python2-pyparsing
6757fc
%else
6757fc
Requires:       pyparsing
6757fc
%endif
6757fc
6757fc
Requires:       python-six
6757fc
6757fc
%description -n python2-%{pypi_name}
6757fc
python2-packaging provides core utilities for Python packages like utilities for
6757fc
dealing with versions, specifiers, markers etc.
6757fc
%endif # with python2
6757fc
6757fc
%if 0%{?with_python3}
6757fc
%package -n python%{python3_pkgversion}-%{pypi_name}
6757fc
Summary:        %{summary}
6757fc
%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}}
6757fc
 
6757fc
Requires:       python%{python3_pkgversion}-pyparsing
6757fc
Requires:       python%{python3_pkgversion}-six
6757fc
%description -n python%{python3_pkgversion}-%{pypi_name}
6757fc
python3-packaging provides core utilities for Python packages like utilities for
6757fc
dealing with versions, specifiers, markers etc.
6757fc
%endif
6757fc
6757fc
%package -n python-%{pypi_name}-doc
6757fc
Summary:        python-packaging documentation
6757fc
%description -n python-%{pypi_name}-doc
6757fc
Documentation for python-packaging
6757fc
6757fc
%prep
6757fc
%autosetup -n %{pypi_name}-%{version}
6757fc
# Remove bundled egg-info
6757fc
rm -rf %{pypi_name}.egg-info
6757fc
6757fc
%build
6757fc
%if %{with python2}
6757fc
%if 0%{?build_wheel}
6757fc
%py2_build_wheel
6757fc
%else
6757fc
%py2_build
6757fc
%endif
6757fc
%endif # with python2
6757fc
6757fc
%if 0%{?with_python3}
6757fc
%if 0%{?build_wheel}
6757fc
%py3_build_wheel
6757fc
%else
6757fc
%py3_build
6757fc
%endif
6757fc
%endif
6757fc
6757fc
# generate html docs
6757fc
%if 0%{?with_python3}
6757fc
sphinx-build-3 docs html
6757fc
%else
6757fc
sphinx-build docs html
6757fc
%endif
6757fc
6757fc
# remove the sphinx-build leftovers
6757fc
rm -rf html/.{doctrees,buildinfo}
6757fc
# Do not bundle fonts
6757fc
rm -rf html/_static/fonts/
6757fc
6757fc
%install
6757fc
%if %{with python2}
6757fc
%if 0%{?build_wheel}
6757fc
%py2_install_wheel %{python2_wheelname}
6757fc
%else
6757fc
%py2_install
6757fc
%endif
6757fc
%endif # with python2
6757fc
6757fc
%if 0%{?with_python3}
6757fc
%if 0%{?build_wheel}
6757fc
%py3_install_wheel %{python3_wheelname}
6757fc
%else
6757fc
%py3_install
6757fc
%endif
6757fc
%endif
6757fc
6757fc
%check
6757fc
%if %{with python2}
6757fc
%if 0%{?fedora} || 0%{?rhel} > 7
6757fc
%{__python2} -m pytest tests/
6757fc
%else
6757fc
# Disable non-working tests in Epel7
6757fc
%{__python2} -m pytest --ignore=tests/test_requirements.py tests/
6757fc
%endif
6757fc
%endif # with python2
6757fc
6757fc
%if 0%{?with_python3}
6757fc
%{__python3} -m pytest tests/
6757fc
%endif
6757fc
6757fc
%if %{with python2}
6757fc
%files -n python2-%{pypi_name}
6757fc
%license LICENSE LICENSE.APACHE LICENSE.BSD
6757fc
%doc README.rst CHANGELOG.rst CONTRIBUTING.rst
6757fc
%{python2_sitelib}/%{pypi_name}/
6757fc
%{python2_sitelib}/%{pypi_name}-*-info/
6757fc
%endif # with python2
6757fc
6757fc
%if 0%{?with_python3}
6757fc
%files -n python%{python3_pkgversion}-%{pypi_name}
6757fc
%license LICENSE LICENSE.APACHE LICENSE.BSD
6757fc
%doc README.rst CHANGELOG.rst CONTRIBUTING.rst
6757fc
%{python3_sitelib}/%{pypi_name}/
6757fc
%{python3_sitelib}/%{pypi_name}-*-info/
6757fc
%endif
6757fc
6757fc
%files -n python-%{pypi_name}-doc
6757fc
%doc html
6757fc
%license LICENSE LICENSE.APACHE LICENSE.BSD
6757fc
6757fc
%changelog
6757fc
* Thu Jun 14 2018 Charalampos Stratakis <cstratak@redhat.com> - 16.8-9
6757fc
- Conditionalize the python2 subpackage
6757fc
6757fc
* Tue May 22 2018 Petr Viktorin <pviktori@redhat.com> - 16.8-8
6757fc
- Build the Python 3 subpackage also on EL>7
6757fc
6757fc
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 16.8-7
6757fc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
6757fc
6757fc
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 16.8-6
6757fc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
6757fc
6757fc
* Wed Mar 22 2017 Lumir Balhar <lbalhar@redhat.com> - 16.8-5
6757fc
- Epel7 compatible spec/package
6757fc
6757fc
* Mon Feb 13 2017 Charalampos Stratakis <cstratak@redhat.com> - 16.8-4
6757fc
- Rebuild as wheel
6757fc
6757fc
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 16.8-3
6757fc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
6757fc
6757fc
* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 16.8-2
6757fc
- Rebuild for Python 3.6
6757fc
6757fc
* Wed Nov 02 2016 Lumir Balhar <lbalhar@redhat.com> - 16.8-1
6757fc
- New upstream version
6757fc
6757fc
* Fri Sep 16 2016 Lumir Balhar <lbalhar@redhat.com> - 16.7-1
6757fc
- Initial package.