File python-setuptools.spec of Package python-setuptools
%global pypi_name setuptools
Name: python-setuptools
Version: 36.8.0
Release: 1%{?dist}
Summary: Easily build and distribute Python packages
Group: Applications/System
License: MIT
URL: https://github.com/pypa/setuptools
Source0: https://pypi.io/packages/source/s/setuptools/setuptools-%{version}.zip
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: python-setuptools
BuildRequires: unzip
%description
Setuptools is a collection of enhancements to the Python distutils that allow
you to more easily build and distribute Python packages, especially ones that
have dependencies on other packages.
This package also contains the runtime components of setuptools, necessary to
execute the software that requires pkg_resources.py.
%package -n python2-setuptools
Summary: Easily build and distribute Python packages
%{?python_provide:%python_provide python2-%{pypi_name}}
# We're now back to setuptools as the package.
# Keep the python-distribute name active for a few releases. Eventually we'll
# want to get rid of the Provides and just keep the Obsoletes
Provides: python-distribute = %{version}-%{release}
Obsoletes: python-distribute < 0.6.36-2
%description -n python2-setuptools
Setuptools is a collection of enhancements to the Python distutils that allow
you to more easily build and distribute Python packages, especially ones that
have dependencies on other packages.
This package also contains the runtime components of setuptools, necessary to
execute the software that requires pkg_resources.py.
%prep
%setup -q -n %{pypi_name}-%{version}
# We can't remove .egg-info (but it doesn't matter, since it'll be rebuilt):
# The problem is that to properly execute setuptools' setup.py,
# it is needed for setuptools to be loaded as a Distribution
# (with egg-info or .dist-info dir), it's not sufficient
# to just have them on PYTHONPATH
# Running "setup.py install" without having setuptools installed
# as a distribution gives warnings such as
# ... distutils/dist.py:267: UserWarning: Unknown distribution option: 'entry_points'
# and doesn't create "easy_install" and .egg-info directory
# Note: this is only a problem if bootstrapping wheel or building on RHEL,
# otherwise setuptools are installed as dependency into buildroot
# Strip shbang
find setuptools -name \*.py | xargs sed -i -e '1 {/^#!\//d}'
# Remove bundled exes
rm -f setuptools/*.exe
# These tests require internet connection
rm setuptools/tests/test_integration.py
%build
%py2_build
%install
%py2_install
rm -rf %{buildroot}%{python2_sitelib}/setuptools/tests
find %{buildroot}%{python2_sitelib} -name '*.exe' | xargs rm -f
# Don't ship these
rm -r docs/{Makefile,conf.py,_*}
%files -n python2-setuptools
%if (0%{?rhel} >= 7) || (0%{?suse_version} >= 1315)
%license LICENSE
%endif
%doc docs/* CHANGES.rst README.rst
%{python2_sitelib}/*
%{_bindir}/easy_install
%{_bindir}/easy_install-2.*
%changelog
* Wed Dec 20 2017 Yunfei Shi <shiyf2@lenovo.com> - 36.8.0-1
- Initial package