2017-08-07 14:12:23 +00:00
|
|
|
%global srcname setuptools
|
2014-04-21 15:23:27 +00:00
|
|
|
|
2023-02-10 16:56:48 +00:00
|
|
|
# used when bootstrapping new Python versions
|
|
|
|
%bcond bootstrap 0
|
2020-12-04 12:34:10 +00:00
|
|
|
|
2020-09-02 11:34:01 +00:00
|
|
|
# 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.
|
2023-02-10 16:56:48 +00:00
|
|
|
%bcond main_python 1
|
|
|
|
|
|
|
|
# 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.
|
|
|
|
# We intentionally keep this enabled on EPEL.
|
|
|
|
%bcond tests %[%{without bootstrap} && (%{defined fedora} || %{defined epel})]
|
2015-01-19 09:54:17 +00:00
|
|
|
|
2021-09-29 10:54:41 +00:00
|
|
|
%global python_wheel_name %{srcname}-%{version}-py3-none-any.whl
|
2005-12-27 11:38:56 +00:00
|
|
|
|
|
|
|
Name: python-setuptools
|
2018-09-24 13:27:55 +00:00
|
|
|
# When updating, update the bundled libraries versions bellow!
|
2024-02-06 11:29:19 +00:00
|
|
|
Version: 69.0.3
|
2024-01-29 13:58:46 +00:00
|
|
|
Release: %autorelease
|
2008-11-23 19:41:34 +00:00
|
|
|
Summary: Easily build and distribute Python packages
|
2018-09-24 13:27:55 +00:00
|
|
|
# setuptools is MIT
|
2023-03-08 01:50:54 +00:00
|
|
|
# platformdirs is MIT
|
2021-06-18 05:08:56 +00:00
|
|
|
# more-itertools is MIT
|
2021-06-18 05:08:12 +00:00
|
|
|
# ordered-set is MIT
|
2022-10-13 11:22:09 +00:00
|
|
|
# packaging is BSD-2-Clause OR Apache-2.0
|
|
|
|
# importlib-metadata is Apache-2.0
|
|
|
|
# importlib-resources is Apache-2.0
|
2022-03-10 09:22:04 +00:00
|
|
|
# jaraco.text is MIT
|
2022-10-13 11:22:09 +00:00
|
|
|
# typing-extensions is Python-2.0.1
|
2022-03-10 09:22:04 +00:00
|
|
|
# zipp is MIT
|
2022-05-20 00:41:11 +00:00
|
|
|
# nspektr is MIT
|
|
|
|
# tomli is MIT
|
2021-11-10 14:59:14 +00:00
|
|
|
# the setuptools logo is MIT
|
2022-10-13 11:22:09 +00:00
|
|
|
License: MIT AND Apache-2.0 AND (BSD-2-Clause OR Apache-2.0) AND Python-2.0.1
|
2015-05-18 15:25:57 +00:00
|
|
|
URL: https://pypi.python.org/pypi/%{srcname}
|
2020-12-29 12:56:36 +00:00
|
|
|
Source0: %{pypi_source %{srcname} %{version}}
|
2005-12-27 11:38:56 +00:00
|
|
|
|
2021-09-15 06:16:59 +00:00
|
|
|
# Some test deps are optional and either not desired or not available in Fedora, thus this patch removes them.
|
2022-03-10 08:49:02 +00:00
|
|
|
Patch: Remove-optional-or-unpackaged-test-deps.patch
|
2022-04-19 14:44:14 +00:00
|
|
|
|
2023-05-05 15:55:25 +00:00
|
|
|
# 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
|
|
|
|
|
2024-07-26 12:04:09 +00:00
|
|
|
# Security fix for CVE-2024-6345
|
|
|
|
# Remote code execution via download functions in the package_index module
|
|
|
|
# Tracking bug: https://bugzilla.redhat.com/show_bug.cgi?id=2297771
|
|
|
|
# Upstream solution: https://github.com/pypa/setuptools/pull/4332
|
|
|
|
# Patch simplified because upstream doesn't support SVN anymore.
|
|
|
|
Patch: CVE-2024-6345.patch
|
|
|
|
|
2005-12-27 11:38:56 +00:00
|
|
|
BuildArch: noarch
|
2017-08-07 14:12:23 +00:00
|
|
|
|
2020-09-02 11:30:31 +00:00
|
|
|
BuildRequires: python%{python3_pkgversion}-devel
|
2021-07-19 07:56:01 +00:00
|
|
|
|
2017-08-11 14:50:45 +00:00
|
|
|
%if %{with tests}
|
2020-12-04 12:39:59 +00:00
|
|
|
BuildRequires: gcc
|
2021-07-19 07:56:01 +00:00
|
|
|
%endif
|
|
|
|
|
2019-03-10 18:51:01 +00:00
|
|
|
# python3 bootstrap: this is built before the final build of python3, which
|
|
|
|
# adds the dependency on python3-rpm-generators, so we require it manually
|
2023-03-07 16:44:57 +00:00
|
|
|
# The minimal version is for bundled provides verification script to accept multiple files as input
|
|
|
|
BuildRequires: python3-rpm-generators >= 12-8
|
2023-03-16 09:41:58 +00:00
|
|
|
|
|
|
|
%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
|
2021-07-19 07:56:01 +00:00
|
|
|
%endif
|
2005-12-27 11:38:56 +00:00
|
|
|
|
2007-08-27 23:26:53 +00:00
|
|
|
%description
|
2008-11-23 19:41:34 +00:00
|
|
|
Setuptools is a collection of enhancements to the Python distutils that allow
|
2007-08-27 23:26:53 +00:00
|
|
|
you to more easily build and distribute Python packages, especially ones that
|
|
|
|
have dependencies on other packages.
|
|
|
|
|
2013-11-04 19:59:43 +00:00
|
|
|
This package also contains the runtime components of setuptools, necessary to
|
2020-02-11 16:11:37 +00:00
|
|
|
execute the software that requires pkg_resources.
|
2007-08-27 23:26:53 +00:00
|
|
|
|
2018-09-24 13:27:55 +00:00
|
|
|
# Virtual provides for the packages bundled by setuptools.
|
2023-03-07 16:44:57 +00:00
|
|
|
# Bundled packages are defined in multiple files. Generate the list with:
|
|
|
|
# %%{_rpmconfigdir}/pythonbundles.py --namespace 'python%%{python3_pkgversion}dist' */_vendor/vendored.txt
|
2020-02-11 16:11:37 +00:00
|
|
|
%global bundled %{expand:
|
2023-03-08 01:50:54 +00:00
|
|
|
Provides: bundled(python%{python3_pkgversion}dist(importlib-metadata)) = 6
|
|
|
|
Provides: bundled(python%{python3_pkgversion}dist(importlib-resources)) = 5.10.2
|
2022-03-10 09:22:04 +00:00
|
|
|
Provides: bundled(python%{python3_pkgversion}dist(jaraco-text)) = 3.7
|
2021-06-18 05:08:56 +00:00
|
|
|
Provides: bundled(python%{python3_pkgversion}dist(more-itertools)) = 8.8
|
2021-06-18 05:08:12 +00:00
|
|
|
Provides: bundled(python%{python3_pkgversion}dist(ordered-set)) = 3.1.1
|
2023-09-21 07:09:17 +00:00
|
|
|
Provides: bundled(python%{python3_pkgversion}dist(packaging)) = 23.1
|
2024-02-06 11:29:32 +00:00
|
|
|
Provides: bundled(python%{python3_pkgversion}dist(platformdirs)) = 2.6.2
|
|
|
|
Provides: bundled(python%{python3_pkgversion}dist(tomli)) = 2.0.1
|
2022-03-10 09:22:04 +00:00
|
|
|
Provides: bundled(python%{python3_pkgversion}dist(typing-extensions)) = 4.0.1
|
2024-02-06 11:29:32 +00:00
|
|
|
Provides: bundled(python%{python3_pkgversion}dist(typing-extensions)) = 4.4
|
2022-03-10 09:22:04 +00:00
|
|
|
Provides: bundled(python%{python3_pkgversion}dist(zipp)) = 3.7
|
2018-09-24 13:27:55 +00:00
|
|
|
}
|
2017-08-07 14:12:23 +00:00
|
|
|
|
2020-09-02 11:30:31 +00:00
|
|
|
%package -n python%{python3_pkgversion}-setuptools
|
2010-01-29 03:51:36 +00:00
|
|
|
Summary: Easily build and distribute Python 3 packages
|
2020-02-11 16:11:37 +00:00
|
|
|
%{bundled}
|
2010-01-29 03:51:36 +00:00
|
|
|
|
2021-04-22 14:01:11 +00:00
|
|
|
# For users who might see ModuleNotFoundError: No module named 'pkg_resoureces'
|
2022-03-10 09:22:51 +00:00
|
|
|
# NB: Those are two different provides: one contains underscore, the other hyphen
|
2021-04-22 14:01:11 +00:00
|
|
|
%py_provides python%{python3_pkgversion}-pkg_resources
|
|
|
|
%py_provides python%{python3_pkgversion}-pkg-resources
|
2019-08-14 20:41:08 +00:00
|
|
|
|
2020-09-02 11:30:31 +00:00
|
|
|
%description -n python%{python3_pkgversion}-setuptools
|
2010-01-29 03:51:36 +00:00
|
|
|
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.
|
|
|
|
|
2013-11-04 19:59:43 +00:00
|
|
|
This package also contains the runtime components of setuptools, necessary to
|
2020-02-11 16:11:37 +00:00
|
|
|
execute the software that requires pkg_resources.
|
2010-08-10 17:26:57 +00:00
|
|
|
|
2018-08-15 13:16:16 +00:00
|
|
|
%if %{without bootstrap}
|
2021-09-29 10:54:41 +00:00
|
|
|
%package -n %{python_wheel_pkg_prefix}-%{srcname}-wheel
|
2018-08-15 13:16:16 +00:00
|
|
|
Summary: The setuptools wheel
|
2020-02-11 16:11:37 +00:00
|
|
|
%{bundled}
|
2018-08-15 13:16:16 +00:00
|
|
|
|
2021-09-29 10:54:41 +00:00
|
|
|
%description -n %{python_wheel_pkg_prefix}-%{srcname}-wheel
|
2018-08-15 13:16:16 +00:00
|
|
|
A Python wheel of setuptools to use with venv.
|
|
|
|
%endif
|
|
|
|
|
2010-01-29 03:51:36 +00:00
|
|
|
|
2005-12-27 11:38:56 +00:00
|
|
|
%prep
|
2018-07-19 09:31:18 +00:00
|
|
|
%autosetup -p1 -n %{srcname}-%{version}
|
2021-02-02 15:02:53 +00:00
|
|
|
%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
|
2023-01-23 11:04:34 +00:00
|
|
|
# WARNING: We cannot remove this folder since Python 3.11.1,
|
|
|
|
# see https://github.com/pypa/setuptools/issues/3761
|
|
|
|
#rm -r %%{srcname}.egg-info
|
2021-02-02 15:02:53 +00:00
|
|
|
%endif
|
2014-10-11 19:43:20 +00:00
|
|
|
|
2016-01-12 17:04:06 +00:00
|
|
|
# Strip shbang
|
2018-07-27 12:40:21 +00:00
|
|
|
find setuptools pkg_resources -name \*.py | xargs sed -i -e '1 {/^#!\//d}'
|
2014-10-11 19:43:20 +00:00
|
|
|
# Remove bundled exes
|
|
|
|
rm -f setuptools/*.exe
|
2021-07-19 07:56:01 +00:00
|
|
|
# Don't ship these
|
2021-08-03 11:48:58 +00:00
|
|
|
rm -r docs/conf.py
|
2021-07-19 07:56:01 +00:00
|
|
|
|
|
|
|
%if %{without bootstrap}
|
|
|
|
%generate_buildrequires
|
|
|
|
%pyproject_buildrequires -r %{?with_tests:-x testing}
|
|
|
|
%endif
|
2021-03-02 12:43:02 +00:00
|
|
|
|
2005-12-27 11:38:56 +00:00
|
|
|
%build
|
2021-07-19 07:56:01 +00:00
|
|
|
%if %{with bootstrap}
|
2017-01-03 15:10:38 +00:00
|
|
|
%py3_build
|
2021-07-19 07:56:01 +00:00
|
|
|
%else
|
|
|
|
%pyproject_wheel
|
2014-04-21 15:23:27 +00:00
|
|
|
%endif
|
2017-08-07 14:12:23 +00:00
|
|
|
|
2006-06-28 15:39:31 +00:00
|
|
|
|
2010-01-29 03:51:36 +00:00
|
|
|
%install
|
2021-07-19 07:56:01 +00:00
|
|
|
%if %{with bootstrap}
|
2023-03-15 22:24:57 +00:00
|
|
|
# The setup.py install command tries to import distutils
|
|
|
|
# but the distutils-precedence.pth file is not yet respected
|
|
|
|
# and Python 3.12+ no longer has distutils in the standard library.
|
|
|
|
ln -s setuptools/_distutils distutils
|
|
|
|
PYTHONPATH=$PWD %py3_install
|
|
|
|
unlink distutils
|
2021-07-19 07:56:01 +00:00
|
|
|
%else
|
|
|
|
%pyproject_install
|
|
|
|
%pyproject_save_files setuptools pkg_resources _distutils_hack
|
2014-04-21 15:23:27 +00:00
|
|
|
%endif
|
2007-08-27 23:26:53 +00:00
|
|
|
|
2021-07-19 07:56:01 +00:00
|
|
|
# https://github.com/pypa/setuptools/issues/2709
|
|
|
|
rm -rf %{buildroot}%{python3_sitelib}/pkg_resources/tests/
|
2017-08-07 14:12:23 +00:00
|
|
|
%if %{without bootstrap}
|
2021-07-19 07:56:01 +00:00
|
|
|
sed -i '/\/pkg_resources\/tests\b/d' %{pyproject_files}
|
2016-01-12 17:04:06 +00:00
|
|
|
|
2021-07-19 07:56:01 +00:00
|
|
|
# Install the wheel for the python-setuptools-wheel package
|
2021-09-29 10:54:41 +00:00
|
|
|
mkdir -p %{buildroot}%{python_wheel_dir}
|
|
|
|
install -p %{_pyproject_wheeldir}/%{python_wheel_name} -t %{buildroot}%{python_wheel_dir}
|
2018-08-15 13:16:16 +00:00
|
|
|
%endif
|
|
|
|
|
2021-07-19 07:56:01 +00:00
|
|
|
|
2010-01-29 03:51:36 +00:00
|
|
|
%check
|
2023-03-07 16:44:57 +00:00
|
|
|
# Verify bundled provides are up to date
|
|
|
|
%{_rpmconfigdir}/pythonbundles.py */_vendor/vendored.txt --namespace 'python%{python3_pkgversion}dist' --compare-with '%{bundled}'
|
|
|
|
|
2021-07-19 07:56:01 +00:00
|
|
|
# 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
|
|
|
|
|
2023-02-10 16:43:21 +00:00
|
|
|
%if %{without bootstrap}
|
2023-03-16 09:41:58 +00:00
|
|
|
# Regression test, the wheel should not be larger than 900 kB
|
|
|
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1914481#c3
|
|
|
|
test $(stat --format %%s %{_pyproject_wheeldir}/%{python_wheel_name}) -lt 900000
|
|
|
|
|
2023-02-10 16:43:21 +00:00
|
|
|
%pyproject_check_import
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%if %{with tests}
|
2021-07-19 07:56:01 +00:00
|
|
|
# https://github.com/pypa/setuptools/discussions/2607
|
|
|
|
rm pyproject.toml
|
2021-01-11 14:32:23 +00:00
|
|
|
|
2020-06-26 12:11:40 +00:00
|
|
|
# Upstream tests
|
2021-07-19 07:56:01 +00:00
|
|
|
# --ignore=setuptools/tests/test_integration.py
|
2022-03-10 09:22:04 +00:00
|
|
|
# --ignore=setuptools/tests/integration/
|
2022-05-20 00:41:11 +00:00
|
|
|
# --ignore=setuptools/tests/config/test_apply_pyprojecttoml.py
|
2022-03-10 09:22:04 +00:00
|
|
|
# -k "not test_pip_upgrade_from_source"
|
2021-07-19 07:56:01 +00:00
|
|
|
# the tests require internet connection
|
2022-12-15 18:30:27 +00:00
|
|
|
# --ignore=setuptools/tests/test_editable_install.py
|
2022-03-10 09:22:04 +00:00
|
|
|
# the tests require pip-run which we don't have in Fedora
|
|
|
|
PRE_BUILT_SETUPTOOLS_WHEEL=%{_pyproject_wheeldir}/%{python_wheel_name} \
|
|
|
|
PYTHONPATH=$(pwd) %pytest \
|
|
|
|
--ignore=setuptools/tests/test_integration.py \
|
|
|
|
--ignore=setuptools/tests/integration/ \
|
2022-07-28 08:55:18 +00:00
|
|
|
--ignore=setuptools/tests/test_editable_install.py \
|
2022-05-20 00:41:11 +00:00
|
|
|
--ignore=setuptools/tests/config/test_apply_pyprojecttoml.py \
|
2023-09-21 07:09:17 +00:00
|
|
|
--ignore=tools/finalize.py \
|
|
|
|
-k "not test_pip_upgrade_from_source and not test_setup_requires_honors_fetch_params"
|
2017-08-11 14:50:45 +00:00
|
|
|
%endif # with tests
|
2006-06-28 15:39:31 +00:00
|
|
|
|
2017-08-07 14:12:23 +00:00
|
|
|
|
2021-07-19 07:56:01 +00:00
|
|
|
%files -n python%{python3_pkgversion}-setuptools %{?!with_bootstrap:-f %{pyproject_files}}
|
2017-08-09 13:03:58 +00:00
|
|
|
%license LICENSE
|
2023-09-21 07:09:17 +00:00
|
|
|
%doc docs/* NEWS.rst README.rst
|
2021-07-19 07:56:01 +00:00
|
|
|
%{python3_sitelib}/distutils-precedence.pth
|
|
|
|
%if %{with bootstrap}
|
|
|
|
%{python3_sitelib}/setuptools-%{version}-py%{python3_version}.egg-info/
|
2016-02-03 23:07:34 +00:00
|
|
|
%{python3_sitelib}/pkg_resources/
|
2021-07-19 07:56:01 +00:00
|
|
|
%{python3_sitelib}/setuptools/
|
2020-08-20 12:50:04 +00:00
|
|
|
%{python3_sitelib}/_distutils_hack/
|
2021-07-19 07:56:01 +00:00
|
|
|
%endif
|
2005-12-27 11:38:56 +00:00
|
|
|
|
2018-08-15 13:16:16 +00:00
|
|
|
%if %{without bootstrap}
|
2021-09-29 10:54:41 +00:00
|
|
|
%files -n %{python_wheel_pkg_prefix}-%{srcname}-wheel
|
2018-08-15 13:16:16 +00:00
|
|
|
%license LICENSE
|
|
|
|
# we own the dir for simplicity
|
2021-09-29 10:54:41 +00:00
|
|
|
%dir %{python_wheel_dir}/
|
|
|
|
%{python_wheel_dir}/%{python_wheel_name}
|
2018-08-15 13:16:16 +00:00
|
|
|
%endif
|
|
|
|
|
2017-08-11 14:50:15 +00:00
|
|
|
|
2005-12-27 11:38:56 +00:00
|
|
|
%changelog
|
2024-01-29 13:58:46 +00:00
|
|
|
%autochangelog
|