more fixes for python-3.12 issue

epel9
Than Ngo 1 year ago
parent 50c0214711
commit f3f21ea6f1

@ -0,0 +1,149 @@
diff -up chromium-115.0.5790.102/base/write_build_date_header.py.me chromium-115.0.5790.102/base/write_build_date_header.py
--- chromium-115.0.5790.102/base/write_build_date_header.py.me 2023-07-22 14:23:42.620679397 +0200
+++ chromium-115.0.5790.102/base/write_build_date_header.py 2023-07-22 15:24:46.833310310 +0200
@@ -17,7 +17,7 @@ def main():
args = argument_parser.parse_args()
date_val = int(args.timestamp)
- date = datetime.datetime.utcfromtimestamp(date_val)
+ date = datetime.datetime.fromtimestamp(date_val, datetime.timezone.utc)
output = ('// Generated by //base/write_build_date_header.py\n'
'#ifndef BASE_GENERATED_BUILD_DATE_TIMESTAMP \n'
f'#define BASE_GENERATED_BUILD_DATE_TIMESTAMP {date_val}'
diff -up chromium-115.0.5790.102/build/write_buildflag_header.py.me chromium-115.0.5790.102/build/write_buildflag_header.py
--- chromium-115.0.5790.102/build/write_buildflag_header.py.me 2023-07-22 14:16:14.196975451 +0200
+++ chromium-115.0.5790.102/build/write_buildflag_header.py 2023-07-22 14:20:24.977239994 +0200
@@ -44,7 +44,7 @@ def GetOptions():
header_guard = cmdline_options.output.upper()
if header_guard[0].isdigit():
header_guard = '_' + header_guard
- header_guard = re.sub('[^\w]', '_', header_guard)
+ header_guard = re.sub(r'[^\w]', '_', header_guard)
header_guard += '_'
# The actual output file is inside the gen dir.
diff -up chromium-115.0.5790.102/components/resources/protobufs/binary_proto_generator.py.me chromium-115.0.5790.102/components/resources/protobufs/binary_proto_generator.py
--- chromium-115.0.5790.102/components/resources/protobufs/binary_proto_generator.py.me 2023-07-22 14:47:34.230764210 +0200
+++ chromium-115.0.5790.102/components/resources/protobufs/binary_proto_generator.py 2023-07-22 15:11:50.360983383 +0200
@@ -9,7 +9,8 @@
"""
from __future__ import print_function
import abc
-import imp
+import types
+import importlib
import optparse
import os
import re
@@ -40,6 +41,12 @@ class GoogleProtobufModuleImporter:
return filepath
return None
+ def load_source(name: str, path: str) -> types.ModuleType:
+ spec = importlib.util.spec_from_file_location(name, path)
+ module = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(module)
+ return module
+
def _module_exists(self, fullname):
return self._fullname_to_filepath(fullname) is not None
@@ -68,7 +75,7 @@ class GoogleProtobufModuleImporter:
raise ImportError(fullname)
filepath = self._fullname_to_filepath(fullname)
- return imp.load_source(fullname, filepath)
+ return load_source(fullname, filepath)
class BinaryProtoGenerator:
diff -up chromium-115.0.5790.102/mojo/public/tools/bindings/concatenate_and_replace_closure_exports.py.me chromium-115.0.5790.102/mojo/public/tools/bindings/concatenate_and_replace_closure_exports.py
--- chromium-115.0.5790.102/mojo/public/tools/bindings/concatenate_and_replace_closure_exports.py.me 2023-07-22 15:17:19.114258801 +0200
+++ chromium-115.0.5790.102/mojo/public/tools/bindings/concatenate_and_replace_closure_exports.py 2023-07-22 15:17:43.368200491 +0200
@@ -32,7 +32,7 @@ def FilterLine(filename, line, output):
return
if line.startswith("goog.provide"):
- match = re.match("goog.provide\('([^']+)'\);", line)
+ match = re.match(r"goog.provide\('([^']+)'\);", line)
if not match:
print("Invalid goog.provide line in %s:\n%s" % (filename, line))
sys.exit(1)
diff -up chromium-115.0.5790.102/mojo/public/tools/mojom/mojom/parse/lexer.py.me chromium-115.0.5790.102/mojo/public/tools/mojom/mojom/parse/lexer.py
--- chromium-115.0.5790.102/mojo/public/tools/mojom/mojom/parse/lexer.py.me 2023-07-22 14:10:40.372979365 +0200
+++ chromium-115.0.5790.102/mojo/public/tools/mojom/mojom/parse/lexer.py 2023-07-22 14:13:31.200453442 +0200
@@ -2,7 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import imp
import os.path
import sys
diff -up chromium-115.0.5790.102/third_party/catapult/common/py_vulcanize/py_vulcanize/html_generation_controller.py.me chromium-115.0.5790.102/third_party/catapult/common/py_vulcanize/py_vulcanize/html_generation_controller.py
--- chromium-115.0.5790.102/third_party/catapult/common/py_vulcanize/py_vulcanize/html_generation_controller.py.me 2023-07-22 15:12:41.850895179 +0200
+++ chromium-115.0.5790.102/third_party/catapult/common/py_vulcanize/py_vulcanize/html_generation_controller.py 2023-07-22 15:12:55.844871207 +0200
@@ -18,7 +18,7 @@ class HTMLGenerationController(object):
def GetHTMLForInlineStylesheet(self, contents):
if self.current_module is None:
- if re.search('url\(.+\)', contents):
+ if re.search(r'url\(.+\)', contents):
raise Exception(
'Default HTMLGenerationController cannot handle inline style urls')
return contents
diff -up chromium-115.0.5790.102/third_party/catapult/common/py_vulcanize/py_vulcanize/js_utils.py.me chromium-115.0.5790.102/third_party/catapult/common/py_vulcanize/py_vulcanize/js_utils.py
--- chromium-115.0.5790.102/third_party/catapult/common/py_vulcanize/py_vulcanize/js_utils.py.me 2023-07-22 15:14:06.923717910 +0200
+++ chromium-115.0.5790.102/third_party/catapult/common/py_vulcanize/py_vulcanize/js_utils.py 2023-07-22 15:18:03.704150614 +0200
@@ -4,4 +4,4 @@
def EscapeJSIfNeeded(js):
- return js.replace('</script>', '<\/script>')
+ return js.replace(r'</script>', r'<\/script>')
diff -up chromium-115.0.5790.102/third_party/catapult/common/py_vulcanize/py_vulcanize/parse_html_deps.py.me chromium-115.0.5790.102/third_party/catapult/common/py_vulcanize/py_vulcanize/parse_html_deps.py
--- chromium-115.0.5790.102/third_party/catapult/common/py_vulcanize/py_vulcanize/parse_html_deps.py.me 2023-07-22 15:14:30.105662532 +0200
+++ chromium-115.0.5790.102/third_party/catapult/common/py_vulcanize/py_vulcanize/parse_html_deps.py 2023-07-22 15:14:57.977595950 +0200
@@ -293,6 +293,6 @@ class HTMLModuleParser():
html = ''
else:
if html.find('< /script>') != -1:
- raise Exception('Escape script tags with <\/script>')
+ raise Exception(r'Escape script tags with <\/script>')
return HTMLModuleParserResults(html)
diff -up chromium-115.0.5790.102/third_party/catapult/common/py_vulcanize/py_vulcanize/style_sheet.py.me chromium-115.0.5790.102/third_party/catapult/common/py_vulcanize/py_vulcanize/style_sheet.py
--- chromium-115.0.5790.102/third_party/catapult/common/py_vulcanize/py_vulcanize/style_sheet.py.me 2023-07-22 15:13:12.316842990 +0200
+++ chromium-115.0.5790.102/third_party/catapult/common/py_vulcanize/py_vulcanize/style_sheet.py 2023-07-22 15:13:49.684759091 +0200
@@ -60,7 +60,7 @@ class ParsedStyleSheet(object):
return 'url(data:image/%s;base64,%s)' % (ext[1:], data.decode('utf-8'))
# I'm assuming we only have url()'s associated with images
- return re.sub('url\((?P<quote>"|\'|)(?P<url>[^"\'()]*)(?P=quote)\)',
+ return re.sub(r'url\((?P<quote>"|\'|)(?P<url>[^"\'()]*)(?P=quote)\)',
InlineUrl, self.contents)
def AppendDirectlyDependentFilenamesTo(self, dependent_filenames):
@@ -72,7 +72,7 @@ class ParsedStyleSheet(object):
raise Exception('@imports are not supported')
matches = re.findall(
- 'url\((?:["|\']?)([^"\'()]*)(?:["|\']?)\)',
+ r'url\((?:["|\']?)([^"\'()]*)(?:["|\']?)\)',
self.contents)
def resolve_url(url):
diff -up chromium-115.0.5790.102/third_party/dawn/generator/generator_lib.py.me chromium-115.0.5790.102/third_party/dawn/generator/generator_lib.py
--- chromium-115.0.5790.102/third_party/dawn/generator/generator_lib.py.me 2023-07-22 15:11:56.826972306 +0200
+++ chromium-115.0.5790.102/third_party/dawn/generator/generator_lib.py 2023-07-22 15:12:37.550902545 +0200
@@ -119,8 +119,8 @@ class _PreprocessingLoader(jinja2.BaseLo
source = self.preprocess(f.read())
return source, path, lambda: mtime == os.path.getmtime(path)
- blockstart = re.compile('{%-?\s*(if|elif|else|for|block|macro)[^}]*%}')
- blockend = re.compile('{%-?\s*(end(if|for|block|macro)|elif|else)[^}]*%}')
+ blockstart = re.compile(r'{%-?\s*(if|elif|else|for|block|macro)[^}]*%}')
+ blockend = re.compile(r'{%-?\s*(end(if|for|block|macro)|elif|else)[^}]*%}')
def preprocess(self, source):
lines = source.split('\n')

@ -1,22 +0,0 @@
diff -up chromium-115.0.5790.102/mojo/public/tools/mojom/mojom/fileutil.py.me chromium-115.0.5790.102/mojo/public/tools/mojom/mojom/fileutil.py
--- chromium-115.0.5790.102/mojo/public/tools/mojom/mojom/fileutil.py.me 2023-07-22 13:48:01.726074705 +0200
+++ chromium-115.0.5790.102/mojo/public/tools/mojom/mojom/fileutil.py 2023-07-22 13:50:50.886575507 +0200
@@ -3,7 +3,6 @@
# found in the LICENSE file.
import errno
-import imp
import os.path
import sys
diff -up chromium-115.0.5790.102/mojo/public/tools/mojom/mojom/parse/lexer.py.me chromium-115.0.5790.102/mojo/public/tools/mojom/mojom/parse/lexer.py
--- chromium-115.0.5790.102/mojo/public/tools/mojom/mojom/parse/lexer.py.me 2023-07-22 14:10:40.372979365 +0200
+++ chromium-115.0.5790.102/mojo/public/tools/mojom/mojom/parse/lexer.py 2023-07-22 14:13:31.200453442 +0200
@@ -2,7 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import imp
import os.path
import sys

@ -387,8 +387,9 @@ Patch310: chromium-115-wayland-load_default_cursor_theme.patch
# clang warnings
Patch311: chromium-115-clang-warnings.patch
# imp module is removed in python-3.12
Patch312: chromium-115-python-imp-deprecated.patch
Patch312: chromium-115-python-3.12-deprecated.patch
# Qt issue
Patch321: chromium-114-qt-handle_scale_factor_changes.patch
@ -1005,7 +1006,7 @@ udev.
%patch -P309 -p1 -b .include_contains_h_header_for_V4L2StatefulVideoDecoder
%patch -P310 -p1 -b .wayland_load_default_cursor_theme
%patch -P311 -p1 -b .clang-warnings
%patch -P312 -p1 -b .python-imp-deprecated
%patch -P312 -p1 -b .python-3.12-deprecated
%patch -P321 -p1 -b .handle_scale_factor_changes
%patch -P322 -p1 -b .fix_font_double_scaling

Loading…
Cancel
Save