From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 9710415803E for ; Tue, 2 Jan 2024 18:03:21 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 95AC62BC05E; Tue, 2 Jan 2024 18:03:20 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6654F2BC03D for ; Tue, 2 Jan 2024 18:03:20 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 24654340813 for ; Tue, 2 Jan 2024 18:03:19 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 64931AC2 for ; Tue, 2 Jan 2024 18:03:17 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1704217615.cf84a6c35151b790ec104892883e85010ca252ac.vapier@gentoo> Subject: [gentoo-commits] proj/pax-utils:master commit in: / X-VCS-Repository: proj/pax-utils X-VCS-Files: lddtree.py X-VCS-Directories: / X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: cf84a6c35151b790ec104892883e85010ca252ac X-VCS-Branch: master Date: Tue, 2 Jan 2024 18:03:17 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: e40b2f4f-8842-4ffc-be59-8db2d0599cef X-Archives-Hash: 41ab050ac777e7c8ec0ce48d7a4e2614 commit: cf84a6c35151b790ec104892883e85010ca252ac Author: Mike Frysinger chromium org> AuthorDate: Tue Jan 2 17:46:55 2024 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Tue Jan 2 17:46:55 2024 +0000 URL: https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=cf84a6c3 lddtree: use older Python typing style Support for list[...] is new to Python 3.9. We still support Python 3.6 (or at least, 3.8) so we need to use List[...] instead. Signed-off-by: Mike Frysinger chromium.org> Signed-off-by: Mike Frysinger gentoo.org> lddtree.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lddtree.py b/lddtree.py index 89733be..247e9db 100755 --- a/lddtree.py +++ b/lddtree.py @@ -49,7 +49,7 @@ import os import re import shutil import sys -from typing import Any, cast, Iterable, Optional, Union +from typing import Any, Dict, Iterable, List, Optional, Tuple, Union, cast assert sys.version_info >= (3, 6), f"Python 3.6+ required, but found {sys.version}" @@ -126,9 +126,9 @@ def readlink(path: str, root: str, prefixed: Optional[bool] = False) -> str: return normpath((root + path) if prefixed else path) -def dedupe(items: list[str]) -> list[str]: +def dedupe(items: List[str]) -> List[str]: """Remove all duplicates from |items| (keeping order)""" - seen: dict[str, str] = {} + seen: Dict[str, str] = {} return [seen.setdefault(x, x) for x in items if x not in seen] @@ -229,7 +229,7 @@ def ParseLdPaths( root: str = "", cwd: Optional[str] = None, path: str = "", -) -> list[str]: +) -> List[str]: """Parse the colon-delimited list of paths and apply ldso rules to each Note the special handling as dictated by the ldso: @@ -276,7 +276,7 @@ def ParseLdSoConf( root: str = "/", debug: bool = False, _first: bool = True, -) -> list[str]: +) -> List[str]: """Load all the paths from a given ldso config file This should handle comments, whitespace, and "include" statements. @@ -334,7 +334,7 @@ def LoadLdpaths( cwd: Optional[str] = None, prefix: str = "", debug: bool = False, -) -> dict[str, list[str]]: +) -> Dict[str, List[str]]: """Load linker paths from common locations This parses the ld.so.conf and LD_LIBRARY_PATH env var. @@ -348,7 +348,7 @@ def LoadLdpaths( Returns: dict containing library paths to search """ - ldpaths: dict[str, list[str]] = { + ldpaths: Dict[str, List[str]] = { "conf": [], "env": [], "interp": [], @@ -401,10 +401,10 @@ def CompatibleELFs(elf1: ELFFile, elf2: ELFFile) -> bool: def FindLib( elf: ELFFile, lib: str, - ldpaths: list[str], + ldpaths: List[str], root: str = "/", debug: bool = False, -) -> tuple[Optional[str], Optional[str]]: +) -> Tuple[Optional[str], Optional[str]]: """Try to locate a |lib| that is compatible to |elf| in the given |ldpaths| Args: @@ -451,7 +451,7 @@ def ParseELF( debug: bool = False, _first: bool = True, _all_libs={}, -) -> dict[str, Any]: +) -> Dict[str, Any]: """Parse the ELF dependency tree of the specified file Args: @@ -658,7 +658,7 @@ def _ActionShow(options: argparse.Namespace, elf: dict): shown_libs = set(elf["needed"]) new_libs = elf["needed"][:] - chain_libs: list[str] = [] + chain_libs: List[str] = [] interp = elf["interp"] if interp: lib = os.path.basename(interp) @@ -916,7 +916,7 @@ def GetParser() -> argparse.ArgumentParser: return parser -def main(argv: list[str]) -> Optional[int]: +def main(argv: List[str]) -> Optional[int]: """The main entry point!""" parser = GetParser() options = parser.parse_args(argv)