Blame SPECS/python3.11-setuptools.spec

c7f726
%global __python3 /usr/bin/python3.11
c7f726
%global python3_pkgversion 3.11
c7f726
c7f726
%global srcname setuptools
c7f726
c7f726
# Some dependencies are missing on RHEL
c7f726
%bcond_with tests
c7f726
c7f726
#  WARNING  When bootstrapping, disable tests as well,
c7f726
#           because tests need pip.
c7f726
%bcond_with bootstrap
c7f726
# Similar to what we have in pythonX.Y.spec files.
c7f726
# If enabled, provides unversioned executables and other stuff.
c7f726
c7f726
c7f726
%if %{without bootstrap}
c7f726
%global python_wheel_name %{srcname}-%{version}-py3-none-any.whl
c7f726
%global python3_record %{python3_sitelib}/%{srcname}-%{version}.dist-info/RECORD
c7f726
%endif
c7f726
c7f726
Name:           python%{python3_pkgversion}-setuptools
c7f726
# When updating, update the bundled libraries versions bellow!
c7f726
Version:        65.5.1
c7f726
Release:        2%{?dist}
c7f726
Summary:        Easily build and distribute Python packages
c7f726
# setuptools is MIT
c7f726
# appdirs is MIT
c7f726
# more-itertools is MIT
c7f726
# ordered-set is MIT
c7f726
# packaging is BSD or ASL 2.0
c7f726
# pyparsing is MIT
c7f726
# importlib-metadata is ASL 2.0
c7f726
# importlib-resources is ASL 2.0
c7f726
# jaraco.text is MIT
c7f726
# typing-extensions is Python
c7f726
# zipp is MIT
c7f726
# nspektr is MIT
c7f726
# tomli is MIT
c7f726
# the setuptools logo is MIT
c7f726
License:        MIT and ASL 2.0 and (BSD or ASL 2.0) and Python
c7f726
URL:            https://pypi.python.org/pypi/%{srcname}
c7f726
Source0:        %{pypi_source %{srcname} %{version}}
c7f726
c7f726
# Some test deps are optional and either not desired or not available in Fedora, thus this patch removes them.
c7f726
Patch0:          Remove-optional-or-unpackaged-test-deps.patch
c7f726
c7f726
BuildArch:      noarch
c7f726
c7f726
BuildRequires:  python%{python3_pkgversion}-devel
c7f726
BuildRequires:  python%{python3_pkgversion}-rpm-macros
c7f726
%if %{with tests}
c7f726
BuildRequires:  gcc
c7f726
BuildRequires:  python%{python3_pkgversion}-pip
c7f726
BuildRequires:  python%{python3_pkgversion}-pytest
c7f726
BuildRequires:  python%{python3_pkgversion}-pytest-xdist
c7f726
BuildRequires:  python%{python3_pkgversion}-pytest-virtualenv
c7f726
BuildRequires:  python%{python3_pkgversion}-jaraco-envs
c7f726
BuildRequires:  python%{python3_pkgversion}-jaraco-path
c7f726
BuildRequires:  python%{python3_pkgversion}-virtualenv
c7f726
BuildRequires:  python%{python3_pkgversion}-wheel
c7f726
BuildRequires:  python%{python3_pkgversion}-build
c7f726
BuildRequires:  python%{python3_pkgversion}-ini2toml
c7f726
BuildRequires:  python%{python3_pkgversion}-tomli-w
c7f726
%endif # with tests
c7f726
%if %{without bootstrap}
c7f726
# Not to use the pre-generated egg-info, we use setuptools from previous build to generate it
c7f726
BuildRequires:  python%{python3_pkgversion}-pip
c7f726
BuildRequires:  python%{python3_pkgversion}-wheel
c7f726
BuildRequires:  python%{python3_pkgversion}-setuptools
c7f726
# python3 bootstrap: this is built before the final build of python3, which
c7f726
# adds the dependency on python3-rpm-generators, so we require it manually
c7f726
BuildRequires:  python3-rpm-generators
c7f726
%endif # without bootstrap
c7f726
c7f726
# Virtual provides for the packages bundled by setuptools.
c7f726
# Bundled packages are defined in two files:
c7f726
# - pkg_resources/_vendor/vendored.txt, and
c7f726
# - setuptools/_vendor/vendored.txt
c7f726
# Merge them to one and then generate the list with:
c7f726
# %%{_rpmconfigdir}/pythonbundles.py --namespace 'python%%{python3_pkgversion}dist' allvendor.txt
c7f726
%global bundled %{expand:
c7f726
Provides: bundled(python%{python3_pkgversion}dist(appdirs)) = 1.4.3
c7f726
Provides: bundled(python%{python3_pkgversion}dist(importlib-metadata)) = 4.11.1
c7f726
Provides: bundled(python%{python3_pkgversion}dist(importlib-resources)) = 5.4
c7f726
Provides: bundled(python%{python3_pkgversion}dist(jaraco-text)) = 3.7
c7f726
Provides: bundled(python%{python3_pkgversion}dist(more-itertools)) = 8.8
c7f726
Provides: bundled(python%{python3_pkgversion}dist(ordered-set)) = 3.1.1
c7f726
Provides: bundled(python%{python3_pkgversion}dist(packaging)) = 21.3
c7f726
Provides: bundled(python%{python3_pkgversion}dist(pyparsing)) = 3.0.9
c7f726
Provides: bundled(python%{python3_pkgversion}dist(typing-extensions)) = 4.0.1
c7f726
Provides: bundled(python%{python3_pkgversion}dist(zipp)) = 3.7
c7f726
Provides: bundled(python%{python3_pkgversion}dist(tomli)) = 2.0.1
c7f726
}
c7f726
c7f726
%{bundled}
c7f726
c7f726
# For users who might see ModuleNotFoundError: No module named 'pkg_resources'
c7f726
# NB: Those are two different provides: one contains underscore, the other hyphen
c7f726
%py_provides    python%{python3_pkgversion}-pkg_resources
c7f726
%py_provides    python%{python3_pkgversion}-pkg-resources
c7f726
c7f726
%description
c7f726
Setuptools is a collection of enhancements to the Python 3 distutils that allow
c7f726
you to more easily build and distribute Python 3 packages, especially ones that
c7f726
have dependencies on other packages.
c7f726
c7f726
This package also contains the runtime components of setuptools, necessary to
c7f726
execute the software that requires pkg_resources.
c7f726
c7f726
%if %{without bootstrap}
c7f726
%package -n     %{python_wheel_pkg_prefix}-%{srcname}-wheel
c7f726
Summary:        The setuptools wheel
c7f726
%{bundled}
c7f726
c7f726
%description -n %{python_wheel_pkg_prefix}-%{srcname}-wheel
c7f726
A Python wheel of setuptools to use with venv.
c7f726
%endif
c7f726
c7f726
c7f726
%prep
c7f726
%autosetup -p1 -n %{srcname}-%{version}
c7f726
%if %{without bootstrap}
c7f726
# If we don't have setuptools installed yet, we use the pre-generated .egg-info
c7f726
# See https://github.com/pypa/setuptools/pull/2543
c7f726
# And https://github.com/pypa/setuptools/issues/2550
c7f726
# WARNING: We cannot remove this folder since Python 3.11.1,
c7f726
#          see https://github.com/pypa/setuptools/issues/3761
c7f726
#rm -r %%{srcname}.egg-info
c7f726
%endif
c7f726
c7f726
# Strip shbang
c7f726
find setuptools pkg_resources -name \*.py | xargs sed -i -e '1 {/^#!\//d}'
c7f726
# Remove bundled exes
c7f726
rm -f setuptools/*.exe
c7f726
# Don't ship these
c7f726
rm -r docs/conf.py
c7f726
c7f726
c7f726
%build
c7f726
%if %{without bootstrap}
c7f726
%py3_build_wheel
c7f726
%else
c7f726
%py3_build
c7f726
%endif
c7f726
c7f726
c7f726
%install
c7f726
%if %{without bootstrap}
c7f726
%py3_install_wheel %{python_wheel_name}
c7f726
%else
c7f726
%py3_install
c7f726
%endif
c7f726
c7f726
# https://github.com/pypa/setuptools/issues/2709
c7f726
rm -rf %{buildroot}%{python3_sitelib}/pkg_resources/tests/
c7f726
c7f726
%if %{without bootstrap}
c7f726
sed -i '/^setuptools\/tests\//d' %{buildroot}%{python3_record}
c7f726
%endif
c7f726
c7f726
find %{buildroot}%{python3_sitelib} -name '*.exe' | xargs rm -f
c7f726
c7f726
%if %{without bootstrap}
c7f726
mkdir -p %{buildroot}%{python_wheel_dir}
c7f726
install -p dist/%{python_wheel_name} -t %{buildroot}%{python_wheel_dir}
c7f726
%endif
c7f726
c7f726
%check
c7f726
c7f726
# Regression tests
c7f726
c7f726
#%%if 0%{?rhel} >= 9
c7f726
# The test cannot run on RHEL8 due to the test script missing from RPM.
c7f726
# Verify bundled provides are up to date
c7f726
# Disable the test for now as it requires python3-setuptools which is not included in the
c7f726
# minimal set of packages.
c7f726
#cat pkg_resources/_vendor/vendored.txt setuptools/_vendor/vendored.txt > allvendor.txt
c7f726
#%%{_rpmconfigdir}/pythonbundles.py allvendor.txt --namespace 'python%{python3_pkgversion}dist' --compare-with '%%{bundled}'
c7f726
#%%endif
c7f726
c7f726
%if %{without bootstrap}
c7f726
# Regression test, the wheel should not be larger than 900 kB
c7f726
# https://bugzilla.redhat.com/show_bug.cgi?id=1914481#c3
c7f726
test $(stat --format %%s dist/%{python_wheel_name}) -lt 900000
c7f726
%endif
c7f726
c7f726
# Regression test, the tests are not supposed to be installed
c7f726
test ! -d %{buildroot}%{python3_sitelib}/pkg_resources/tests
c7f726
test ! -d %{buildroot}%{python3_sitelib}/setuptools/tests
c7f726
c7f726
# https://github.com/pypa/setuptools/discussions/2607
c7f726
rm pyproject.toml
c7f726
c7f726
# Upstream test suite
c7f726
c7f726
%if %{with tests}
c7f726
# Upstream tests
c7f726
# --ignore=setuptools/tests/test_integration.py
c7f726
# --ignore=setuptools/tests/integration/
c7f726
# --ignore=setuptools/tests/config/test_apply_pyprojecttoml.py
c7f726
# -k "not test_pip_upgrade_from_source"
c7f726
#   the tests require internet connection
c7f726
# --ignore=setuptools/tests/test_editable_install.py
c7f726
#   the tests require pip-run which we don't have in Fedora
c7f726
PRE_BUILT_SETUPTOOLS_WHEEL=dist/%{python_wheel_name} \
c7f726
PYTHONPATH=$(pwd) %pytest \
c7f726
 --ignore=setuptools/tests/test_integration.py \
c7f726
 --ignore=setuptools/tests/integration/ \
c7f726
 --ignore=setuptools/tests/test_editable_install.py \
c7f726
 --ignore=setuptools/tests/config/test_apply_pyprojecttoml.py \
c7f726
 -k "not test_pip_upgrade_from_source"
c7f726
%endif # with tests
c7f726
c7f726
c7f726
%files -n python%{python3_pkgversion}-setuptools
c7f726
%license LICENSE
c7f726
%doc docs/* CHANGES.rst README.rst
c7f726
%{python3_sitelib}/distutils-precedence.pth
c7f726
%{python3_sitelib}/pkg_resources/
c7f726
%{python3_sitelib}/setuptools*/
c7f726
%{python3_sitelib}/_distutils_hack/
c7f726
c7f726
%if %{without bootstrap}
c7f726
%files -n %{python_wheel_pkg_prefix}-%{srcname}-wheel
c7f726
%license LICENSE
c7f726
# we own the dir for simplicity
c7f726
%dir %{python_wheel_dir}/
c7f726
%{python_wheel_dir}/%{python_wheel_name}
c7f726
%endif
c7f726
c7f726
c7f726
%changelog
c7f726
* Mon Jan 30 2023 Charalampos Stratakis <cstratak@redhat.com> - 65.5.1-2
c7f726
- Disable bootstrap
c7f726
c7f726
* Wed Oct 12 2022 Charalampos Stratakis <cstratak@redhat.com> - 65.5.1-1
c7f726
- Initial package
c7f726
- Fedora contributions by:
c7f726
      # Bill Nottingham <notting@fedoraproject.org>
c7f726
      # Charalampos Stratakis <cstratak@redhat.com>
c7f726
      # David Malcolm <dmalcolm@redhat.com>
c7f726
      # Dennis Gilmore <dennis@ausil.us>
c7f726
      # dmalcolm <dmalcolm@fedoraproject.org>
c7f726
      # Haikel Guemar <hguemar@fedoraproject.org>
c7f726
      # Ignacio Vazquez-Abrams <ivazquez@fedoraproject.org>
c7f726
      # Jesse Keating <jkeating@fedoraproject.org>
c7f726
      # Karolina Surma <ksurma@redhat.com>
c7f726
      # Kevin Fenzi <kevin@scrye.com>
c7f726
      # Konstantin Ryabitsev <icon@fedoraproject.org>
c7f726
      # Lumir Balhar <lbalhar@redhat.com>
c7f726
      # Matej Stuchlik <mstuchli@redhat.com>
c7f726
      # Michal Cyprian <mcyprian@redhat.com>
c7f726
      # Miro Hrončok <miro@hroncok.cz>
c7f726
      # Nils Philippsen <nils@redhat.com>
c7f726
      # Orion Poplawski <orion@cora.nwra.com>
c7f726
      # Petr Viktorin <pviktori@redhat.com>
c7f726
      # Pierre-Yves Chibon <pingou@pingoured.fr>
c7f726
      # Ralph Bean <rbean@redhat.com>
c7f726
      # Randy Barlow <randy@electronsweatshop.com>
c7f726
      # Robert Kuska <rkuska@redhat.com>
c7f726
      # Thomas Spura <thomas.spura@gmail.com>
c7f726
      # Tomáš Hrnčiar <thrnciar@redhat.com>
c7f726
      # Tomas Orsava <torsava@redhat.com>
c7f726
      # Tomas Radej <tradej@redhat.com>
c7f726
      # tomspur <tomspur@fedoraproject.org>
c7f726
      # Toshio Kuratomi <toshio@fedoraproject.org>
c7f726
      # Troy Dawson <tdawson@redhat.com>
c7f726
      # Ville Skyttä <scop@fedoraproject.org>