diff --git a/allow-only-direct-compilation.patch b/allow-only-direct-compilation.patch new file mode 100644 index 0000000..39b5abc --- /dev/null +++ b/allow-only-direct-compilation.patch @@ -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 ----------------------------------------------- diff --git a/python-setuptools.changes b/python-setuptools.changes index 11fb5f1..a55899a 100644 --- a/python-setuptools.changes +++ b/python-setuptools.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Dec 22 04:10:44 UTC 2023 - Steve Kowalik + +- Add patch allow-only-direct-compilation.patch: + * Allow forcing direct compilation. + ------------------------------------------------------------------- Mon Dec 18 08:01:21 UTC 2023 - Dirk Müller diff --git a/python-setuptools.spec b/python-setuptools.spec index e5eacaf..e2fdf0f 100644 --- a/python-setuptools.spec +++ b/python-setuptools.spec @@ -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