File python310-setuptools.spec of Package python310-setuptools.28822
#
# spec file
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?!python_module:%define python_module() python3-%{**}}
%define pythons python310
# use internally vendored libraries instead of external BRs
%bcond_without vendored
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
%bcond_without test
%bcond_with wheel
%else
%if "%{flavor}" == "wheel"
%define psuffix -wheel
%bcond_without vendored
%bcond_without wheel
%else
%define psuffix %{nil}
%bcond_with test
%bcond_with wheel
%endif
%endif
# in order to avoid rewriting for subpackage generator
%define mypython python
Name: python310-setuptools%{psuffix}
Version: 67.6.1
Release: 0
Summary: Download, build, install, upgrade, and uninstall Python packages
License: Apache-2.0 AND MIT AND BSD-2-Clause AND Python-2.0
URL: https://github.com/pypa/setuptools
Source: https://files.pythonhosted.org/packages/source/s/setuptools/setuptools-%{version}.tar.gz
# PATCH-FIX-OPENSUSE: sort-for-reproducibility.patch
Patch0: sort-for-reproducibility.patch
# PATCH-FIX-OPENSUSE fix-get-python-lib-python38.patch bsc#1204395
Patch2: fix-get-python-lib-python38.patch
BuildRequires: %{python_module base >= 3.7}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires(post): update-alternatives
Requires(postun):update-alternatives
BuildArch: noarch
%if %{with test}
BuildRequires: %{python_module build}
BuildRequires: %{python_module devel}
BuildRequires: %{python_module filelock >= 3.4.0}
BuildRequires: %{python_module ini2toml-lite >= 0.9}
BuildRequires: %{python_module jaraco.envs >= 2.2}
BuildRequires: %{python_module jaraco.path >= 3.2.0}
BuildRequires: %{python_module pip >= 19.1}
BuildRequires: %{python_module pip-run >= 8.8}
BuildRequires: %{python_module pytest >= 6}
BuildRequires: %{python_module pytest-timeout}
BuildRequires: %{python_module pytest-xdist}
BuildRequires: %{python_module setuptools = %{version}}
BuildRequires: %{python_module setuptools-wheel = %{version}}
BuildRequires: %{python_module tomli-w >= 1.0.0}
BuildRequires: %{python_module virtualenv >= 13.0.0}
BuildRequires: %{python_module wheel}
%endif
%if 0%{?suse_version} || 0%{?fedora_version} >= 24
Recommends: ca-certificates-mozilla
%endif
%if %{with wheel}
BuildRequires: %{python_module wheel}
%endif
%if %{without test} && %{without wheel}
# work around boo#1186870
Provides: %{mypython}%{python_version}dist(setuptools) = %{version}
Provides: %{mypython}%{python_version}dist(pkg_resources) = %{version}
%if "%{python_flavor}" == "python3" || "%{python_provides}" == "python3"
Provides: %{mypython}3dist(pkg_resources) = %{version}
Provides: %{mypython}3dist(setuptools) = %{version}
%endif
%endif
%python_subpackages
%description
setuptools is a collection of enhancements to the Python distutils that
allow you to build and distribute Python packages,
especially ones that have dependencies on other packages.
%prep
%autosetup -p1 -n setuptools-%{version}
%if %{without vendored}
# replace the bundled stuff
find ./ -type f -name \*.py -exec sed -i \
-e 's:from setuptools\.extern\.:from :g' \
-e 's:from pkg_resources\.extern\.:from :g' \
-e 's:pkg_resources\.extern\.::g' \
-e 's:setuptools\.extern\.::g' \
{} \;
find ./ -type f -name \*.py -exec sed -i \
-e 's:from setuptools\.extern ::g' \
-e 's:from pkg_resources\.extern ::g' \
{} \;
find ./ -type f -name \*.py -exec sed -i \
-e 's:from .extern ::g' \
{} \;
%endif
%build
%if %{without wheel}
%python_build
%else
%python_exec setup.py bdist_wheel --universal
%endif
%install
%if %{without test} && %{without wheel}
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%endif
%if %{with wheel}
%python_expand install -D -m 0644 -t %{buildroot}%{$python_sitelib}/../wheels dist/*.whl
%endif
%check
%if %{with test}
# the 4 skipped test rely on the bundled packages but they are
# not available on virtualenv; this is expected behaviour
donttest="test_clean_env_install or test_pip_upgrade_from_source or test_test_command_install_requirements or test_no_missing_dependencies"
# these 3 tests try to download the wheel wheel from PyPI
donttest="$donttest or (test_distutils_adoption and (distutils_stdlib or distutils_local))"
export LANG=en_US.UTF-8
# tests need imports local source dir
export PYTHONPATH=$(pwd)
%pytest -rfE -n auto -k "not ($donttest)"
%endif
%if %{without test}
%files %{python_files}
%if %{without wheel}
%license LICENSE
%doc CHANGES.rst README.rst
%{python_sitelib}/setuptools
%{python_sitelib}/setuptools-%{version}*-info
%dir %{python_sitelib}/pkg_resources
%{python_sitelib}/pkg_resources/*
%{python_sitelib}/_distutils_hack
%{python_sitelib}/distutils-precedence.pth
%endif
%if %{with wheel}
%dir %{python_sitelib}/../wheels
%{python_sitelib}/../wheels/*
%endif
%endif
%changelog