Blame SPECS/python3.11-setuptools.spec

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