From 8440b074e1616d81286dceb4d0a448ce671c2c66 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Tue, 9 Jan 2024 07:33:40 -0700 Subject: [PATCH] Maint: remove dead code from sconsign The Utilities/sconsign.py code used to do its own importing of the suitable module to read the sconsign file; for a while now it leaves that to the sconsign module, but some remnants of the old code were still present, which caused checkers and IDEs to grumble about usage of the "imp" module, which is removed from Python as of 3.12. Dropping this (uncalled) code and associated comments quiets the grumbles. Also tweaked manpage just a bit. Signed-off-by: Mats Wichmann --- CHANGES.txt | 1 + SCons/Utilities/sconsign.py | 22 ---------- doc/man/sconsign.xml | 81 ++++++++++++++++++------------------- 3 files changed, 40 insertions(+), 64 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index adb955c113..fbed74cb55 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -56,6 +56,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER From Mats Wichmann: - Add support for Python 3.13 (as of alpha 2). So far only affects expected bytecodes in ActionTests.py. + - sconsign cleanup - remove some dead code, minor manpage tweaks. RELEASE 4.6.0 - Sun, 19 Nov 2023 17:22:20 -0700 diff --git a/SCons/Utilities/sconsign.py b/SCons/Utilities/sconsign.py index a02ebb022e..4cef4779bd 100644 --- a/SCons/Utilities/sconsign.py +++ b/SCons/Utilities/sconsign.py @@ -51,24 +51,6 @@ def my_whichdb(filename): return whichdb(filename) -def my_import(mname): - """Import database module. - - This was used if the module was *not* SCons.dblite, to allow - for programmatic importing. It is no longer used, in favor of - importlib.import_module, and will be removed eventually. - """ - import imp - - if '.' in mname: - i = mname.rfind('.') - parent = my_import(mname[:i]) - fp, pathname, description = imp.find_module(mname[i+1:], parent.__path__) - else: - fp, pathname, description = imp.find_module(mname) - return imp.load_module(mname, fp, pathname, description) - - class Flagger: default_value = 1 @@ -449,8 +431,6 @@ def main() -> None: dbm = SCons.dblite # Ensure that we don't ignore corrupt DB files, - # this was handled by calling my_import('SCons.dblite') - # again in earlier versions... SCons.dblite.IGNORE_CORRUPT_DBFILES = False except ImportError: sys.stderr.write("sconsign: illegal file format `%s'\n" % a) @@ -492,8 +472,6 @@ def main() -> None: dbm = SCons.dblite # Ensure that we don't ignore corrupt DB files, - # this was handled by calling my_import('SCons.dblite') - # again in earlier versions... SCons.dblite.IGNORE_CORRUPT_DBFILES = False Do_SConsignDB(Map_Module.get(dbm_name, dbm_name), dbm)(a) else: diff --git a/doc/man/sconsign.xml b/doc/man/sconsign.xml index 726f86e9f0..b5b01ca9bb 100644 --- a/doc/man/sconsign.xml +++ b/doc/man/sconsign.xml @@ -1,29 +1,17 @@ - + +%version; + +%scons; +]> + -DESCRIPTION + +DESCRIPTION Displays the contents of one or more -sconsign files, -the signature database files -used by the SCons build tool. +sconsign files, +the signature/dependency database +used by the &SCons; build tool. By default, @@ -64,26 +53,34 @@ Without options, individual dependency entries are printed in the following format: -depfile: signature timestamp length - implicit_dependency_1: content_signature timestamp length - implicit_dependency_2: content_signature timestamp length +depfile: csig timestamp length + implicit_dependency_1: csig timestamp length + implicit_dependency_2: csig timestamp length ... - action_signature [action string] + bactsig [action string] -None + +csig +is the content signature, +a hash of the file's contents. +bactsig +is the build action signature, +a hash of the command line or other build action +used to build a target. +None is printed in place of any missing timestamp, - content signature -(csig) -or -build action signature +csig, +or bactsig values for any entry or any of its dependencies. If the entry has no implicit dependencies, or no build action, -those lines are omitted. +the corresponding lines are omitted. + -By default, + +By default, sconsign assumes that any file @@ -92,14 +89,13 @@ arguments that end with a suffix contains signature entries for more than one directory -(that is, -was specified by the +(that is, was specified by the SConsignFile -function). +&SCons; function). Any file argument that has no suffix -is assumed to be an old-style +is assumed to be an old-style (deprecated) sconsign file containing the signature entries for a single directory. If neither of those is true, @@ -299,7 +295,8 @@ for all entries or the specified entries. SEE ALSO -scons, +The &SCons; reference (manpage) at +, the SCons User Guide at , the SCons source code