From ae6ae35b5666ad22da528cd01aff7c680276eca5 Mon Sep 17 00:00:00 2001 From: Andreas Wacknitz <A.Wacknitz@gmx.de> Date: Fri, 05 Apr 2024 17:27:21 +0200 Subject: [PATCH] clang-18: update to 18.1.3 --- tools/python-requires | 25 ++++++++++--------------- 1 files changed, 10 insertions(+), 15 deletions(-) diff --git a/tools/python-requires b/tools/python-requires index 741d9c4..eb027b7 100755 --- a/tools/python-requires +++ b/tools/python-requires @@ -15,9 +15,11 @@ # # -# Print requirements for a package (first argument). -# Evaluated and normalized. -# If the package specified is - evaluate and normalize stdin. +# Usage: +# python-requires PACKAGE [EXTRA] +# +# Print requirements for PACKAGE. Evaluated and normalized. +# If PACKAGE is - evaluate and normalize stdin. # With optional EXTRA argument passed print requirements for such extra only. # @@ -25,11 +27,9 @@ import re try: - try: - from importlib.metadata import requires - except ImportError: - from importlib_metadata import requires + from importlib.metadata import requires from packaging.requirements import Requirement + import subprocess except: exit() @@ -37,13 +37,6 @@ exit() e = {'extra': sys.argv[2]} if len(sys.argv) > 2 else None -# packaging up to 21.3 raises UndefinedEnvironmentName when extra is not -# defined in environment, but marker contains it. This should change in new -# packaging once released. See https://github.com/pypa/packaging/pull/550. To -# workaround this (so we do not need to handle exceptions) we pass empty extra -# in environment when we do not want any extra. -noe = {'extra': ''} - reqs = requires(sys.argv[1]) if sys.argv[1] != "-" else sys.stdin.readlines() try: @@ -53,7 +46,9 @@ except: continue m = r.marker - if (not m and not e) or m and ((not e and m.evaluate(noe)) or (e and not m.evaluate(noe) and m.evaluate(e))): + if (not m and not e) or (m and m.evaluate(e) and (not e or not m.evaluate())): print(re.sub(r"[-_.]+", "-", r.name).lower()) + for extra in r.extras: + subprocess.run([sys.argv[0], r.name, extra]) except: pass -- Gitblit v1.9.3