From 627f21630f447edf99e81e69ca8f52b185011595 Mon Sep 17 00:00:00 2001 From: Shuo Wang Date: Wed, 30 Aug 2023 15:46:32 +0800 Subject: [PATCH 1/2] update to 65.5.1 Signed-off-by: Shuo Wang --- 62.3.2-remove-mock-in-tests.patch | 147 ------------------ Remove-optional-or-unpackaged-test-deps.patch | 45 ++++++ python-setuptools.spec | 142 +++++++++++------ sources | 2 +- 4 files changed, 142 insertions(+), 194 deletions(-) delete mode 100644 62.3.2-remove-mock-in-tests.patch create mode 100644 Remove-optional-or-unpackaged-test-deps.patch diff --git a/62.3.2-remove-mock-in-tests.patch b/62.3.2-remove-mock-in-tests.patch deleted file mode 100644 index c3977da..0000000 --- a/62.3.2-remove-mock-in-tests.patch +++ /dev/null @@ -1,147 +0,0 @@ -diff --git a/pkg_resources/tests/__init__.py b/pkg_resources/tests/__init__.py -index e69de29b..7eb5146e 100644 ---- a/pkg_resources/tests/__init__.py -+++ b/pkg_resources/tests/__init__.py -@@ -0,0 +1,5 @@ -+try: -+ import mock -+except ImportError: -+ from unittest import mock -+ -diff --git a/pkg_resources/tests/test_markers.py b/pkg_resources/tests/test_markers.py -index 15a3b499..5d8449f5 100644 ---- a/pkg_resources/tests/test_markers.py -+++ b/pkg_resources/tests/test_markers.py -@@ -1,4 +1,4 @@ --import mock -+from . import mock - - from pkg_resources import evaluate_marker - -diff --git a/pkg_resources/tests/test_pkg_resources.py b/pkg_resources/tests/test_pkg_resources.py -index 6518820e..d428a676 100644 ---- a/pkg_resources/tests/test_pkg_resources.py -+++ b/pkg_resources/tests/test_pkg_resources.py -@@ -9,10 +9,7 @@ import stat - import distutils.dist - import distutils.command.install_egg_info - --try: -- from unittest import mock --except ImportError: -- import mock -+from . import mock - - from pkg_resources import ( - DistInfoDistribution, Distribution, EggInfoDistribution, -diff --git a/setuptools/tests/__init__.py b/setuptools/tests/__init__.py -index 564adf2b..18708a49 100644 ---- a/setuptools/tests/__init__.py -+++ b/setuptools/tests/__init__.py -@@ -5,6 +5,11 @@ import pytest - - __all__ = ['fail_on_ascii'] - -+try: -+ import mock -+except ImportError: -+ from unittest import mock -+ - - is_ascii = locale.getpreferredencoding() == 'ANSI_X3.4-1968' - fail_on_ascii = pytest.mark.xfail(is_ascii, reason="Test fails in this locale") -diff --git a/setuptools/tests/test_bdist_deprecations.py b/setuptools/tests/test_bdist_deprecations.py -index 1a900c67..eea19790 100644 ---- a/setuptools/tests/test_bdist_deprecations.py -+++ b/setuptools/tests/test_bdist_deprecations.py -@@ -1,6 +1,6 @@ - """develop tests - """ --import mock -+from . import mock - import sys - - import pytest -diff --git a/setuptools/tests/test_build_clib.py b/setuptools/tests/test_build_clib.py -index 48bea2b4..f9acac8d 100644 ---- a/setuptools/tests/test_build_clib.py -+++ b/setuptools/tests/test_build_clib.py -@@ -1,6 +1,6 @@ - import pytest - --import mock -+from . import mock - from distutils.errors import DistutilsSetupError - from setuptools.command.build_clib import build_clib - from setuptools.dist import Distribution -diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py -index 726f9fda..58967e43 100644 ---- a/setuptools/tests/test_easy_install.py -+++ b/setuptools/tests/test_easy_install.py -@@ -12,7 +12,7 @@ import itertools - import distutils.errors - import io - import zipfile --import mock -+from . import mock - import time - import re - import subprocess -diff --git a/setuptools/tests/test_msvc.py b/setuptools/tests/test_msvc.py -index d1527bfa..9919276a 100644 ---- a/setuptools/tests/test_msvc.py -+++ b/setuptools/tests/test_msvc.py -@@ -5,7 +5,7 @@ Tests for msvc support module. - import os - import contextlib - import distutils.errors --import mock -+from . import mock - - import pytest - -diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py -index 8e9435ef..933246c5 100644 ---- a/setuptools/tests/test_packageindex.py -+++ b/setuptools/tests/test_packageindex.py -@@ -6,7 +6,7 @@ import urllib.request - import urllib.error - import http.client - --import mock -+from . import mock - import pytest - - import setuptools.package_index -diff --git a/setuptools/tests/test_register.py b/setuptools/tests/test_register.py -index 98605806..d916ce4f 100644 ---- a/setuptools/tests/test_register.py -+++ b/setuptools/tests/test_register.py -@@ -2,10 +2,7 @@ from setuptools.command.register import register - from setuptools.dist import Distribution - from setuptools.errors import RemovedCommandError - --try: -- from unittest import mock --except ImportError: -- import mock -+from . import mock - - import pytest - -diff --git a/setuptools/tests/test_upload.py b/setuptools/tests/test_upload.py -index 7586cb26..0095c4da 100644 ---- a/setuptools/tests/test_upload.py -+++ b/setuptools/tests/test_upload.py -@@ -2,10 +2,7 @@ from setuptools.command.upload import upload - from setuptools.dist import Distribution - from setuptools.errors import RemovedCommandError - --try: -- from unittest import mock --except ImportError: -- import mock -+from . import mock - - import pytest - diff --git a/Remove-optional-or-unpackaged-test-deps.patch b/Remove-optional-or-unpackaged-test-deps.patch new file mode 100644 index 0000000..247a193 --- /dev/null +++ b/Remove-optional-or-unpackaged-test-deps.patch @@ -0,0 +1,45 @@ +From 87a18ba242ac7f02d41b877ffc796dde42e6a93e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= +Date: Wed, 10 Aug 2022 16:08:41 +0200 +Subject: [PATCH] Remove optional or unpackaged test deps + +--- + setup.cfg | 14 -------------- + 1 file changed, 14 deletions(-) + +diff --git a/setup.cfg b/setup.cfg +index b4ee876..094f621 100644 +--- a/setup.cfg ++++ b/setup.cfg +@@ -39,19 +39,7 @@ exclude = + [options.extras_require] + testing = + pytest >= 6 +- pytest-checkdocs >= 2.4 +- pytest-flake8 +- flake8 < 5 +- pytest-black >= 0.3.7; \ +- python_implementation != "PyPy" +- pytest-cov; \ +- python_implementation != "PyPy" +- pytest-mypy >= 0.9.1; \ +- python_implementation != "PyPy" +- pytest-enabler >= 1.3 +- pytest-perf + +- flake8-2020 + virtualenv>=13.0.0 + wheel + pip>=19.1 # For proper file:// URLs support. +@@ -59,8 +47,6 @@ testing = + pytest-xdist + jaraco.path>=3.2.0 + build[virtualenv] +- filelock>=3.4.0 +- pip_run>=8.8 + ini2toml[lite]>=0.9 + tomli-w>=1.0.0 + pytest-timeout +-- +2.37.3 + diff --git a/python-setuptools.spec b/python-setuptools.spec index d8fb2b6..b6a926f 100644 --- a/python-setuptools.spec +++ b/python-setuptools.spec @@ -1,18 +1,30 @@ +%global srcname setuptools +%global python_wheel_name %{srcname}-%{version}-py3-none-any.whl + +%bcond_with bootstrap +%bcond_with tests + Summary: Easily download, build, install, upgrade, and uninstall Python packages Name: python-setuptools -Version: 62.3.2 -Release: 5%{?dist} +Version: 65.5.1 +Release: 1%{?dist} License: MIT and (BSD or ASL 2.0) URL: https://github.com/pypa/setuptools -Source0: %{url}/archive/v%{version}/v%{version}.tar.gz -# remove mock in tests, helped by https://build.opensuse.org/package/view_file/openSUSE:Factory/python-setuptools/remove_mock.patch -Patch5000: 62.3.2-remove-mock-in-tests.patch +Source0: %{pypi_source %{srcname} %{version}} + +Patch3000: Remove-optional-or-unpackaged-test-deps.patch # skip some test cases, please look at comments in patch file in detail Patch5001: 62.3.2-skip-unsopported-test-cases.patch -BuildRequires: python3-devel, python3-setuptools, python3-pip, python3-rpm-generators, pyproject-rpm-macros -# only needed for tests -BuildRequires: gcc, python3-pytest, python3-path, python3-jaraco-envs, python3-jaraco-path, python3-wheel, python3-pytest-xdist, python3-pytest-forked, python3-pytest-fixture-config, python3-pytest-virtualenv, python3-tomli +BuildRequires: python%{python3_pkgversion}-devel + +%if %{with tests} +BuildRequires: gcc +%endif + +%if %{without bootstrap} +BuildRequires: pyproject-rpm-macros python%{python3_pkgversion}-setuptools python3-rpm-generators +%endif BuildArch: noarch @@ -27,87 +39,125 @@ execute the software that requires pkg_resources. # cat pkg_resources/_vendor/vendored.txt setuptools/_vendor/vendored.txt > allvendor.txt # %%{_rpmconfigdir}/pythonbundles.py allvendor.txt --namespace 'python3dist' %global bundled %{expand: -Provides: bundled(python3dist(appdirs)) = 1.4.3 -Provides: bundled(python3dist(importlib-metadata)) = 4.11.1 -Provides: bundled(python3dist(importlib-resources)) = 5.4 -Provides: bundled(python3dist(jaraco-text)) = 3.7 -Provides: bundled(python3dist(more-itertools)) = 8.8 -Provides: bundled(python3dist(nspektr)) = 0.3 -Provides: bundled(python3dist(ordered-set)) = 3.1.1 -Provides: bundled(python3dist(packaging)) = 21.3 -Provides: bundled(python3dist(pyparsing)) = 3.0.8 -Provides: bundled(python3dist(tomli)) = 2.0.1 -Provides: bundled(python3dist(typing-extensions)) = 4.0.1 -Provides: bundled(python3dist(zipp)) = 3.7 +Provides: bundled(python%{python3_pkgversion}dist(appdirs)) = 1.4.3 +Provides: bundled(python%{python3_pkgversion}dist(importlib-metadata)) = 4.11.1 +Provides: bundled(python%{python3_pkgversion}dist(importlib-resources)) = 5.4 +Provides: bundled(python%{python3_pkgversion}dist(jaraco-text)) = 3.7 +Provides: bundled(python%{python3_pkgversion}dist(more-itertools)) = 8.8 +Provides: bundled(python%{python3_pkgversion}dist(ordered-set)) = 3.1.1 +Provides: bundled(python%{python3_pkgversion}dist(packaging)) = 21.3 +Provides: bundled(python%{python3_pkgversion}dist(pyparsing)) = 3.0.9 +Provides: bundled(python%{python3_pkgversion}dist(typing-extensions)) = 4.0.1 +Provides: bundled(python%{python3_pkgversion}dist(zipp)) = 3.7 +Provides: bundled(python%{python3_pkgversion}dist(tomli)) = 2.0.1 } -%package -n python3-setuptools -Summary: Easily download, build, install, upgrade, and uninstall Python3 packages +%package -n python%{python3_pkgversion}-setuptools +Summary: Easily build and distribute Python 3 packages %{bundled} -Provides: python3dist(setuptools) = %{version} + +%if %{with bootstrap} +Provides: python%{python3_pkgversion}dist(setuptools) = %{version} Provides: python%{python3_version}dist(setuptools) = %{version} -Provides: python3-pkg_resources = %{version}-%{release} +%endif -%description -n python3-setuptools -Setuptools is a fully-featured, actively-maintained, and stable library -designed to facilitate packaging Python projects. +%description -n python%{python3_pkgversion}-setuptools +Setuptools is a collection of enhancements to the Python 3 distutils that allow +you to more easily build and distribute Python 3 packages, especially ones that +have dependencies on other packages. This package also contains the runtime components of setuptools, necessary to execute the software that requires pkg_resources. - -%package -n python-setuptools-wheel +%if %{without bootstrap} +%package -n %{python_wheel_pkg_prefix}-%{srcname}-wheel Summary: The setuptools wheel %{bundled} - -%description -n python-setuptools-wheel -A Python wheel of setuptools to use with venv. +%description -n %{python_wheel_pkg_prefix}-%{srcname}-wheel +A Python wheel of setuptools to use with venv. +%endif %prep -%autosetup -p1 -n setuptools-%{version} +%autosetup -p1 -n %{srcname}-%{version} +find setuptools pkg_resources -name \*.py | xargs sed -i -e '1 {/^#!\//d}' +rm -f setuptools/*.exe +rm -r docs/conf.py +%if %{without bootstrap} +%generate_buildrequires +%pyproject_buildrequires -r %{?with_tests:-x testing} +%endif %build +%if %{with bootstrap} +%py3_build +%else %pyproject_wheel +%endif %install +%if %{with bootstrap} +%py3_install +%else %pyproject_install -mv %{buildroot}%{python3_sitelib}/setuptools-%{version}.*.dist-info/ %{buildroot}%{python3_sitelib}/setuptools-%{version}.dist-info/ +%pyproject_save_files setuptools pkg_resources _distutils_hack +%endif -mkdir -p %{buildroot}%{python_wheel_dir} -install -p %{_pyproject_wheeldir}/setuptools-%{version}*.whl -t %{buildroot}%{python_wheel_dir}/ +rm -rf %{buildroot}%{python3_sitelib}/pkg_resources/tests/ +%if %{without bootstrap} +sed -i '/\/pkg_resources\/tests\b/d' %{pyproject_files} +mkdir -p %{buildroot}%{python_wheel_dir} +install -p %{_pyproject_wheeldir}/%{python_wheel_name} -t %{buildroot}%{python_wheel_dir} +%endif +%if %{with tests} %check -# Verify bundled provides are up to date cat pkg_resources/_vendor/vendored.txt setuptools/_vendor/vendored.txt > allvendor.txt -%{_rpmconfigdir}/pythonbundles.py allvendor.txt --namespace 'python3dist' --compare-with '%{bundled}' -SETUPTOOLS_WHEEL=$(find . -name "setuptools-%{version}*.whl") -PRE_BUILT_SETUPTOOLS_WHEEL=${SETUPTOOLS_WHEEL} PYTHONPATH=$(pwd):${PYTHONPATH} %pytest +%{_rpmconfigdir}/pythonbundles.py allvendor.txt --namespace 'python%{python3_pkgversion}dist' --compare-with '%{bundled}' +test $(stat --format %%s %{_pyproject_wheeldir}/%{python_wheel_name}) -lt 900000 +test ! -d %{buildroot}%{python3_sitelib}/pkg_resources/tests +test ! -d %{buildroot}%{python3_sitelib}/setuptools/tests +rm pyproject.toml -%files -n python3-setuptools +PRE_BUILT_SETUPTOOLS_WHEEL=%{_pyproject_wheeldir}/%{python_wheel_name} \ +PYTHONPATH=$(pwd) %pytest \ + --ignore=setuptools/tests/test_integration.py \ + --ignore=setuptools/tests/integration/ \ + --ignore=setuptools/tests/test_editable_install.py \ + --ignore=setuptools/tests/config/test_apply_pyprojecttoml.py \ + -k "not test_pip_upgrade_from_source" +%endif # with tests + +%files -n python%{python3_pkgversion}-setuptools %{?!with_bootstrap:-f %{pyproject_files}} %license LICENSE %doc docs/* CHANGES.rst README.rst %{python3_sitelib}/distutils-precedence.pth -%{python3_sitelib}/setuptools-%{version}.dist-info/ +%if %{with bootstrap} +%{python3_sitelib}/setuptools-%{version}-py%{python3_version}.egg-info/ %{python3_sitelib}/pkg_resources/ %{python3_sitelib}/setuptools/ %{python3_sitelib}/_distutils_hack/ +%endif -%files -n python-setuptools-wheel +%if %{without bootstrap} +%files -n %{python_wheel_pkg_prefix}-%{srcname}-wheel %license LICENSE -%{python_wheel_dir}/ - - +%dir %{python_wheel_dir}/ +%{python_wheel_dir}/%{python_wheel_name} +%endif %changelog +* Tue Sep 19 2023 Shuo Wang - 65.5.1-1 +- update to 65.5.1 + * Tue Sep 19 2023 OpenCloudOS Release Engineering - 62.3.2-5 - Rebuilt for python 3.11 diff --git a/sources b/sources index 58f9627..609cf24 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (v62.3.2.tar.gz) = b60507ba40f2cb7474f498531d1fa1b5843e3c7f95f84c9acdbbea314507e6438eeabf400fb5911f590dccb8ee5ea92d05d58c3e629fdf66c623833b3cb5ca17 +SHA512 (setuptools-65.5.1.tar.gz) = e75eb7fdb0bc5ffdc76ed864cf753c2672d097a60f8747ac5cd40a49276d33df31fb619877234b4c22693b627d9978ecdd48a5c6c48aa0bbb856d48dec70fb0a -- Gitee From 020548382bbfd5e5bc661b9907f77b3ba76d164a Mon Sep 17 00:00:00 2001 From: Shuo Wang Date: Tue, 19 Sep 2023 20:02:51 +0800 Subject: [PATCH 2/2] Rebuilt for python 3.11 Signed-off-by: Shuo Wang --- python-setuptools.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-setuptools.spec b/python-setuptools.spec index b6a926f..e6d4a0b 100644 --- a/python-setuptools.spec +++ b/python-setuptools.spec @@ -7,7 +7,7 @@ Summary: Easily download, build, install, upgrade, and uninstall Python packages Name: python-setuptools Version: 65.5.1 -Release: 1%{?dist} +Release: 2%{?dist} License: MIT and (BSD or ASL 2.0) URL: https://github.com/pypa/setuptools Source0: %{pypi_source %{srcname} %{version}} @@ -155,6 +155,9 @@ PYTHONPATH=$(pwd) %pytest \ %endif %changelog +* Tue Sep 19 2023 Shuo Wang - 65.5.1-2 +- Rebuilt for python 3.11 + * Tue Sep 19 2023 Shuo Wang - 65.5.1-1 - update to 65.5.1 -- Gitee