From f434ab2916f6ca35b4388912a2a64655726fcd0393824ccd1fc58a8a554bf852 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 15 Jul 2022 11:00:25 +0000 Subject: [PATCH] Accepting request 989214 from home:bnavigator:branches:devel:languages:python - Setuptools itself does not depend on packaging anymore, only for pythondistdeps.py, That dependency will move to python-rpm-packaging soon. -- boo#1178257 - Use "setuptools" for building again. * Python 3.12 will drop the distutils fallback * Use the python-base vendored pip in a venv * Drop no-legacyversion-warning.patch - Remove nonsensical python362 flavor check. OBS-URL: https://build.opensuse.org/request/show/989214 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-packaging?expand=0&rev=59 --- no-legacyversion-warning.patch | 34 -------------------- python-packaging.changes | 12 +++++++ python-packaging.spec | 59 ++++++++++++++++------------------ 3 files changed, 40 insertions(+), 65 deletions(-) delete mode 100644 no-legacyversion-warning.patch diff --git a/no-legacyversion-warning.patch b/no-legacyversion-warning.patch deleted file mode 100644 index 709c384..0000000 --- a/no-legacyversion-warning.patch +++ /dev/null @@ -1,34 +0,0 @@ -Index: packaging-21.2/packaging/specifiers.py -=================================================================== ---- packaging-21.2.orig/packaging/specifiers.py -+++ packaging-21.2/packaging/specifiers.py -@@ -270,12 +270,6 @@ class LegacySpecifier(_IndividualSpecifi - def __init__(self, spec: str = "", prereleases: Optional[bool] = None) -> None: - super().__init__(spec, prereleases) - -- warnings.warn( -- "Creating a LegacyVersion has been deprecated and will be " -- "removed in the next major release", -- DeprecationWarning, -- ) -- - def _coerce_version(self, version: UnparsedVersion) -> LegacyVersion: - if not isinstance(version, LegacyVersion): - version = LegacyVersion(str(version)) -Index: packaging-21.2/packaging/version.py -=================================================================== ---- packaging-21.2.orig/packaging/version.py -+++ packaging-21.2/packaging/version.py -@@ -108,12 +108,6 @@ class LegacyVersion(_BaseVersion): - self._version = str(version) - self._key = _legacy_cmpkey(self._version) - -- warnings.warn( -- "Creating a LegacyVersion has been deprecated and will be " -- "removed in the next major release", -- DeprecationWarning, -- ) -- - def __str__(self) -> str: - return self._version - diff --git a/python-packaging.changes b/python-packaging.changes index 6219fbc..3726171 100644 --- a/python-packaging.changes +++ b/python-packaging.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Thu Jul 14 13:13:54 UTC 2022 - Ben Greiner + +- Setuptools itself does not depend on packaging anymore, only for + pythondistdeps.py, That dependency will move to + python-rpm-packaging soon. -- boo#1178257 +- Use "setuptools" for building again. + * Python 3.12 will drop the distutils fallback + * Use the python-base vendored pip in a venv + * Drop no-legacyversion-warning.patch +- Remove nonsensical python362 flavor check. + ------------------------------------------------------------------- Sun May 29 09:22:42 UTC 2022 - John Paul Adrian Glaubitz diff --git a/python-packaging.spec b/python-packaging.spec index 08b66b2..951da53 100644 --- a/python-packaging.spec +++ b/python-packaging.spec @@ -16,7 +16,7 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} +%{?!python_module:%define python_module() python3-%{**}} %global flavor @BUILD_FLAVOR@%{nil} %if "%{flavor}" == "test" %define psuffix -test @@ -27,35 +27,31 @@ %endif # in order to avoid rewriting for subpackage generator %define mypython python -%global skip_python2 1 +%define skip_python2 1 Name: python-packaging%{psuffix} Version: 21.3 Release: 0 Summary: Core utilities for Python packages -License: Apache-2.0 +License: Apache-2.0 AND BSD-2-Clause URL: https://github.com/pypa/packaging Source: https://files.pythonhosted.org/packages/source/p/packaging/packaging-%{version}.tar.gz -# Restore compatibility with 20.4 for setuptools -Patch1: no-legacyversion-warning.patch # Fix testsuite on big-endian systems # see: https://github.com/pypa/packaging/pull/538 Patch2: fix-big-endian-build.patch -BuildRequires: %{python_module devel} +BuildRequires: %{python_module base} BuildRequires: fdupes BuildRequires: python-rpm-macros #!BuildIgnore: post-build-checks-malwarescan +# ! Do not add setuptools build dependency here, so that we can get this into Ring0 ! +# ! Also make sure all runtime dependencies don't require setuptools. ! Requires: python-pyparsing >= 2.0.2 BuildArch: noarch -# do not add setuptools dependency, this is now a dependency -# of setuptools. Ensure that all dependencies also don't depend -# on setuptools -# (at the moment, six and pyparsing are ok) %if %{with test} BuildRequires: %{python_module pretend} BuildRequires: %{python_module pyparsing >= 2.0.2} BuildRequires: %{python_module pytest} %endif -# work around boo#1186870 +# See boo#1186870, we can't provide ourselves to pythondistdeps.py Provides: %{mypython}%{python_version}dist(packaging) = %{version}-%{release} %if "%{python_flavor}" == "python3" || "%{python_provides}" == "python3" Provides: %{mypython}3dist(packaging) = %{version}-%{release} @@ -67,37 +63,38 @@ Core utilities for Python packages %prep %autosetup -p1 -n packaging-%{version} -# sdist must provide a packaging.egg-info, used below in install phase -test -d packaging.egg-info +%if !%{with test} %build -%python_build - -%if %{with test} -%check -%if "%{python_flavor}" >= "python362" -# no-legacyversion-warning.patch causes these to fail -%pytest -k "not (test_legacy_specifier_is_deprecated or test_legacy_version_is_deprecated)" +%{python_expand # build using pythonXX-base bundled setuptools +$python -m venv venv-%{$python_bin_suffix} +venv-%{$python_bin_suffix}/bin/python setup.py build +} %endif -%endif # %%{with_test} %if !%{with test} %install -%python_install -# Replace distutils generated egg-info, which varies in metadata version and -# structure (single file vs directory) based on distutils, with the egg-info -# which is provided in the sdist and uses same metadata version as setuptools. -%{python_expand rm -r %{buildroot}%{$python_sitelib}/*.egg-info -cp -r packaging.egg-info %{buildroot}%{$python_sitelib}/packaging-%{version}-py%{$python_version}.egg-info +%{python_expand # install using pythonXX-base bundled setuptools. +# This will work until deprecated support of setup.py install is removed from the bundled setuptools. +# Hopefully upstream packaging comes up with a better bootstrapping process by then. +# (https://github.com/pypa/packaging/pull/536, https://github.com/pypa/packaging/pull/546) +venv-%{$python_bin_suffix}/bin/python setup.py install \ + -O1 --skip-build --force --root %{buildroot} --prefix %{_prefix} +%fdupes %{buildroot}%{$python_sitelib} } -%python_expand %fdupes %{buildroot}%{$python_sitelib} +%endif +%if %{with test} +%check +%pytest +%endif + +%if !%{with test} %files %{python_files} %license LICENSE LICENSE.APACHE LICENSE.BSD %doc CHANGELOG.rst README.rst %{python_sitelib}/packaging -%{python_sitelib}/packaging-%{version}-py*.egg-info/ - -%endif # !%%{with_test} +%{python_sitelib}/packaging-%{version}*-info +%endif %changelog