Blame SPECS/python3.11-setuptools.spec

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