-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
webruntime: fix build with python3-3.11
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
- Loading branch information
1 parent
7464a36
commit 77dae39
Showing
3 changed files
with
193 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
...ipes-webos/chromium/files/0039-grit-Remove-usage-of-U-mode-bit-for-opening-files-in.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
From afd9897073cd8f8c43a8e5ae42ad07666f80b943 Mon Sep 17 00:00:00 2001 | ||
From: Martin Jansa <Martin.Jansa@gmail.com> | ||
Date: Thu, 3 Nov 2022 10:19:27 +0000 | ||
Subject: [PATCH] grit: Remove usage of 'U' mode bit for opening files in | ||
python | ||
|
||
The 'U' mode bit is removed in python 3.11. It has been | ||
deprecated for a long time. The 'U' mode bit has no effect | ||
so this change doesn't change any behavior. | ||
|
||
See https://docs.python.org/3.11/whatsnew/3.11.html#changes-in-the-python-api | ||
|
||
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
--- | ||
src/tools/grit/grit/util.py | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/src/tools/grit/grit/util.py b/src/tools/grit/grit/util.py | ||
index 98433d154c..98e770b853 100644 | ||
--- a/src/tools/grit/grit/util.py | ||
+++ b/src/tools/grit/grit/util.py | ||
@@ -209,7 +209,7 @@ def ReadFile(filename, encoding): | ||
mode = 'rb' | ||
encoding = None | ||
else: | ||
- mode = 'rU' | ||
+ mode = 'r' | ||
|
||
with io.open(filename, mode, encoding=encoding) as f: | ||
return f.read() |
161 changes: 161 additions & 0 deletions
161
meta-luneos/recipes-webos/chromium/files/0040-metrics-ukm-fix-build-with-python3.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
From ec1994612cb88ab475060acb927bda31dde684be Mon Sep 17 00:00:00 2001 | ||
From: Martin Jansa <Martin.Jansa@gmail.com> | ||
Date: Thu, 3 Nov 2022 10:17:36 +0000 | ||
Subject: [PATCH] metrics/ukm: fix build with python3 | ||
|
||
* fixes: | ||
FAILED: gen/services/metrics/public/cpp/ukm_builders.cc gen/services/metrics/public/cpp/ukm_builders.h gen/services/metrics/public/cpp/ukm_decode.cc gen/services/metrics/public/cpp/ukm_decode.h | ||
/OE/build/luneos-mickledore/webos-ports/tmp-glibc/work/core2-64-webos-linux/webruntime/91-r52.4/recipe-sysroot-native/usr/bin/python3-native/python3 ../../git/src/tools/metrics/ukm/gen_builders.py --input ../../git/src/tools/metrics/ukm/ukm.xml --output gen/services/metrics/public/cpp | ||
Traceback (most recent call last): | ||
File "/OE/build/luneos-mickledore/webos-ports/tmp-glibc/work/core2-64-webos-linux/webruntime/91-r52.4/build/Release/../../git/src/tools/metrics/ukm/gen_builders.py", line 59, in <module> | ||
sys.exit(main(sys.argv)) | ||
^^^^^^^^^^^^^^ | ||
File "/OE/build/luneos-mickledore/webos-ports/tmp-glibc/work/core2-64-webos-linux/webruntime/91-r52.4/build/Release/../../git/src/tools/metrics/ukm/gen_builders.py", line 27, in main | ||
data = ReadFilteredData(args.input) | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
File "/OE/build/luneos-mickledore/webos-ports/tmp-glibc/work/core2-64-webos-linux/webruntime/91-r52.4/build/Release/../../git/src/tools/metrics/ukm/gen_builders.py", line 48, in ReadFilteredData | ||
data = ukm_model.UKM_XML_TYPE.Parse(ukm_file.read()) | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
File "/OE/build/luneos-mickledore/webos-ports/tmp-glibc/work/core2-64-webos-linux/webruntime/91-r52.4/git/src/tools/metrics/ukm/../common/models.py", line 458, in Parse | ||
return self._ParseMinidom(input_file) | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
File "/OE/build/luneos-mickledore/webos-ports/tmp-glibc/work/core2-64-webos-linux/webruntime/91-r52.4/git/src/tools/metrics/ukm/../common/models.py", line 437, in _ParseMinidom | ||
return self.root_type.Unmarshall(root) | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
File "/OE/build/luneos-mickledore/webos-ports/tmp-glibc/work/core2-64-webos-linux/webruntime/91-r52.4/git/src/tools/metrics/ukm/../common/models.py", line 336, in Unmarshall | ||
obj[child.attr] = [ | ||
^ | ||
File "/OE/build/luneos-mickledore/webos-ports/tmp-glibc/work/core2-64-webos-linux/webruntime/91-r52.4/git/src/tools/metrics/ukm/../common/models.py", line 337, in <listcomp> | ||
child.node_type.Unmarshall(n) for n in nodes] | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
File "/OE/build/luneos-mickledore/webos-ports/tmp-glibc/work/core2-64-webos-linux/webruntime/91-r52.4/git/src/tools/metrics/ukm/../common/models.py", line 315, in Unmarshall | ||
if not re.match(attr_re, attr_val): | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
File "/OE/build/luneos-mickledore/webos-ports/tmp-glibc/work/core2-64-webos-linux/webruntime/91-r52.4/recipe-sysroot-native/usr/lib/python3.11/re/__init__.py", line 166, in match | ||
return _compile(pattern, flags).match(string) | ||
^^^^^^^^^^^^^^^^^^^^^^^^ | ||
File "/OE/build/luneos-mickledore/webos-ports/tmp-glibc/work/core2-64-webos-linux/webruntime/91-r52.4/recipe-sysroot-native/usr/lib/python3.11/re/__init__.py", line 294, in _compile | ||
p = _compiler.compile(pattern, flags) | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
File "/OE/build/luneos-mickledore/webos-ports/tmp-glibc/work/core2-64-webos-linux/webruntime/91-r52.4/recipe-sysroot-native/usr/lib/python3.11/re/_compiler.py", line 743, in compile | ||
p = _parser.parse(p, flags) | ||
^^^^^^^^^^^^^^^^^^^^^^^ | ||
File "/OE/build/luneos-mickledore/webos-ports/tmp-glibc/work/core2-64-webos-linux/webruntime/91-r52.4/recipe-sysroot-native/usr/lib/python3.11/re/_parser.py", line 980, in parse | ||
p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0) | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
File "/OE/build/luneos-mickledore/webos-ports/tmp-glibc/work/core2-64-webos-linux/webruntime/91-r52.4/recipe-sysroot-native/usr/lib/python3.11/re/_parser.py", line 455, in _parse_sub | ||
itemsappend(_parse(source, state, verbose, nested + 1, | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
File "/OE/build/luneos-mickledore/webos-ports/tmp-glibc/work/core2-64-webos-linux/webruntime/91-r52.4/recipe-sysroot-native/usr/lib/python3.11/re/_parser.py", line 841, in _parse | ||
raise source.error('global flags not at the start ' | ||
re.error: global flags not at the start of the expression at position 1 | ||
|
||
* the important part is | ||
- ('export', str, r'^(?i)(|true|false)$'), | ||
+ ('export', str, r'(?i)^(|true|false)$'), | ||
and | ||
- ('singular', str, r'^(?i)(|true|false)$'), | ||
+ ('singular', str, r'(?i)^(|true|false)$'), | ||
from | ||
https://chromium.googlesource.com/chromium/src/+/f90f49df8db04dcb72f7ce0c4d0b2fe329bab00c%5E%21/#F2 | ||
|
||
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
--- | ||
src/tools/metrics/ukm/gen_builders_test.py | 4 +- | ||
src/tools/metrics/ukm/ukm_model.py | 56 +++++++++++++--------- | ||
2 files changed, 35 insertions(+), 25 deletions(-) | ||
|
||
diff --git a/src/tools/metrics/ukm/gen_builders_test.py b/src/tools/metrics/ukm/gen_builders_test.py | ||
index 8c37676fa9..767fd21f1e 100755 | ||
--- a/src/tools/metrics/ukm/gen_builders_test.py | ||
+++ b/src/tools/metrics/ukm/gen_builders_test.py | ||
@@ -25,8 +25,8 @@ class GenBuildersTest(unittest.TestCase): | ||
|
||
def testGenerateCode(self): | ||
relpath = '.' | ||
- data = ukm_model.UKM_XML_TYPE.Parse( | ||
- open('../../tools/metrics/ukm/ukm.xml').read()) | ||
+ with open('../../tools/metrics/ukm/ukm.xml') as f: | ||
+ data = ukm_model.UKM_XML_TYPE.Parse(f.read()) | ||
event = data[ukm_model._EVENT_TYPE.tag][0] | ||
metric = event[ukm_model._METRIC_TYPE.tag][0] | ||
self.assertIsNotNone(event) | ||
diff --git a/src/tools/metrics/ukm/ukm_model.py b/src/tools/metrics/ukm/ukm_model.py | ||
index ec24dd5736..b36899db18 100644 | ||
--- a/src/tools/metrics/ukm/ukm_model.py | ||
+++ b/src/tools/metrics/ukm/ukm_model.py | ||
@@ -39,15 +39,16 @@ _INDEX_TYPE = models.ObjectNodeType( | ||
], | ||
single_line=True) | ||
|
||
-_STATISTICS_TYPE = models.ObjectNodeType( | ||
+_STATISTICS_TYPE = models.ObjectNodeType( | ||
'statistics', | ||
attributes=[ | ||
- ('export', str, r'^(?i)(|true|false)$'), | ||
+ ('export', str, r'(?i)^(|true|false)$'), | ||
], | ||
children=[ | ||
models.ChildType(_QUANTILES_TYPE.tag, _QUANTILES_TYPE, multiple=False), | ||
- models.ChildType( | ||
- _ENUMERATION_TYPE.tag, _ENUMERATION_TYPE, multiple=False), | ||
+ models.ChildType(_ENUMERATION_TYPE.tag, | ||
+ _ENUMERATION_TYPE, | ||
+ multiple=False), | ||
]) | ||
|
||
_HISTORY_TYPE = models.ObjectNodeType( | ||
@@ -90,25 +91,34 @@ _METRIC_TYPE = models.ObjectNodeType( | ||
_AGGREGATION_TYPE.tag, _AGGREGATION_TYPE, multiple=True), | ||
]) | ||
|
||
-_EVENT_TYPE = models.ObjectNodeType( | ||
- 'event', | ||
- attributes=[ | ||
- ('name', str, r'^[A-Za-z0-9.]+$'), | ||
- ('singular', str, r'^(?i)(|true|false)$'), | ||
- ], | ||
- alphabetization=[ | ||
- (_OBSOLETE_TYPE.tag, _KEEP_ORDER), | ||
- (_OWNER_TYPE.tag, _KEEP_ORDER), | ||
- (_SUMMARY_TYPE.tag, _KEEP_ORDER), | ||
- (_METRIC_TYPE.tag, _LOWERCASE_FN('name')), | ||
- ], | ||
- extra_newlines=(1, 1, 1), | ||
- children=[ | ||
- models.ChildType(_OBSOLETE_TYPE.tag, _OBSOLETE_TYPE, multiple=False), | ||
- models.ChildType(_OWNER_TYPE.tag, _OWNER_TYPE, multiple=True), | ||
- models.ChildType(_SUMMARY_TYPE.tag, _SUMMARY_TYPE, multiple=False), | ||
- models.ChildType(_METRIC_TYPE.tag, _METRIC_TYPE, multiple=True), | ||
- ]) | ||
+_EVENT_TYPE = models.ObjectNodeType('event', | ||
+ attributes=[ | ||
+ ('name', str, r'^[A-Za-z0-9.]+$'), | ||
+ ('singular', str, | ||
+ r'(?i)^(|true|false)$'), | ||
+ ], | ||
+ alphabetization=[ | ||
+ (_OBSOLETE_TYPE.tag, _KEEP_ORDER), | ||
+ (_OWNER_TYPE.tag, _KEEP_ORDER), | ||
+ (_SUMMARY_TYPE.tag, _KEEP_ORDER), | ||
+ (_METRIC_TYPE.tag, | ||
+ _LOWERCASE_FN('name')), | ||
+ ], | ||
+ extra_newlines=(1, 1, 1), | ||
+ children=[ | ||
+ models.ChildType(_OBSOLETE_TYPE.tag, | ||
+ _OBSOLETE_TYPE, | ||
+ multiple=False), | ||
+ models.ChildType(_OWNER_TYPE.tag, | ||
+ _OWNER_TYPE, | ||
+ multiple=True), | ||
+ models.ChildType(_SUMMARY_TYPE.tag, | ||
+ _SUMMARY_TYPE, | ||
+ multiple=False), | ||
+ models.ChildType(_METRIC_TYPE.tag, | ||
+ _METRIC_TYPE, | ||
+ multiple=True), | ||
+ ]) | ||
|
||
_UKM_CONFIGURATION_TYPE = models.ObjectNodeType( | ||
'ukm-configuration', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters