diff --git a/python-setuptools.spec b/python-setuptools.spec new file mode 100644 index 0000000000000000000000000000000000000000..12c227cc718570a0811287d548bda98846d7ace2 --- /dev/null +++ b/python-setuptools.spec @@ -0,0 +1,206 @@ +%define anolis_release 1 +%global srcname setuptools + +%if !0%{?epel} +%bcond_with tests +%else +%bcond_without tests +%endif + +# WARNING When bootstrapping, disable tests as well, +# because tests need pip. +%bcond_with bootstrap +# Similar to what we have in pythonX.Y.spec files. +# If enabled, provides unversioned executables and other stuff. +# Disable it if you build this package in an alternative stack. +%bcond_without main_python + +%global python_wheel_name %{srcname}-%{version}-py3-none-any.whl + +Name: python-setuptools +# When updating, update the bundled libraries versions bellow! +Version: 60.9.1 +Release: %{anolis_release}%{?dist} +Summary: Easily build and distribute Python packages +# setuptools is MIT +# appdirs is MIT +# more-itertools is MIT +# ordered-set is MIT +# packaging is BSD or ASL 2.0 +# pyparsing is MIT +# the setuptools logo is MIT +License: MIT and (BSD or ASL 2.0) +URL: https://pypi.python.org/pypi/%{srcname} +Source0: https://files.pythonhosted.org/packages/e9/84/a1171328f0a8789a1963e301be7c27163ff67da389b94588ab37a55c49f9/setuptools-60.9.1.tar.gz + +# For future reference, these packages were removed: pytest-(checkdocs|black|cov|mypy|enabler), flake8-2020, paver + +BuildArch: noarch + +BuildRequires: python%{python3_pkgversion}-devel + +%if %{with tests} +BuildRequires: gcc +%endif + +%if %{without bootstrap} +BuildRequires: pyproject-rpm-macros >= 0-44 +# Not to use the pre-generated egg-info, we use setuptools from previous build to generate it +BuildRequires: python%{python3_pkgversion}-setuptools +# python3 bootstrap: this is built before the final build of python3, which +# adds the dependency on python3-rpm-generators, so we require it manually +# The minimal version is for bundled provides verification script +BuildRequires: python3-rpm-generators >= 11-8 +%endif + +%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. + +# Virtual provides for the packages bundled by setuptools. +# Bundled packages are defined in two files: +# - pkg_resources/_vendor/vendored.txt, and +# - setuptools/_vendor/vendored.txt +# Merge them to one and then generate the list with: +# %%{_rpmconfigdir}/pythonbundles.py --namespace 'python%%{python3_pkgversion}dist' allvendor.txt +%global bundled %{expand: +Provides: bundled(python%{python3_pkgversion}dist(appdirs)) = 1.4.3 +Provides: bundled(python%{python3_pkgversion}dist(more-itertools)) = 8.8 +Provides: bundled(python%{python3_pkgversion}dist(ordered-set)) = 3.1.1 +Provides: bundled(python%{python3_pkgversion}dist(packaging)) = 21.2 +Provides: bundled(python%{python3_pkgversion}dist(pyparsing)) = 2.2.1 +} + +%package -n python%{python3_pkgversion}-setuptools +Summary: Easily build and distribute Python 3 packages +%{bundled} + +%if %{with bootstrap} +Provides: python%{python3_pkgversion}dist(setuptools) = %{version} +Provides: python%{python3_version}dist(setuptools) = %{version} +%endif + +# For users who might see ModuleNotFoundError: No module named 'pkg_resoureces' +%py_provides python%{python3_pkgversion}-pkg_resources +%py_provides python%{python3_pkgversion}-pkg-resources + +%description -n python%{python3_pkgversion}-setuptools +Setuptools is a collection of enhancements to the Python 3 distutils that allow +you to more easily build and distribute Python 3 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. + +%if %{without bootstrap} +%package -n %{python_wheel_pkg_prefix}-%{srcname}-wheel +Summary: The setuptools wheel +%{bundled} + +%description -n %{python_wheel_pkg_prefix}-%{srcname}-wheel +A Python wheel of setuptools to use with venv. +%endif + + +%prep +%autosetup -p1 -n %{srcname}-%{version} +%if %{without bootstrap} +# If we don't have setuptools installed yet, we use the pre-generated .egg-info +# See https://github.com/pypa/setuptools/pull/2543 +# And https://github.com/pypa/setuptools/issues/2550 +rm -r %{srcname}.egg-info +%endif + +# Strip shbang +find setuptools pkg_resources -name \*.py | xargs sed -i -e '1 {/^#!\//d}' +# Remove bundled exes +rm -f setuptools/*.exe +# Don't ship these +rm -r docs/conf.py + +%if %{without bootstrap} +%generate_buildrequires +%pyproject_buildrequires -r %{?with_tests:-x testing} +%endif + +%build +%if %{with bootstrap} +%py3_build +%else +%pyproject_wheel +%endif + + +%install +%if %{with bootstrap} +%py3_install +%else +%pyproject_install +%pyproject_save_files setuptools pkg_resources _distutils_hack +%endif + +# https://github.com/pypa/setuptools/issues/2709 +rm -rf %{buildroot}%{python3_sitelib}/pkg_resources/tests/ +%if %{without bootstrap} +sed -i '/\/pkg_resources\/tests\b/d' %{pyproject_files} + +# Install the wheel for the python-setuptools-wheel package +mkdir -p %{buildroot}%{python_wheel_dir} +install -p %{_pyproject_wheeldir}/%{python_wheel_name} -t %{buildroot}%{python_wheel_dir} +%endif + + +%if %{with tests} +%check +# Verify bundled provides are up to date +cat pkg_resources/_vendor/vendored.txt setuptools/_vendor/vendored.txt > allvendor.txt +%{_rpmconfigdir}/pythonbundles.py allvendor.txt --namespace 'python%{python3_pkgversion}dist' --compare-with '%{bundled}' + +# Regression test, the wheel should not be larger than 600 KiB +# https://bugzilla.redhat.com/show_bug.cgi?id=1914481#c3 +test $(du %{_pyproject_wheeldir}/%{python_wheel_name} | cut -f1) -lt 600 + +# Regression test, the tests are not supposed to be installed +test ! -d %{buildroot}%{python3_sitelib}/pkg_resources/tests +test ! -d %{buildroot}%{python3_sitelib}/setuptools/tests + +# https://github.com/pypa/setuptools/discussions/2607 +rm pyproject.toml + +# Upstream tests +# --ignore=setuptools/tests/test_integration.py +# the tests require internet connection +# --ignore=pavement.py: +# pavement.py is only used by upstream to do releases and vendoring, we don't ship it +PYTHONPATH=$(pwd) %pytest --ignore=setuptools/tests/test_integration.py --ignore=pavement.py +%endif # with tests + + +%files -n python%{python3_pkgversion}-setuptools %{?!with_bootstrap:-f %{pyproject_files}} +%license LICENSE +%doc docs/* CHANGES.rst README.rst +%{python3_sitelib}/distutils-precedence.pth +%if %{with bootstrap} +%{python3_sitelib}/setuptools-%{version}-py%{python3_version}.egg-info/ +%{python3_sitelib}/pkg_resources/ +%{python3_sitelib}/setuptools/ +%{python3_sitelib}/_distutils_hack/ +%endif + +%if %{without bootstrap} +%files -n %{python_wheel_pkg_prefix}-%{srcname}-wheel +%license LICENSE +# we own the dir for simplicity +%dir %{python_wheel_dir}/ +%{python_wheel_dir}/%{python_wheel_name} +%endif + + +%changelog +* Wed Mar 09 2022 mgb01105731 - 60.9.1-1 +- Init from upstream version 60.9.1 + diff --git a/setuptools-60.9.1.tar.gz b/setuptools-60.9.1.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..8a6a5f865cde5958b64656de473ffc8d817cba59 Binary files /dev/null and b/setuptools-60.9.1.tar.gz differ