## START: Set by rpmautospec ## (rpmautospec version 0.8.1) ## RPMAUTOSPEC: autorelease, autochangelog %define autorelease(e:s:pb:n) %{?-p:0.}%{lua: release_number = 4; base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); print(release_number + base_release_number - 1); }%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}} ## END: Set by rpmautospec %global python3_pkgversion 3.14 %global srcname setuptools # used when bootstrapping new Python versions %bcond bootstrap 0 # The original RHEL N+1 content set is defined by (build)dependencies # of the packages in Fedora ELN. Hence we disable tests and documentation here # to prevent pulling many unwanted packages in. %bcond tests %[%{without bootstrap} && %{defined fedora}] %global python_wheel_name %{srcname}-%{version}-py3-none-any.whl Name: python%{python3_pkgversion}-setuptools # When updating, update the bundled libraries versions bellow! Version: 78.1.1 Release: %autorelease Summary: Easily build and distribute Python packages # setuptools is MIT # autocommand is LGPL-3.0-only # backports-tarfile is MIT # importlib-metadata is Apache-2.0 # inflect is MIT # jaraco-context is MIT # jaraco-collections is MIT # jaraco-functools is MIT # jaraco-text is MIT # more-itertools is MIT # packaging is BSD-2-Clause OR Apache-2.0 # platformdirs is MIT # tomli is MIT # typeguard is MIT # typing-extensions is Python-2.0.1 # wheel is MIT # zipp is MIT # the setuptools logo is MIT License: MIT AND Apache-2.0 AND (BSD-2-Clause OR Apache-2.0) AND Python-2.0.1 AND LGPL-3.0-only URL: https://pypi.python.org/pypi/%{srcname} Source0: %{pypi_source %{srcname} %{version}} # The `setup.py install` deprecation notice might be confusing for RPM packagers # adjust it, but only when $RPM_BUILD_ROOT is set Patch: Adjust-the-setup.py-install-deprecation-message.patch # setuptools rewrites all shebangs to "#!python" which breaks workflows # where no external installers (usually rewriting this) are involved. # https://github.com/pypa/setuptools/issues/4883 # - Resolution: deprecated functionality won't be fixed. # brp-mangle-shebang script cannot mangle this and fails for many pkgs. Patch: Revert-Always-rewrite-a-Python-shebang-to-python.patch BuildArch: noarch BuildRequires: python%{python3_pkgversion}-devel %if %{with bootstrap} BuildRequires: unzip %endif %if %{with tests} BuildRequires: gcc %endif # 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 to accept multiple files as input BuildRequires: python3-rpm-generators >= 12-8 # we also use %%{_pyproject_wheeldir}, so an explicit requirement on the pyproject-macros is needed BuildRequires: pyproject-rpm-macros %if %{without bootstrap} # Not to use the pre-generated egg-info, we use setuptools from previous build to generate it BuildRequires: python%{python3_pkgversion}-setuptools %endif # Virtual provides for the packages bundled by setuptools. # Bundled packages are defined in multiple files. Generate the list with: # pip freeze --path setuptools/_vendor > vendored.txt # %%{_rpmconfigdir}/pythonbundles.py --namespace 'python%%{python3_pkgversion}dist' vendored.txt %global bundled %{expand: Provides: bundled(python%{python3_pkgversion}dist(autocommand)) = 2.2.2 Provides: bundled(python%{python3_pkgversion}dist(backports-tarfile)) = 1.2 Provides: bundled(python%{python3_pkgversion}dist(importlib-metadata)) = 8 Provides: bundled(python%{python3_pkgversion}dist(inflect)) = 7.3.1 Provides: bundled(python%{python3_pkgversion}dist(jaraco-collections)) = 5.1 Provides: bundled(python%{python3_pkgversion}dist(jaraco-context)) = 5.3 Provides: bundled(python%{python3_pkgversion}dist(jaraco-functools)) = 4.0.1 Provides: bundled(python%{python3_pkgversion}dist(jaraco-text)) = 3.12.1 Provides: bundled(python%{python3_pkgversion}dist(more-itertools)) = 10.3 Provides: bundled(python%{python3_pkgversion}dist(packaging)) = 24.2 Provides: bundled(python%{python3_pkgversion}dist(platformdirs)) = 4.2.2 Provides: bundled(python%{python3_pkgversion}dist(tomli)) = 2.0.1 Provides: bundled(python%{python3_pkgversion}dist(typeguard)) = 4.3 Provides: bundled(python%{python3_pkgversion}dist(typing-extensions)) = 4.12.2 Provides: bundled(python%{python3_pkgversion}dist(wheel)) = 0.45.1 Provides: bundled(python%{python3_pkgversion}dist(zipp)) = 3.19.2 } %{bundled} # For users who might see ModuleNotFoundError: No module named 'pkg_resoureces' # NB: Those are two different provides: one contains underscore, the other hyphen %py_provides python%{python3_pkgversion}-pkg_resources %py_provides python%{python3_pkgversion}-pkg-resources %description 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. %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. %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 # WARNING: We cannot remove this folder since Python 3.11.1, # see https://github.com/pypa/setuptools/issues/3761 #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 test} %endif %build %if %{with bootstrap} %{python3} setup.py bdist_wheel mkdir -p %{_pyproject_wheeldir} mv dist/%{python_wheel_name} %{_pyproject_wheeldir} %else %pyproject_wheel %endif %install %if %{with bootstrap} mkdir -p %{buildroot}%{python3_sitelib} unzip %{_pyproject_wheeldir}/%{python_wheel_name} -d %{buildroot}%{python3_sitelib} -x setuptools-%{version}.dist-info/RECORD echo rpm > %{buildroot}%{python3_sitelib}/setuptools-%{version}.dist-info/INSTALLER %else %pyproject_install %pyproject_save_files -l setuptools pkg_resources _distutils_hack sed -Ei '/\/tests\b/d' %{pyproject_files} %endif # https://github.com/pypa/setuptools/issues/2709 find %{buildroot}%{python3_sitelib} -name tests -print0 | xargs -0 rm -r # 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} %check %if %{without bootstrap} # Verify bundled provides are up to date %{python3} -m pip freeze --path setuptools/_vendor > vendored.txt %{_rpmconfigdir}/pythonbundles.py vendored.txt --namespace 'python%{python3_pkgversion}dist' --compare-with '%{bundled}' # Regression test, the wheel should not be larger than 1300 kB # https://bugzilla.redhat.com/show_bug.cgi?id=1914481#c3 test $(stat --format %%s %{_pyproject_wheeldir}/%{python_wheel_name}) -lt 1300000 %pyproject_check_import -e '*.tests' -e '*.tests.*' %endif # 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 test ! -d %{buildroot}%{python3_sitelib}/setuptools/_distutils/tests %if %{with tests} # Upstream tests # --ignore=setuptools/tests/integration/ # --ignore=setuptools/tests/config/test_apply_pyprojecttoml.py # -k "not test_pip_upgrade_from_source and not test_equivalent_output" # the tests require internet connection # --ignore=setuptools/tests/test_editable_install.py # the tests require pip-run which we don't have in Fedora # -k "not test_wheel_includes_cli_scripts" # the test expects removed .exe files to be installed # --ignore=tools # the tests test various upstream release tools we don't use/ship PRE_BUILT_SETUPTOOLS_WHEEL=%{_pyproject_wheeldir}/%{python_wheel_name} \ PYTHONPATH=$(pwd) %pytest \ --ignore=setuptools/tests/integration/ \ --ignore=setuptools/tests/test_editable_install.py \ --ignore=setuptools/tests/config/test_apply_pyprojecttoml.py \ --ignore=tools \ -k "not test_pip_upgrade_from_source and not test_wheel_includes_cli_scripts and not test_equivalent_output" %endif # with tests %files -n python%{python3_pkgversion}-setuptools %{?!with_bootstrap:-f %{pyproject_files}} %doc docs/* NEWS.rst README.rst %{python3_sitelib}/distutils-precedence.pth %if %{with bootstrap} %{python3_sitelib}/setuptools-%{version}.dist-info/ %license %{python3_sitelib}/setuptools-%{version}.dist-info/licenses/LICENSE %{python3_sitelib}/pkg_resources/ %{python3_sitelib}/setuptools/ %{python3_sitelib}/_distutils_hack/ %endif %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} %changelog ## START: Generated by rpmautospec * Thu Nov 27 2025 Lumir Balhar - 78.1.1-4 - Disable bootstrap * Tue Nov 25 2025 Lukáš Zachar - 78.1.1-3 - Adjust gating - Generic gating.yaml for all rhel - Use CS repos instead of Fedora - Remove python versions not available on c9s - use python-isort to test * Tue Nov 25 2025 Tomáš Hrnčiar - 78.1.1-2 - Convert from Fedora for the Python 3.14 stack in RHEL * Tue Nov 25 2025 Tomáš Hrnčiar - 78.1.1-1 - RHEL: Rename SPEC to python3.14-setuptools.spec ## END: Generated by rpmautospec