From 3b101367abea09165db8f95c52d66fa950e411e0 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Thu, 14 Sep 2023 14:35:14 +0200 Subject: [PATCH] Cherrypick mods from nodejs/gyp-next#201 --- gyp/pylib/gyp/input.py | 4 ++-- gyp/pyproject.toml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gyp/pylib/gyp/input.py b/gyp/pylib/gyp/input.py index d9699a0a50..173e94656b 100644 --- a/gyp/pylib/gyp/input.py +++ b/gyp/pylib/gyp/input.py @@ -16,7 +16,7 @@ import sys import threading import traceback -from distutils.version import StrictVersion +from packaging.version import Version from gyp.common import GypError from gyp.common import OrderedSet @@ -1183,7 +1183,7 @@ def EvalSingleCondition(cond_expr, true_dict, false_dict, phase, variables, buil else: ast_code = compile(cond_expr_expanded, "", "eval") cached_conditions_asts[cond_expr_expanded] = ast_code - env = {"__builtins__": {}, "v": StrictVersion} + env = {"__builtins__": {}, "v": Version} if eval(ast_code, env, variables): return true_dict return false_dict diff --git a/gyp/pyproject.toml b/gyp/pyproject.toml index d8a5451520..e34bd65b55 100644 --- a/gyp/pyproject.toml +++ b/gyp/pyproject.toml @@ -26,6 +26,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", ] +dependencies = ["packaging"] [project.optional-dependencies] dev = ["flake8", "pytest"]