- Add patch allow-only-direct-compilation.patch:

* Allow forcing direct compilation.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-setuptools?expand=0&rev=257
This commit is contained in:
Steve Kowalik 2023-12-22 04:11:50 +00:00 committed by Git OBS Bridge
parent 1af2c78f78
commit 32e544bfcd
3 changed files with 42 additions and 2 deletions

View File

@ -0,0 +1,33 @@
Index: setuptools-69.0.2/setuptools/_distutils/command/install_lib.py
===================================================================
--- setuptools-69.0.2.orig/setuptools/_distutils/command/install_lib.py
+++ setuptools-69.0.2/setuptools/_distutils/command/install_lib.py
@@ -133,6 +133,12 @@ class install_lib(Command):
# should at least generate usable bytecode in RPM distributions.
install_root = self.get_finalized_command('install').root
+ # UGLY HACK WARNING. Indirect compilation requires distutils, which
+ # means Python 3.11 or less. If and only if an environment variable
+ # is set, do we force direct compilation.
+ # See also https://github.com/pypa/setuptools/issues/4164
+ direct = os.environ.get('SETUPTOOLS_FORCE_DIRECT', None)
+
if self.compile:
byte_compile(
files,
@@ -140,6 +146,7 @@ class install_lib(Command):
force=self.force,
prefix=install_root,
dry_run=self.dry_run,
+ direct=direct,
)
if self.optimize > 0:
byte_compile(
@@ -149,6 +156,7 @@ class install_lib(Command):
prefix=install_root,
verbose=self.verbose,
dry_run=self.dry_run,
+ direct=direct,
)
# -- Utility methods -----------------------------------------------

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Dec 22 04:10:44 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch allow-only-direct-compilation.patch:
* Allow forcing direct compilation.
-------------------------------------------------------------------
Mon Dec 18 08:01:21 UTC 2023 - Dirk Müller <dmueller@suse.com>

View File

@ -47,6 +47,8 @@ Source: https://files.pythonhosted.org/packages/source/s/setuptools/setu
Patch0: sort-for-reproducibility.patch
# PATCH-FIX-OPENSUSE fix-get-python-lib-python38.patch bsc#1204395
Patch2: fix-get-python-lib-python38.patch
# PATCH-FIX-OPENSUSE Allow forcing direct compilation, see gh#pypa/setuptools#4164
Patch3: allow-only-direct-compilation.patch
BuildRequires: %{python_module base >= 3.7}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
@ -103,8 +105,7 @@ rm -f setuptools/*.exe
%install
%if !%{with test} && !%{with wheel}
# workaround python 3.12 distutils import
export PYTHONDONTWRITEBYTECODE=1
export SETUPTOOLS_FORCE_DIRECT=True
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%endif