From 8440b074e1616d81286dceb4d0a448ce671c2c66 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Tue, 9 Jan 2024 07:33:40 -0700 Subject: [PATCH 1/2] 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 From 4fc13f6468e4625ae931f11127e19d7f6c3ed8b3 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Mon, 29 Jan 2024 09:25:26 -0700 Subject: [PATCH 2/2] Adjust sconsign manpage Following review comments, restored more descriptive names and reworded some things. Signed-off-by: Mats Wichmann --- doc/man/sconsign.xml | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/doc/man/sconsign.xml b/doc/man/sconsign.xml index b5b01ca9bb..9ece78a94c 100644 --- a/doc/man/sconsign.xml +++ b/doc/man/sconsign.xml @@ -43,6 +43,9 @@ Displays the contents of one or more sconsign files, the signature/dependency database used by the &SCons; build tool. +The database contains all Nodes that are known to the build, +either by declaration in the build configuration, +produced as side effects, or detected by inspection. By default, @@ -53,32 +56,38 @@ Without options, individual dependency entries are printed in the following format: -depfile: csig timestamp length - implicit_dependency_1: csig timestamp length - implicit_dependency_2: csig timestamp length +depfile: content-signature timestamp length + implicit-dependency-1: content-signature timestamp length + implicit-dependency-2: content-signature timestamp length ... - bactsig [action string] + build-signature [action-string] -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. +content-signature +is the hash of the file's contents (csig) +and build-signature +is the hash of the command line or other build action +used to build a target (bactsig). +If provided, +action-string +is the unexpanded string action or the function called. None is printed in place of any missing timestamp, csig, or bactsig -values for any entry -or any of its dependencies. +values for any entry or any of its dependencies. If the entry has no implicit dependencies, or no build action, the corresponding lines are omitted. + +An indicator line is printed for each directory, +as directories do not have signatures in the database +and so would not otherwise be shown. + + By default, sconsign