Patrick Williams | 169d7bc | 2024-01-05 11:33:25 -0600 | [diff] [blame^] | 1 | From bf8c96ba6936050ed4a0de5bc8aeeaf2b3c50dc1 Mon Sep 17 00:00:00 2001 |
| 2 | From: Alexander Kanavin <alex@linutronix.de> |
| 3 | Date: Thu, 7 Dec 2023 12:54:30 +0100 |
| 4 | Subject: [PATCH] gyp: resolve python 3.12 issues |
| 5 | |
| 6 | Upstream has updated gyp wholesale in the main branch, so |
| 7 | this patch can be dropped in due time. |
| 8 | |
| 9 | Upstream-Status: Inappropriate [issue will be fixed upstream with the next nodejs LTS update] |
| 10 | |
| 11 | Signed-off-by: Alexander Kanavin <alex@linutronix.de> |
| 12 | --- |
| 13 | deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py | 4 ++-- |
| 14 | tools/gyp/pylib/gyp/input.py | 4 ++-- |
| 15 | 2 files changed, 4 insertions(+), 4 deletions(-) |
| 16 | |
| 17 | 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 |
| 18 | index d9699a0a..173e9465 100644 |
| 19 | --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py |
| 20 | +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py |
| 21 | @@ -16,7 +16,7 @@ import subprocess |
| 22 | import sys |
| 23 | import threading |
| 24 | import traceback |
| 25 | -from distutils.version import StrictVersion |
| 26 | +from packaging.version import Version |
| 27 | from gyp.common import GypError |
| 28 | from gyp.common import OrderedSet |
| 29 | |
| 30 | @@ -1183,7 +1183,7 @@ def EvalSingleCondition(cond_expr, true_dict, false_dict, phase, variables, buil |
| 31 | else: |
| 32 | ast_code = compile(cond_expr_expanded, "<string>", "eval") |
| 33 | cached_conditions_asts[cond_expr_expanded] = ast_code |
| 34 | - env = {"__builtins__": {}, "v": StrictVersion} |
| 35 | + env = {"__builtins__": {}, "v": Version} |
| 36 | if eval(ast_code, env, variables): |
| 37 | return true_dict |
| 38 | return false_dict |
| 39 | diff --git a/tools/gyp/pylib/gyp/input.py b/tools/gyp/pylib/gyp/input.py |
| 40 | index 354958bf..ab6112e5 100644 |
| 41 | --- a/tools/gyp/pylib/gyp/input.py |
| 42 | +++ b/tools/gyp/pylib/gyp/input.py |
| 43 | @@ -16,7 +16,7 @@ import subprocess |
| 44 | import sys |
| 45 | import threading |
| 46 | import traceback |
| 47 | -from distutils.version import StrictVersion |
| 48 | +from packaging.version import Version |
| 49 | from gyp.common import GypError |
| 50 | from gyp.common import OrderedSet |
| 51 | |
| 52 | @@ -1190,7 +1190,7 @@ def EvalSingleCondition(cond_expr, true_dict, false_dict, phase, variables, buil |
| 53 | else: |
| 54 | ast_code = compile(cond_expr_expanded, "<string>", "eval") |
| 55 | cached_conditions_asts[cond_expr_expanded] = ast_code |
| 56 | - env = {"__builtins__": {}, "v": StrictVersion} |
| 57 | + env = {"__builtins__": {}, "v": Version} |
| 58 | if eval(ast_code, env, variables): |
| 59 | return true_dict |
| 60 | return false_dict |
| 61 | -- |
| 62 | 2.39.2 |
| 63 | |