Import from Fedora python-setuptools @ 19d0ab5

Resolves: RHEL-17771
This commit is contained in:
Tomáš Hrnčiar 2023-10-02 10:13:57 +02:00
parent d202b125bf
commit 49d302b898
9 changed files with 1378 additions and 0 deletions

6
.gitignore vendored
View File

@ -0,0 +1,6 @@
/setuptools-*.tar.gz
/setuptools-*.zip
/setuptools-*/
/pkg_resources-tests-data-*.tar.gz
/results_python-setuptools/
*.rpm

30
4094.patch Normal file
View File

@ -0,0 +1,30 @@
From 29f052da470ac281f15d87d4a40511b5cd1e4834 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Thu, 26 Oct 2023 14:55:12 +0200
Subject: [PATCH] Fix setuptools.depends:get_module_constant() on Python
3.13.0a1
Don't hardcode opcode numbers, look them up instead.
Fixes https://github.com/pypa/setuptools/issues/4090
---
setuptools/depends.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/setuptools/depends.py b/setuptools/depends.py
index 180e820459..42907d9bd4 100644
--- a/setuptools/depends.py
+++ b/setuptools/depends.py
@@ -142,9 +142,9 @@ def extract_constant(code, symbol, default=-1):
name_idx = list(code.co_names).index(symbol)
- STORE_NAME = 90
- STORE_GLOBAL = 97
- LOAD_CONST = 100
+ STORE_NAME = dis.opmap['STORE_NAME']
+ STORE_GLOBAL = dis.opmap['STORE_GLOBAL']
+ LOAD_CONST = dis.opmap['LOAD_CONST']
const = default

View File

@ -0,0 +1,41 @@
From 58f33f0aef5b137287e6f425b922a03123735a77 Mon Sep 17 00:00:00 2001
From: Lumir Balhar <lbalhar@redhat.com>
Date: Wed, 20 Sep 2023 17:18:47 +0200
Subject: [PATCH] Adjust the setup.py install deprecation message and URL
But only when building RPM packages.
---
setuptools/command/install.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/setuptools/command/install.py b/setuptools/command/install.py
index 606cce9..0af1631 100644
--- a/setuptools/command/install.py
+++ b/setuptools/command/install.py
@@ -1,6 +1,7 @@
from distutils.errors import DistutilsArgError
import inspect
import glob
+import os
import platform
import distutils.command.install as orig
@@ -40,8 +41,13 @@ class install(orig.install):
Please avoid running ``setup.py`` directly.
Instead, use pypa/build, pypa/installer or other
standards-based tools.
- """,
- see_url="https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html",
+ """
+ + ("""
+ Follow the current Python packaging guidelines when building
+ Python RPM packages.
+ """ if "RPM_BUILD_ROOT" in os.environ else ""),
+ see_url=("https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html" +
+ ("\nand https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/" if "RPM_BUILD_ROOT" in os.environ else "")),
# TODO: Document how to bootstrap setuptools without install
# (e.g. by unziping the wheel file)
# and then add a due_date to this warning.
--
2.41.0

View File

@ -0,0 +1,48 @@
From 850efbc4dfe5b8c64dd21617bc856ba0d4e3a082 Mon Sep 17 00:00:00 2001
From: Lumir Balhar <lbalhar@redhat.com>
Date: Wed, 20 Sep 2023 19:47:05 +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 c7aaf14..33b9cd7 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -42,17 +42,7 @@ exclude =
[options.extras_require]
testing =
pytest >= 6
- pytest-checkdocs >= 2.4
- pytest-black >= 0.3.7; \
- python_implementation != "PyPy"
- pytest-cov; \
- python_implementation != "PyPy"
- pytest-mypy >= 0.9.1; \
- python_implementation != "PyPy"
- pytest-enabler >= 2.2
- pytest-ruff; sys_platform != "cygwin"
- flake8-2020
virtualenv>=13.0.0
wheel
pip>=19.1 # For proper file:// URLs support.
@@ -60,13 +50,9 @@ testing =
pytest-xdist
jaraco.path>=3.2.0
build[virtualenv]
- filelock>=3.4.0
ini2toml[lite]>=0.9
tomli-w>=1.0.0
pytest-timeout
- pytest-perf; \
- sys_platform != "cygwin"
- jaraco.develop >= 7.21; python_version >= "3.9" and sys_platform != "cygwin"
testing-integration =
pytest
pytest-xdist
--
2.41.0

View File

@ -0,0 +1,30 @@
From 95546a2302152676192d5a4880b1e5d09d2f854f Mon Sep 17 00:00:00 2001
From: Lumir Balhar <lbalhar@redhat.com>
Date: Fri, 22 Sep 2023 00:11:50 +0200
Subject: [PATCH] Remove warning from pkg_resources
---
pkg_resources/__init__.py | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index 3baa1f3..31f81a4 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -115,12 +115,7 @@ _namespace_handlers = None
_namespace_packages = None
-warnings.warn(
- "pkg_resources is deprecated as an API. "
- "See https://setuptools.pypa.io/en/latest/pkg_resources.html",
- DeprecationWarning,
- stacklevel=2,
-)
+
_PEP440_FALLBACK = re.compile(r"^v?(?P<safe>(?:[0-9]+!)?[0-9]+(?:\.[0-9]+)*)", re.I)
--
2.41.0

View File

@ -0,0 +1,14 @@
# let's not report duplicate __init__s
addFilter(r'W: files-duplicate .+__init__\.py ')
# setuptools and pkg_resources have duplicated vendored libraries
# we might want to de-duplicate this somehow in the future, but not yet
# regex a bit complex to allow arbitrary order
addFilter(r'W: files-duplicate .+/(setuptools/_vendor/.+ .+/pkg_resources|pkg_resources/_vendor/.+ .+/setuptools)/_vendor/')
# When duplicate files are found, this errors is produced
# as long as we filter out the warnings, we need to filter the error as well
addFilter(r'E: files-duplicated-waste')
# no %doc in the wheel packages
addFilter(r'python-setuptools-wheel.noarch: (E|W): no-documentation')

1130
python-setuptools.spec Normal file

File diff suppressed because it is too large Load Diff

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (setuptools-68.2.2.tar.gz) = ed3138a39e8ae47d695e71835024d66d63b8de51aa336bd8524de81a5036aa26cf587caca5d6b46c833f77a6e9c8c1ae6b64e8310f712bd9c4e760196778b2ca

78
tests/tests.yml Normal file
View File

@ -0,0 +1,78 @@
---
- hosts: localhost
roles:
- role: standard-test-basic
tags:
- classic
repositories:
- repo: "https://src.fedoraproject.org/tests/python.git"
dest: "python"
- repo: "https://src.fedoraproject.org/rpms/pyproject-rpm-macros.git"
dest: "pyproject-rpm-macros"
tests:
- smoke35_optional:
dir: python/smoke
run: VERSION=3.5 INSTALL_OR_SKIP=true ./venv.sh
- smoke36:
dir: python/smoke
run: VERSION=3.6 ./venv.sh
- smoke38:
dir: python/smoke
run: VERSION=3.8 ./venv.sh
- smoke39:
dir: python/smoke
run: VERSION=3.9 ./venv.sh
- smoke310:
dir: python/smoke
run: VERSION=3.10 ./venv.sh
- smoke311:
dir: python/smoke
run: VERSION=3.11 ./venv.sh
- smoke312:
dir: python/smoke
run: VERSION=3.12 ./venv.sh
- smoke27:
dir: python/smoke
run: VERSION=2.7 METHOD=virtualenv ./venv.sh
- smoke35_virtualenv_optional:
dir: python/smoke
run: VERSION=3.5 METHOD=virtualenv INSTALL_OR_SKIP=true ./venv.sh
- smoke36_virtualenv:
dir: python/smoke
run: VERSION=3.6 METHOD=virtualenv ./venv.sh
- smoke38_virtualenv:
dir: python/smoke
run: VERSION=3.8 METHOD=virtualenv ./venv.sh
- smoke39_virtualenv:
dir: python/smoke
run: VERSION=3.9 METHOD=virtualenv ./venv.sh
- smoke310_virtualenv:
dir: python/smoke
run: VERSION=3.10 METHOD=virtualenv ./venv.sh
- smoke311_virtualenv:
dir: python/smoke
run: VERSION=3.11 METHOD=virtualenv ./venv.sh
- smoke312_virtualenv:
dir: python/smoke
run: VERSION=3.12 METHOD=virtualenv ./venv.sh
- pyproject_pytest:
dir: pyproject-rpm-macros/tests
run: ./mocktest.sh python-pytest
- pyproject_pluggy:
dir: pyproject-rpm-macros/tests
run: ./mocktest.sh python-pluggy
required_packages:
- gcc
- virtualenv
- python2.7
- python3.6
- python3.8
- python3.9
- python3.10-devel
- python3.11-devel
- python3.12-devel
- python3-devel
- python3-tox
- mock
- rpmdevtools
- rpm-build