Signed-off-by: Martin Jansa <[email protected]>
---
 .../nodejs/python-3.11-invalid-mode-rU.patch  | 46 +++++++++++++++++++
 .../nodejs/nodejs_12.22.12.bb                 |  1 +
 2 files changed, 47 insertions(+)
 create mode 100644 
meta-oe/recipes-devtools/nodejs/nodejs/python-3.11-invalid-mode-rU.patch

diff --git 
a/meta-oe/recipes-devtools/nodejs/nodejs/python-3.11-invalid-mode-rU.patch 
b/meta-oe/recipes-devtools/nodejs/nodejs/python-3.11-invalid-mode-rU.patch
new file mode 100644
index 0000000000..588ffc1eee
--- /dev/null
+++ b/meta-oe/recipes-devtools/nodejs/nodejs/python-3.11-invalid-mode-rU.patch
@@ -0,0 +1,46 @@
+From e4d6f2e4091a4c7b6f3281be0e281b32ee6e5a33 Mon Sep 17 00:00:00 2001
+From: Christian Clauss <[email protected]>
+Date: Thu, 26 Nov 2020 12:39:11 +0100
+Subject: [PATCH] Fix ValueError: invalid mode: 'rU' while trying to load
+ binding.gyp
+
+Fixes nodejs/node-gyp#2219
+File mode `U` is deprecated in Python 3 
https://docs.python.org/3/library/functions.html#open
+https://github.com/asottile/pyupgrade#redundant-open-modes
+
+Upstream-Status: Backport 
[https://github.com/nodejs/gyp-next/commit/3f8cb33ea4d191df41f4fb7a1dfbd302507f7260]
+Signed-off-by: Martin Jansa <[email protected]>
+---
+ deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py | 2 +-
+ tools/gyp/pylib/gyp/input.py                          | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py 
b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py
+index d174280..2f34bc0 100644
+--- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py
++++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py
+@@ -226,7 +226,7 @@ def LoadOneBuildFile(build_file_path, data, aux_data, 
includes,
+     # Open the build file for read ('r') with universal-newlines mode ('U')
+     # to make sure platform specific newlines ('\r\n' or '\r') are converted 
to '\n'
+     # which otherwise will fail eval()
+-    if sys.platform == 'zos':
++    if PY3 or sys.platform == 'zos':
+       # On z/OS, universal-newlines mode treats the file as an ascii file. 
But since
+       # node-gyp produces ebcdic files, do not use that mode.
+       build_file_contents = open(build_file_path, 'r').read()
+diff --git a/tools/gyp/pylib/gyp/input.py b/tools/gyp/pylib/gyp/input.py
+index 1f40abb..fd12e78 100644
+--- a/tools/gyp/pylib/gyp/input.py
++++ b/tools/gyp/pylib/gyp/input.py
+@@ -226,7 +226,7 @@ def LoadOneBuildFile(build_file_path, data, aux_data, 
includes,
+     # Open the build file for read ('r') with universal-newlines mode ('U')
+     # to make sure platform specific newlines ('\r\n' or '\r') are converted 
to '\n'
+     # which otherwise will fail eval()
+-    if sys.platform == 'zos':
++    if PY3 or sys.platform == 'zos':
+       # On z/OS, universal-newlines mode treats the file as an ascii file. 
But since
+       # node-gyp produces ebcdic files, do not use that mode.
+       build_file_contents = open(build_file_path, 'r').read()
+-- 
+2.38.1
+
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_12.22.12.bb 
b/meta-oe/recipes-devtools/nodejs/nodejs_12.22.12.bb
index 3ededae562..c1d66eeffb 100644
--- a/meta-oe/recipes-devtools/nodejs/nodejs_12.22.12.bb
+++ b/meta-oe/recipes-devtools/nodejs/nodejs_12.22.12.bb
@@ -26,6 +26,7 @@ SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \
            file://CVE-2022-35255.patch \
            file://CVE-2022-43548.patch \
            file://CVE-llhttp.patch \
+           file://python-3.11-invalid-mode-rU.patch \
            "
 SRC_URI_append_class-target = " \
            file://0002-Using-native-binaries.patch \
-- 
2.40.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#102641): 
https://lists.openembedded.org/g/openembedded-devel/message/102641
Mute This Topic: https://lists.openembedded.org/mt/98943293/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to