Blame SPECS/python3.11-setuptools.spec

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