#
# Conditional build:
-%bcond_with doc # don't build doc
-%bcond_with tests # do not perform "make test"
-%bcond_without python2 # CPython 2.x module
-%bcond_without python3 # CPython 3.x module
+%bcond_without apidocs # Sphinx based documentation
+%bcond_with tests # py.test tests (few failures)
+%bcond_without python2 # CPython 2.x module
+%bcond_without python3 # CPython 3.x module
+%bcond_without python3_default # Use Python 3.x for easy_install executable
+
+%if %{without python3}
+%undefine python3_default
+%endif
%define module setuptools
Summary: A collection of enhancements to the Python distutils
Summary(pl.UTF-8): Zestaw rozszerzeń dla pythonowych distutils
Name: python-setuptools
-Version: 6.0.2
+Version: 40.2.0
Release: 1
Epoch: 1
License: PSF or ZPL
Group: Development/Languages/Python
-Source0: http://cheeseshop.python.org/packages/source/s/setuptools/setuptools-%{version}.tar.gz
-# Source0-md5: b79fab610e362fe8e3a9cb92fb9d95ef
-URL: https://bitbucket.org/pypa/setuptools
+#Source0Download: https://pypi.python.org/simple/setuptools/
+Source0: https://files.pythonhosted.org/packages/ef/1d/201c13e353956a1c840f5d0fbf0461bd45bbd678ea4843ebf25924e8984c/setuptools-%{version}.zip
+# Source0-md5: 592efabea3a65d8e97a025ed52f69b12
+URL: https://github.com/pypa/setuptools
+%if %(locale -a | grep -q '^C.UTF-8$'; echo $?)
+BuildRequires: glibc-localedb-all
+%endif
%if %{with python2}
-BuildRequires: python-distribute
+BuildRequires: python-appdirs >= 1.4.0
+BuildRequires: python-modules >= 1:2.6
+BuildRequires: python-packaging >= 16.8
+BuildConflicts: python-distribute < 0.7
+BuildRequires: python-six >= 1.6.0
+%if %{with tests}
+BuildRequires: python-backports.unittest_mock >= 1.2
+BuildRequires: python-pytest >= 3.0.2
+BuildRequires: python-pytest-flake8
+%endif
%endif
%if %{with python3}
-BuildRequires: python3-distribute
-BuildRequires: python3-modules
+BuildRequires: python3-appdirs >= 1.4.0
+BuildRequires: python3-modules >= 1:3.3
+BuildRequires: python3-packaging >= 16.8
+BuildRequires: python3-six >= 1.6.0
+BuildConflicts: python3-distribute < 0.7
+%if %{with tests}
+BuildRequires: python3-pytest >= 3.0.2
+BuildRequires: python3-pytest-flake8
+%endif
+%endif
+%if %{with apidocs}
+BuildRequires: python3-jaraco
+BuildRequires: python3-jaraco.packaging
+BuildRequires: python3-rst.linker >= 1.6.1
+BuildRequires: sphinx-pdg-3 >= 1.4
%endif
+BuildRequires: rpm-pythonprov
+BuildRequires: rpmbuild(macros) >= 1.714
+BuildRequires: unzip
+Requires: python-modules >= 1:2.6
+Obsoletes: python-distribute < 0.7
+Obsoletes: python-setuptools-devel
BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%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 contains the runtime components of setuptools, necessary
-to execute the software that requires pkg_resources.py.
+that allow you to more easily build and distribute Python 2.x
+packages, especially ones that have dependencies on other packages.
%description -l pl.UTF-8
setuptools to zestaw rozszerzeń do pythonowych distutils umożliwiający
-łatwiejsze budowanie i rozprowadzanie pakietów Pythona, szczególnie
-tych mających zależności od innych pakietów.
+łatwiejsze budowanie i rozprowadzanie pakietów Pythona 2.x,
+szczególnie tych mających zależności od innych pakietów.
Ten pakiet zawiera składniki uruchomieniowe setuptools, potrzebne do
-uruchamiania kodu wymagającego pkg_resources.py.
+uruchamiania kodu wymagającego pkg_resources.py, przeznaczone dla
+Pythona 2.x.
%package -n python3-%{module}
-Summary: -
-Summary(pl.UTF-8): -
+Summary: A collection of enhancements to the Python distutils
+Summary(pl.UTF-8): Zestaw rozszerzeń dla pythonowych distutils
Group: Libraries/Python
-Requires: python3-modules
+Requires: python3-modules >= 1:3.3
+Obsoletes: python3-distribute < 0.7
%description -n python3-%{module}
+setuptools is a collection of enhancements to the Python distutils
+that allow you to more easily build and distribute Python 3.x
+packages, especially ones that have dependencies on other packages.
%description -n python3-%{module} -l pl.UTF-8
+setuptools to zestaw rozszerzeń do pythonowych distutils umożliwiający
+łatwiejsze budowanie i rozprowadzanie pakietów Pythona 3.x,
+szczególnie tych mających zależności od innych pakietów.
+
+%package -n easy_install
+Summary: Python software installer
+Summary(pl.UTF-8): Instalator oprogramowania napisanego w Pythonie
+Group: Libraries/Python
+%if %{with python3_default}
+Requires: python3-%{module} = %{epoch}:%{version}-%{release}
+%else
+Requires: python-%{module} = %{epoch}:%{version}-%{release}
+%endif
+Conflicts: python-setuptools < 1:18.6.1-2
+
+%description -n easy_install
+Python software installer.
+
+%description -n easy_install -l pl.UTF-8
+Instalator oprogramowania napisanego w Pythonie.
%package apidocs
Summary: %{module} API documentation
%description apidocs -l pl.UTF-8
Dokumentacja API %{module}.
-%package devel
-Summary: Download, install, upgrade, and uninstall Python packages
-Summary(pl.UTF-8): Ściąganie, instalacja, uaktualnianie i usuwanie pakietów Pythona
-Group: Development/Languages
-Requires: %{name} = %{epoch}:%{version}-%{release}
-Requires: python-devel
-
-%description devel
-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 contains the components necessary to build and install
-software requiring setuptools.
-
-%description devel -l pl.UTF-8
-setuptools to zestaw rozszerzeń do pythonowych distutils umożliwiający
-łatwiejsze budowanie i rozprowadzanie pakietów Pythona, szczególnie
-tych mających zależności od innych pakietów.
-
-Ten pakiet zawiera składniki potrzebne do budowania i instalacji
-oprogramowania wymagającego setuptools.
-
%prep
%setup -q -n %{module}-%{version}
%build
%if %{with python2}
-%{__python} setup.py build --build-base build-2 %{?with_tests:test}
+LC_ALL=C.UTF-8 \
+%py_build
+
+%{?with_tests:%{__python} -m pytest pkg_resources/tests setuptools/tests tests}
%endif
%if %{with python3}
-%{__python3} setup.py build --build-base build-3 %{?with_tests:test}
+LC_ALL=C.UTF-8 \
+%py3_build
+
+%{?with_tests:%{__python3} -m pytest pkg_resources/tests setuptools/tests tests}
+%endif
+
+%if %{with apidocs}
+%{__make} -C docs html SPHINXBUILD=sphinx-build-3
%endif
%install
rm -rf $RPM_BUILD_ROOT
+%if %{with python3}
+%py3_install
+%endif
+
%if %{with python2}
-%{__python} setup.py \
- build --build-base build-2 \
- install --skip-build \
- --optimize=2 \
- --root=$RPM_BUILD_ROOT
+%py_install
+
+# note: setuptools/command/easy_install.py expects setuptools/site-patch.py to exist
+%py_postclean -x site-patch.py
%endif
-%if %{with python3}
-%{__python3} setup.py \
- build --build-base build-3 \
- install --skip-build \
- --optimize=2 \
- --root=$RPM_BUILD_ROOT
+%if %{with python3_default}
+ln -sf easy_install-%{py3_ver} $RPM_BUILD_ROOT%{_bindir}/easy_install
+%else
+ln -sf easy_install-%{py_ver} $RPM_BUILD_ROOT%{_bindir}/easy_install
%endif
%clean
%if %{with python2}
%files
%defattr(644,root,root,755)
-%doc CHANGES.txt README.txt DEVGUIDE.txt
-%attr(755,root,root) %{_bindir}/easy_install
-%attr(755,root,root) %{_bindir}/easy_install-2.*
-%{py_sitescriptdir}/%{module}
-%{py_sitescriptdir}/_markerlib
+%doc CHANGES.rst README.rst
+%attr(755,root,root) %{_bindir}/easy_install-%{py_ver}
+%{py_sitescriptdir}/pkg_resources
+%{py_sitescriptdir}/setuptools
%{py_sitescriptdir}/easy_install.py[co]
-%{py_sitescriptdir}/pkg_resources.py[co]
-
-%if "%{py_ver}" > "2.4"
%{py_sitescriptdir}/%{module}-%{version}-py*.egg-info
%endif
-%endif
%if %{with python3}
%files -n python3-%{module}
%defattr(644,root,root,755)
-%doc CHANGES.txt README.txt DEVGUIDE.txt
-%attr(755,root,root) %{_bindir}/easy_install-3.*
-%{py3_sitescriptdir}/__pycache__/*
-%{py3_sitescriptdir}/%{module}
-%{py3_sitescriptdir}/_markerlib
+%doc CHANGES.rst README.rst
+%attr(755,root,root) %{_bindir}/easy_install-%{py3_ver}
+%{py3_sitescriptdir}/__pycache__/easy_install.*.py[co]
+%{py3_sitescriptdir}/pkg_resources
+%{py3_sitescriptdir}/setuptools
%{py3_sitescriptdir}/easy_install.py
-%{py3_sitescriptdir}/pkg_resources.py
%{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
%endif
-%if %{with doc}
+%files -n easy_install
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/easy_install
+
+%if %{with apidocs}
%files apidocs
%defattr(644,root,root,755)
-# %doc docs/_build/html/*
+%doc docs/build/html/{_static,*.html,*.js}
%endif
-
-