Python 3.12 fixes

This commit is contained in:
František Zatloukal 2023-07-11 20:47:25 +02:00
parent 21e0192027
commit 72d6ad552c
3 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,28 @@
From 588c3558c2cf338b45eaed34e23275bfbd517ff6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Franti=C5=A1ek=20Zatloukal?= <fzatlouk@redhat.com>
Date: Tue, 11 Jul 2023 20:28:11 +0200
Subject: [PATCH] Hacky workaround for expected string or bytes-like object,
got '_Py2Int'
---
python/mozbuild/mozbuild/shellutil.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/python/mozbuild/mozbuild/shellutil.py b/python/mozbuild/mozbuild/shellutil.py
index c47b19f..4fe6c3a 100644
--- a/python/mozbuild/mozbuild/shellutil.py
+++ b/python/mozbuild/mozbuild/shellutil.py
@@ -186,6 +186,10 @@ def _quote(s):
if type(s) == int:
return "%d" % s
+ if type(s) != str:
+ # looseversion objects leak here, this is ugly, I know, but gets the job done, so...
+ return str(s.__int__())
+
# Empty strings need to be quoted to have any significance
if s and not SHELL_QUOTE_RE.search(s) and not s.startswith("~"):
return s
--
2.41.0

View File

@ -0,0 +1,25 @@
From 045b6698cd3da54d949ff228d601a6506ccf92bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Franti=C5=A1ek=20Zatloukal?= <fzatlouk@redhat.com>
Date: Tue, 11 Jul 2023 18:35:00 +0200
Subject: [PATCH] Replace distutils.LooseVersion with looseversion.LooseVersion
---
python/mozbuild/mozbuild/configure/util.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/python/mozbuild/mozbuild/configure/util.py b/python/mozbuild/mozbuild/configure/util.py
index 06ac247..e2ce7d5 100644
--- a/python/mozbuild/mozbuild/configure/util.py
+++ b/python/mozbuild/mozbuild/configure/util.py
@@ -14,7 +14,7 @@ import six
import sys
from collections import deque
from contextlib import contextmanager
-from distutils.version import LooseVersion
+from looseversion import LooseVersion
def getpreferredencoding():
--
2.41.0

View File

@ -49,6 +49,10 @@ Patch15: remove-sloppy-m4-detection-from-bundled-autoconf.patch
# https://bugzilla.mozilla.org/show_bug.cgi?id=1474486 # https://bugzilla.mozilla.org/show_bug.cgi?id=1474486
Patch16: firefox-112.0-commasplit.patch Patch16: firefox-112.0-commasplit.patch
Patch17: Replace-distutils.LooseVersion-with-looseversion.LooseVersion.patch
# This is ugly, I know, I know...
Patch18: Hacky-workaround-for-expected-string-or-bytes-like-object.patch
# TODO: Check with mozilla for cause of these fails and re-enable spidermonkey compile time checks if needed # TODO: Check with mozilla for cause of these fails and re-enable spidermonkey compile time checks if needed
Patch20: spidermonkey_checks_disable.patch Patch20: spidermonkey_checks_disable.patch
@ -76,6 +80,7 @@ BuildRequires: pkgconfig(libffi)
BuildRequires: pkgconfig(zlib) BuildRequires: pkgconfig(zlib)
BuildRequires: python3-devel BuildRequires: python3-devel
BuildRequires: python3-setuptools BuildRequires: python3-setuptools
BuildRequires: python3-looseversion
BuildRequires: python3-six BuildRequires: python3-six
BuildRequires: readline-devel BuildRequires: readline-devel
BuildRequires: wget BuildRequires: wget
@ -100,6 +105,17 @@ developing applications that use %{name}.
pushd ../.. pushd ../..
%autopatch -p1 %autopatch -p1
# Purge the bundled six library incompatible with Python 3.12
rm third_party/python/six/six.py
# Link the system six library (build tooling expects that)
ln -s /usr/lib/python%{python3_version}/site-packages/six.py third_party/python/six/six.py
# Set up looseversion
mkdir third_party/python/looseversion
ln -s /usr/lib/python%{python3_version}/site-packages/looseversion/__init__.py third_party/python/looseversion/looseversion.py
echo "vendored:third_party/python/looseversion" >> python/sites/mach.txt
# Copy out the LICENSE file # Copy out the LICENSE file
cp LICENSE js/src/ cp LICENSE js/src/