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
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"
__date__ = "Sun, 07 Jul 2024 16:52:07 -0700"
__date__ = "Tue, 03 Sep 2024 17:46:32 -0700"
__developer__ = "bdbaddog"

View file

@ -1512,11 +1512,17 @@ class Base(SubstitutionEnvironment):
self._dict[envname][name] = nv
def AppendUnique(self, delete_existing: bool=False, **kw) -> None:
"""Append values to existing construction variables
in an Environment, if they're not already there.
If delete_existing is True, removes existing values first, so
values move to end.
def AppendUnique(self, delete_existing: bool = False, **kw) -> None:
"""Append values uniquely to existing construction variables.
Similar to :meth:`Append`, but the result may not contain duplicates
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)
for key, val in kw.items():
@ -1539,12 +1545,11 @@ class Base(SubstitutionEnvironment):
val = [x for x in val if x not in dk]
self._dict[key] = dk + val
else:
# val is not a list, so presumably a scalar (likely str).
dk = self._dict[key]
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:
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]
else:
if val not in dk:
@ -1694,28 +1699,37 @@ class Base(SubstitutionEnvironment):
return dlist
def Dump(self, key: Optional[str] = None, format: str = 'pretty') -> str:
""" Returns a dump of serialized construction variables.
def Dump(self, *key: str, format: str = 'pretty') -> str:
"""Return string of serialized construction variables.
The display formats are intended for humaan readers when
debugging - none of the supported formats produce a result that
SCons itself can directly make use of. Objects that cannot
directly be represented get a placeholder like
``<function foo at 0x123456>`` or ``<<non-serializable: function>>``.
Produces a "pretty" output of a dictionary of selected
construction variables, or all of them. The display *format* is
selectable. The result is intended for human consumption (e.g,
to print), mainly when debugging. Objects that cannot directly be
represented get a placeholder like ``<function foo at 0x123456>``
(pretty-print) or ``<<non-serializable: function>>`` (JSON).
Args:
key: if ``None``, format the whole dict of variables,
else format just the value of *key*.
key: if omitted, format the whole dict of variables,
else format *key*(s) with the corresponding values.
format: specify the format to serialize to. ``"pretty"`` generates
a pretty-printed string, ``"json"`` a JSON-formatted string.
Raises:
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:
cvars = self.Dictionary(key)
else:
if not key:
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()
@ -1735,14 +1749,15 @@ class Base(SubstitutionEnvironment):
class DumpEncoder(json.JSONEncoder):
"""SCons special json Dump formatter."""
def default(self, obj):
if isinstance(obj, (UserList, UserDict)):
return obj.data
return f'<<non-serializable: {type(obj).__qualname__}>>'
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)
def FindIxes(self, paths: Sequence[str], prefix: str, suffix: str) -> Optional[str]:
@ -1929,11 +1944,17 @@ class Base(SubstitutionEnvironment):
self._dict[envname][name] = nv
def PrependUnique(self, delete_existing: bool=False, **kw) -> None:
"""Prepend values to existing construction variables
in an Environment, if they're not already there.
If delete_existing is True, removes existing values first, so
values move to front.
def PrependUnique(self, delete_existing: bool = False, **kw) -> None:
"""Prepend values uniquely to existing construction variables.
Similar to :meth:`Prepend`, but the result may not contain duplicates
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)
for key, val in kw.items():
@ -1956,12 +1977,11 @@ class Base(SubstitutionEnvironment):
val = [x for x in val if x not in dk]
self._dict[key] = val + dk
else:
# val is not a list, so presumably a scalar (likely str).
dk = self._dict[key]
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:
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
else:
if val not in dk:

View file

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

View file

@ -67,7 +67,7 @@ from SCons import __version__ as SConsVersion
# these define the range of versions SCons supports
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
KNOWN_SCONSTRUCT_NAMES = [

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