From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id 2ECFD385AC21 for ; Sun, 23 Oct 2022 20:36:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2ECFD385AC21 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org Received: by smtp.gentoo.org (Postfix, from userid 559) id C1D97340B10; Sun, 23 Oct 2022 20:36:26 +0000 (UTC) Date: Mon, 24 Oct 2022 01:07:01 +0545 From: Mike Frysinger To: gdb-patches@sourceware.org Subject: Re: [PATCH] gdb: make copyright.py interface a bit nicer Message-ID: Mail-Followup-To: gdb-patches@sourceware.org References: <20220101181456.25684-1-vapier@gentoo.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="DwqQxaJ7p6Rlio/g" Content-Disposition: inline In-Reply-To: <20220101181456.25684-1-vapier@gentoo.org> X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --DwqQxaJ7p6Rlio/g Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable ping ... -mike On 01 Jan 2022 13:14, Mike Frysinger via Gdb-patches wrote: > This way people can run `./copyright.py --help` and get some info as > to what this does without it going and modifying the tree. > --- > gdb/copyright.py | 21 ++++++++++++++++----- > 1 file changed, 16 insertions(+), 5 deletions(-) > mode change 100644 =3D> 100755 gdb/copyright.py >=20 > diff --git a/gdb/copyright.py b/gdb/copyright.py > old mode 100644 > new mode 100755 > index 0de15b8a3053..a78f7f2aa9b0 > --- a/gdb/copyright.py > +++ b/gdb/copyright.py > @@ -22,7 +22,7 @@ > This script updates the list of years in the copyright notices in > most files maintained by the GDB project. > =20 > -Usage: cd src/gdb && python copyright.py > +Usage: cd src/gdb && ./copyright.py > =20 > Always review the output of this script before committing it! > A useful command to review the output is: > @@ -30,12 +30,14 @@ A useful command to review the output is: > This removes the bulk of the changes which are most likely to be correct. > """ > =20 > +import argparse > import datetime > import locale > import os > import os.path > import subprocess > import sys > +from typing import List, Optional > =20 > =20 > def get_update_list(): > @@ -158,16 +160,25 @@ def may_have_copyright_notice(filename): > return False > =20 > =20 > -def main(): > +def get_parser() -> argparse.ArgumentParser: > + """Get a command line parser.""" > + parser =3D argparse.ArgumentParser( > + description=3D__doc__, formatter_class=3Dargparse.RawDescription= HelpFormatter > + ) > + return parser > + > + > +def main(argv: List[str]) -> Optional[int]: > """The main subprogram.""" > + parser =3D get_parser() > + _ =3D parser.parse_args(argv) > root_dir =3D os.path.dirname(os.getcwd()) > os.chdir(root_dir) > =20 > if not ( > os.path.isdir("gdb") and os.path.isfile("gnulib/import/extra/upd= ate-copyright") > ): > - print("Error: This script must be called from the gdb directory.= ") > - sys.exit(1) > + sys.exit("Error: This script must be called from the gdb directo= ry.") > =20 > update_list =3D get_update_list() > update_files(update_list) > @@ -416,4 +427,4 @@ NOT_FSF_LIST =3D ( > ) > =20 > if __name__ =3D=3D "__main__": > - main() > + sys.exit(main(sys.argv[1:])) > --=20 > 2.33.0 >=20 --DwqQxaJ7p6Rlio/g Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAmNVlFgACgkQQWM7n+g3 9YGtDw/8CZ2S9wksiJKOHF0ZOBINUov5d4IKV+9yCqZNLr62Hv44SaXVNSU4/EaC /wUv2liwO4/np6BrqVbYqw2S2AhFBmZonuZEQcynHb3da63HQcXppqar2LffVkq7 EeQgsoRojjCEKHOdRjoT23NjNtmODMnP7QexhbO1PD6saAT9bcDtpS8OozXlnFjr hQl6Xp/HvJD73yWOJVBFZtW7fpLu1e6js0cjqHF7OTDxT00dIIi4PlIinlb07Swc U7qgxw2pFtqNesibwgXcmArqGJhSWR/GAqC3bAFqQylumLlSJnNlqJXiuMjl/ngZ U9NLykwixBUOoXx8SJMt3evifUcv2pTEyXDhLWbRhbwUHXAoA6aijFlzq6UDrEX7 cefguQgiNXo8Nm8qu2OIrV3h1vyHBgGMeIbwYfKskPn0pHbE85Y8vd4Z7Vt6m0ic cf1WphM5JY/WcrlDxw9phX+ozOW2vegVm4d6f0Cp5kMnPCm/xZ8UG6HlV071Urq3 91BWhHH1BFCJLwtDemxGOy9tt0hCAXN27ULcseM4g+qkJqGSAw56kp0Jtmb8Ai8u KWF0cnSyBK5yYfQWBKVveKJIBWETNvU5OPdFl10eMXrISrv1xBzN4Tb5xEZqm8xz 2ptSfohs8ukTNbrLINFbxrQZmVlEdaacdBAn1IbcDF+WKQ5w2BE= =ypLd -----END PGP SIGNATURE----- --DwqQxaJ7p6Rlio/g--