Skip to content

Commit 8440b07

Browse files
committed
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 <[email protected]>
1 parent 7255c54 commit 8440b07

File tree

3 files changed

+40
-64
lines changed

3 files changed

+40
-64
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
5656
From Mats Wichmann:
5757
- Add support for Python 3.13 (as of alpha 2). So far only affects
5858
expected bytecodes in ActionTests.py.
59+
- sconsign cleanup - remove some dead code, minor manpage tweaks.
5960

6061

6162
RELEASE 4.6.0 - Sun, 19 Nov 2023 17:22:20 -0700

SCons/Utilities/sconsign.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,6 @@ def my_whichdb(filename):
5151
return whichdb(filename)
5252

5353

54-
def my_import(mname):
55-
"""Import database module.
56-
57-
This was used if the module was *not* SCons.dblite, to allow
58-
for programmatic importing. It is no longer used, in favor of
59-
importlib.import_module, and will be removed eventually.
60-
"""
61-
import imp
62-
63-
if '.' in mname:
64-
i = mname.rfind('.')
65-
parent = my_import(mname[:i])
66-
fp, pathname, description = imp.find_module(mname[i+1:], parent.__path__)
67-
else:
68-
fp, pathname, description = imp.find_module(mname)
69-
return imp.load_module(mname, fp, pathname, description)
70-
71-
7254
class Flagger:
7355
default_value = 1
7456

@@ -449,8 +431,6 @@ def main() -> None:
449431

450432
dbm = SCons.dblite
451433
# Ensure that we don't ignore corrupt DB files,
452-
# this was handled by calling my_import('SCons.dblite')
453-
# again in earlier versions...
454434
SCons.dblite.IGNORE_CORRUPT_DBFILES = False
455435
except ImportError:
456436
sys.stderr.write("sconsign: illegal file format `%s'\n" % a)
@@ -492,8 +472,6 @@ def main() -> None:
492472

493473
dbm = SCons.dblite
494474
# Ensure that we don't ignore corrupt DB files,
495-
# this was handled by calling my_import('SCons.dblite')
496-
# again in earlier versions...
497475
SCons.dblite.IGNORE_CORRUPT_DBFILES = False
498476
Do_SConsignDB(Map_Module.get(dbm_name, dbm_name), dbm)(a)
499477
else:

doc/man/sconsign.xml

Lines changed: 39 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,17 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<!--
3-
4-
__COPYRIGHT__
5-
6-
Permission is hereby granted, free of charge, to any person obtaining
7-
a copy of this software and associated documentation files (the
8-
"Software"), to deal in the Software without restriction, including
9-
without limitation the rights to use, copy, modify, merge, publish,
10-
distribute, sublicense, and/or sell copies of the Software, and to
11-
permit persons to whom the Software is furnished to do so, subject to
12-
the following conditions:
13-
14-
The above copyright notice and this permission notice shall be included
15-
in all copies or substantial portions of the Software.
16-
17-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
18-
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
19-
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
242

3+
<!--
4+
SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org)
5+
SPDX-License-Identifier: MIT
256
-->
267

8+
<!DOCTYPE reference [
9+
<!ENTITY % version SYSTEM "../version.xml">
10+
%version;
11+
<!ENTITY % scons SYSTEM '../scons.mod'>
12+
%scons;
13+
]>
14+
2715
<refentry id='sconsign1'
2816
xmlns="http://www.scons.org/dbxsd/v1.0"
2917
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -48,12 +36,13 @@
4836
</refsynopsisdiv>
4937

5038

51-
<refsect1 id='description'><title>DESCRIPTION</title>
39+
<refsect1 id='description'>
40+
<title>DESCRIPTION</title>
5241
<para>
5342
Displays the contents of one or more
54-
<firstterm>sconsign files</firstterm>,
55-
the signature database files
56-
used by the <application>SCons</application> build tool.
43+
<firstterm>sconsign</firstterm> files,
44+
the signature/dependency database
45+
used by the &SCons; build tool.
5746
</para>
5847

5948
<para>By default,
@@ -64,26 +53,34 @@ Without options,
6453
individual dependency entries are printed in the following format:</para>
6554

6655
<screen>
67-
depfile: signature timestamp length
68-
implicit_dependency_1: content_signature timestamp length
69-
implicit_dependency_2: content_signature timestamp length
56+
depfile: csig timestamp length
57+
implicit_dependency_1: csig timestamp length
58+
implicit_dependency_2: csig timestamp length
7059
...
71-
action_signature [action string]
60+
bactsig [action string]
7261
</screen>
7362

74-
<para><emphasis role="bold">None</emphasis>
63+
<para>
64+
<emphasis role="bold">csig</emphasis>
65+
is the <firstterm>content signature</firstterm>,
66+
a hash of the file's contents.
67+
<emphasis role="bold">bactsig</emphasis>
68+
is the <firstterm>build action signature</firstterm>,
69+
a hash of the command line or other build action
70+
used to build a target.
71+
<emphasis role="bold">None</emphasis>
7572
is printed in place of any missing timestamp,
76-
<firstterm>content signature</firstterm>
77-
(<emphasis role="bold">csig</emphasis>)
78-
or
79-
<firstterm>build action signature</firstterm>
73+
<emphasis role="bold">csig</emphasis>,
74+
or <emphasis role="bold">bactsig</emphasis>
8075
values for any entry
8176
or any of its dependencies.
8277
If the entry has no implicit dependencies,
8378
or no build action,
84-
those lines are omitted.</para>
79+
the corresponding lines are omitted.
80+
</para>
8581

86-
<para>By default,
82+
<para>
83+
By default,
8784
<command>sconsign</command>
8885
assumes that any
8986
<replaceable>file</replaceable>
@@ -92,14 +89,13 @@ arguments that end with a
9289
suffix contains
9390
signature entries for
9491
more than one directory
95-
(that is,
96-
was specified by the
92+
(that is, was specified by the
9793
<function>SConsignFile</function>
98-
function).
94+
&SCons; function).
9995
Any
10096
<replaceable>file</replaceable>
10197
argument that has no suffix
102-
is assumed to be an old-style
98+
is assumed to be an old-style (deprecated)
10399
sconsign file containing the signature entries
104100
for a single directory.
105101
If neither of those is true,
@@ -299,7 +295,8 @@ for all entries or the specified entries.</para>
299295
<refsect1 id='see_also'>
300296
<title>SEE ALSO</title>
301297
<para>
302-
<command>scons</command>,
298+
The &SCons; reference (manpage) at
299+
<ulink url="https://scons.org/doc/production/HTML/scons-man.html"/>,
303300
the SCons User Guide at
304301
<ulink url="https://scons.org/doc/production/HTML/scons-user.html"/>,
305302
the SCons source code

0 commit comments

Comments
 (0)