Upgrade to SCons v4.8.1

This commit is contained in:
Artem Pavlenko 2024-09-09 10:56:17 +01:00
parent 3d172b94f7
commit 379261434b
1535 changed files with 139 additions and 69 deletions

View file

@ -32,15 +32,15 @@ The files are split into directories named by the first few
digits of the signature. The prefix length used for directory digits of the signature. The prefix length used for directory
names can be changed by this script. names can be changed by this script.
""" """
__revision__ = "scripts/scons-configure-cache.py 7c688f694c644b61342670ce92977bf4a396c0d4 Sun, 07 Jul 2024 16:52:07 -0700 bdbaddog" __revision__ = "scripts/scons-configure-cache.py 08661ed4c552323ef3a7f0ff1af38868cbabb05e Tue, 03 Sep 2024 17:46:32 -0700 bdbaddog"
__version__ = "4.8.0" __version__ = "4.8.1"
__build__ = "7c688f694c644b61342670ce92977bf4a396c0d4" __build__ = "08661ed4c552323ef3a7f0ff1af38868cbabb05e"
__buildsys__ = "M1Dog2021" __buildsys__ = "M1Dog2021"
__date__ = "Sun, 07 Jul 2024 16:52:07 -0700" __date__ = "Tue, 03 Sep 2024 17:46:32 -0700"
__developer__ = "bdbaddog" __developer__ = "bdbaddog"

View file

@ -1513,10 +1513,16 @@ class Base(SubstitutionEnvironment):
self._dict[envname][name] = nv self._dict[envname][name] = nv
def AppendUnique(self, delete_existing: bool = False, **kw) -> None: def AppendUnique(self, delete_existing: bool = False, **kw) -> None:
"""Append values to existing construction variables """Append values uniquely to existing construction variables.
in an Environment, if they're not already there.
If delete_existing is True, removes existing values first, so Similar to :meth:`Append`, but the result may not contain duplicates
values move to end. of any values passed for each given key (construction variable),
so an existing list may need to be pruned first, however it may still
contain other duplicates.
If *delete_existing* is true, removes existing values first, so values
move to the end; otherwise (the default) values are skipped if
already present.
""" """
kw = copy_non_reserved_keywords(kw) kw = copy_non_reserved_keywords(kw)
for key, val in kw.items(): for key, val in kw.items():
@ -1539,12 +1545,11 @@ class Base(SubstitutionEnvironment):
val = [x for x in val if x not in dk] val = [x for x in val if x not in dk]
self._dict[key] = dk + val self._dict[key] = dk + val
else: else:
# val is not a list, so presumably a scalar (likely str).
dk = self._dict[key] dk = self._dict[key]
if is_List(dk): if is_List(dk):
# By elimination, val is not a list. Since dk is a
# list, wrap val in a list first.
if delete_existing: if delete_existing:
dk = list(filter(lambda x, val=val: x not in val, dk)) dk = [x for x in dk if x != val]
self._dict[key] = dk + [val] self._dict[key] = dk + [val]
else: else:
if val not in dk: if val not in dk:
@ -1694,28 +1699,37 @@ class Base(SubstitutionEnvironment):
return dlist return dlist
def Dump(self, key: Optional[str] = None, format: str = 'pretty') -> str: def Dump(self, *key: str, format: str = 'pretty') -> str:
""" Returns a dump of serialized construction variables. """Return string of serialized construction variables.
The display formats are intended for humaan readers when Produces a "pretty" output of a dictionary of selected
debugging - none of the supported formats produce a result that construction variables, or all of them. The display *format* is
SCons itself can directly make use of. Objects that cannot selectable. The result is intended for human consumption (e.g,
directly be represented get a placeholder like to print), mainly when debugging. Objects that cannot directly be
``<function foo at 0x123456>`` or ``<<non-serializable: function>>``. represented get a placeholder like ``<function foo at 0x123456>``
(pretty-print) or ``<<non-serializable: function>>`` (JSON).
Args: Args:
key: if ``None``, format the whole dict of variables, key: if omitted, format the whole dict of variables,
else format just the value of *key*. else format *key*(s) with the corresponding values.
format: specify the format to serialize to. ``"pretty"`` generates format: specify the format to serialize to. ``"pretty"`` generates
a pretty-printed string, ``"json"`` a JSON-formatted string. a pretty-printed string, ``"json"`` a JSON-formatted string.
Raises: Raises:
ValueError: *format* is not a recognized serialization format. ValueError: *format* is not a recognized serialization format.
.. versionchanged:: NEXT_VERSION
*key* is no longer limited to a single construction variable name.
If *key* is supplied, a formatted dictionary is generated like the
no-arg case - previously a single *key* displayed just the value.
""" """
if key: if not key:
cvars = self.Dictionary(key)
else:
cvars = self.Dictionary() cvars = self.Dictionary()
elif len(key) == 1:
dkey = key[0]
cvars = {dkey: self[dkey]}
else:
cvars = dict(zip(key, self.Dictionary(*key)))
fmt = format.lower() fmt = format.lower()
@ -1735,13 +1749,14 @@ class Base(SubstitutionEnvironment):
class DumpEncoder(json.JSONEncoder): class DumpEncoder(json.JSONEncoder):
"""SCons special json Dump formatter.""" """SCons special json Dump formatter."""
def default(self, obj): def default(self, obj):
if isinstance(obj, (UserList, UserDict)): if isinstance(obj, (UserList, UserDict)):
return obj.data return obj.data
return f'<<non-serializable: {type(obj).__qualname__}>>' return f'<<non-serializable: {type(obj).__qualname__}>>'
return json.dumps(cvars, indent=4, cls=DumpEncoder, sort_keys=True) return json.dumps(cvars, indent=4, cls=DumpEncoder, sort_keys=True)
else:
raise ValueError("Unsupported serialization format: %s." % fmt) raise ValueError("Unsupported serialization format: %s." % fmt)
@ -1930,10 +1945,16 @@ class Base(SubstitutionEnvironment):
self._dict[envname][name] = nv self._dict[envname][name] = nv
def PrependUnique(self, delete_existing: bool = False, **kw) -> None: def PrependUnique(self, delete_existing: bool = False, **kw) -> None:
"""Prepend values to existing construction variables """Prepend values uniquely to existing construction variables.
in an Environment, if they're not already there.
If delete_existing is True, removes existing values first, so Similar to :meth:`Prepend`, but the result may not contain duplicates
values move to front. of any values passed for each given key (construction variable),
so an existing list may need to be pruned first, however it may still
contain other duplicates.
If *delete_existing* is true, removes existing values first, so values
move to the front; otherwise (the default) values are skipped if
already present.
""" """
kw = copy_non_reserved_keywords(kw) kw = copy_non_reserved_keywords(kw)
for key, val in kw.items(): for key, val in kw.items():
@ -1956,12 +1977,11 @@ class Base(SubstitutionEnvironment):
val = [x for x in val if x not in dk] val = [x for x in val if x not in dk]
self._dict[key] = val + dk self._dict[key] = val + dk
else: else:
# val is not a list, so presumably a scalar (likely str).
dk = self._dict[key] dk = self._dict[key]
if is_List(dk): if is_List(dk):
# By elimination, val is not a list. Since dk is a
# list, wrap val in a list first.
if delete_existing: if delete_existing:
dk = [x for x in dk if x not in val] dk = [x for x in dk if x != val]
self._dict[key] = [val] + dk self._dict[key] = [val] + dk
else: else:
if val not in dk: if val not in dk:

View file

@ -167,7 +167,7 @@ def piped_spawn(sh, escape, cmd, args, env, stdout, stderr):
try: try:
with open(tmpFileStdoutName, "rb") as tmpFileStdout: with open(tmpFileStdoutName, "rb") as tmpFileStdout:
output = tmpFileStdout.read() output = tmpFileStdout.read()
stdout.write(output.decode(stdout.encoding, "replace")) stdout.write(output.decode('oem', "replace").replace("\r\n", "\n"))
os.remove(tmpFileStdoutName) os.remove(tmpFileStdoutName)
except OSError: except OSError:
pass pass
@ -176,7 +176,7 @@ def piped_spawn(sh, escape, cmd, args, env, stdout, stderr):
try: try:
with open(tmpFileStderrName, "rb") as tmpFileStderr: with open(tmpFileStderrName, "rb") as tmpFileStderr:
errors = tmpFileStderr.read() errors = tmpFileStderr.read()
stderr.write(errors.decode(stderr.encoding, "replace")) stderr.write(errors.decode('oem', "replace").replace("\r\n", "\n"))
os.remove(tmpFileStderrName) os.remove(tmpFileStderrName)
except OSError: except OSError:
pass pass

View file

@ -67,7 +67,7 @@ from SCons import __version__ as SConsVersion
# these define the range of versions SCons supports # these define the range of versions SCons supports
minimum_python_version = (3, 6, 0) minimum_python_version = (3, 6, 0)
deprecated_python_version = (3, 7, 0) # the first non-deprecated version deprecated_python_version = (3, 7, 0)
# ordered list of SConstruct names to look for if there is no -f flag # ordered list of SConstruct names to look for if there is no -f flag
KNOWN_SCONSTRUCT_NAMES = [ KNOWN_SCONSTRUCT_NAMES = [

Some files were not shown because too many files have changed in this diff Show more