Skip to content

Fix 4746 tempfile enc issue#11

Closed
mwichmann wants to merge 566 commits into
bdbaddog:masterfrom
mwichmann:fix_4746_TEMPFILE_ENC_ISSUE
Closed

Fix 4746 tempfile enc issue#11
mwichmann wants to merge 566 commits into
bdbaddog:masterfrom
mwichmann:fix_4746_TEMPFILE_ENC_ISSUE

Conversation

@mwichmann

Copy link
Copy Markdown

Updates SCons#4749

Alternate approach to avoid decoding problems: don't try to guess how to encode the TEMPFILE. Leave it utf-8 unless TEMPFILEENCODING is set.

Add comment to TEMPFILEDIR doc on the topic as well.

Signed-off-by: Mats Wichmann mats@linux.com

mwichmann and others added 30 commits December 13, 2024 15:40
Simplistic macro replacement is now done on the contents of CPPDEFINES,
to improve accuracy of conditional inclusion as compared to the real
preprocessor (ref: issue SCons#4623).

Signed-off-by: Mats Wichmann <mats@linux.com>
Replacement is now limited to five passes, to avoid going into an endless
loop in pathlogical cases where there are three or more macros that
circularly refer to each other. No error is reported in this case.

Replacement is now only done for the otional C Conditional scanner,
not for the classical C scanner.

Signed-off-by: Mats Wichmann <mats@linux.com>
Now using the "modified" approach from the PR discussion: unroll the
dict comprehension and as we process replacements keep track if changes
were made, rather than doing the relatively more expensive dict-vs-dict
comparison at the end of each loop.

Signed-off-by: Mats Wichmann <mats@linux.com>
Improve C scanner conditional inclusion
Turn `SCons.Variables.Variable` into a dataclass
Adjusts some doctrings and comments, and one error in typing.

Manpage has the introdctory Variables material updated a bit, and the
methods sorted, to match everywhere else in the manpage.

Signed-off-by: Mats Wichmann <mats@linux.com>
Signed-off-by: Mats Wichmann <mats@linux.com>
Since Python 2.2, the object returned by an os.stat() call presents
attributes matching the 10-tuple of stat values. Use these instead of
indexing into the tuple.

As usual for non-removed tests, minor tweaks made if needed -
copyright header and DefautlEnvironment() call for performance.

Signed-off-by: Mats Wichmann <mats@linux.com>
If a stat_result object's st_*time attributes are used, a float is
returned instead of an int. Adjust sconsign test regexes to optionally
accept a .digits tail of the number.  Confirmed this works for both
indexed attributes (which return an int) and named attributes (float).

Signed-off-by: Mats Wichmann <mats@linux.com>
A previous change proposed flipping all of the Python stat references
from the older tuple index style (st[stat.ST_XXX]) to the more modern stat
structure references (st.st_xxx). This change rolls back the one place in
the actual SCons code (in Node/FS) that used the stat mtime attribute.
There's a small chance that switching scons versions back and forth
could cause some time comparison issues, since st_mtime is a float,
but for backwards compatibility reasons with ancient Python 2 versions
Python retained the integer behavior of the index form.  While problems
from this seem a low probability, avoid the issue for now.

Signed-off-by: Mats Wichmann <mats@linux.com>
Change update-release-info test for Python changes
The User Guide uses an example (in the Command chapter) of making a target
name out of the source name, a special attribute, and concatenation
with a new suffix.  The special attribute part is not something that has
been introduced. Some searching suggests it's never actually described in
the User Guide, though .file, .abspath and .srcdir are used in examples.

The attribute used, .basename, doesn't actually exist - there's a
.base and a .filebase. Furthermore, the substitution suggested doesn't
work. Expansion of special variables like $SOURCE into nodes is deferred -
see the docstring of SCons.Subst.NLWrapper - so the internal expansion
ends up trying to lookup the attribute on a string, which fails with
an AttributeError.  The way the user guide entry is written, it was
not actually evaluated: it was described as an <scons_example>, but
an incomplete one, and since there was no corresponding <scons_output>
the problem was not detected.

The changes fix up the example to have it use an existing attribute
(.base) and do File() on the source, and add a sidebar to provide a
bit of an explanation so this isn't just "magic".  A subsequent example
(ex4, which I added) is dropped as it doesn't add enough value by itself,
and the final example (formerly ex5, renamed to ex3) now includes this
substitution so it's actually run by the doc machinery, and can be
seen to be working correctly.

This finally fixes SCons#2905, which was closed in 2018 as having been addressed,
though the non-working example actually remained. The issue is
also mentioned in SCons#4660, which is not resolved by changing the docs -
leaving that open, at least for the time being.

Signed-off-by: Mats Wichmann <mats@linux.com>
Set TEMPLATE rule to `install_pool` for the Ninja tool
…ment. Now code matches the documentation. Additionally fixturized the Help test
…ment. Now code matches the documentation. Additionally fixturized the Help test
Signed-off-by: Mats Wichmann <mats@linux.com>
Fix Help()'s local_only arg to match documents.
Imcludes test snippets contained in docstrings, too.

Signed-off-by: Mats Wichmann <mats@linux.com>
Insted of really long strings of repeated characters, use f-strings to
compose the "expected" output for the banner function tests.  This keeps
the code formatter from breaking things an ugly way, and is really more
"accurate" anyway.

Signed-off-by: Mats Wichmann <mats@linux.com>
mwichmann and others added 27 commits June 22, 2025 11:28
Typo in SConsDoc.py caused Sphinx warn.  Sphinx was also issuing this notice:

  Converting `source_suffix = '.rst'` to `source_suffix = {'.rst': 'restructuredtext'}`.

so updated the conf file to reflect that evolution.

Some tweaks to pyproject.toml to reflect some evolution as well.
Build was issuing this:

  SetuptoolsDeprecationWarning: `project.license` as a TOML table is deprecated
!!
  Please use a simple string containing a SPDX expression for `project.license`.
  You can also use `project.license-files`. (Both options available on setuptools>=77.0.0).

Plus, License in Classifiers is deprecated, as is license-files in
the [tool.setuptools] section (which moves to the package section.

Improved, I hope, the package-finder specification.

Added optional dependencies section to match the external
requirement-dev.txt and requirements-pkg.txt files. This is supposed
to allow installing "in one go", like (currently untested):

  python -m pip install scons[dev]

Signed-off-by: Mats Wichmann <mats@linux.com>
Got the version syntax for lxml wrong first time.

Signed-off-by: Mats Wichmann <mats@linux.com>
Signed-off-by: Mats Wichmann <mats@linux.com>
Fix a few issues related to "building" scons
Had adpated bytecode strings during the alpha phase, but those changed
again. Since this change syncs with 3.14.0b3, no further changes from
the Python side are expected and we should be good to go at release.

Signed-off-by: Mats Wichmann <mats@linux.com>
But leave in, with a note, in case it's needed in future.

Signed-off-by: Mats Wichmann <mats@linux.com>
Final adjustments for Python 3.14
…h a python version. [skip appveyor]

Changes:
* Modify the matrix to pair OS version and PY version.
* Update CHANGES.txt and RELEASE.txt accordingly.
Workflows: Update github workflow files
Tweak the wordings of CheckLib, CheckLibWithHeader, CheckType,
CheckTypeSize.

Add id markers to all the configure methods so they can be linked to.

Also added a docstring to the Node "Attrs" inner class - this relates to
Configure because it adds attributes to Nodes directly, but Attrs
uses __slots__ - seemed worth a brief clarification.

Signed-off-by: Mats Wichmann <mats@linux.com>
Make entries more consistent with each other.

Note when some check functions add to config.h.

Signed-off-by: Mats Wichmann <mats@linux.com>
Signed-off-by: Mats Wichmann <mats@linux.com>
Signed-off-by: Mats Wichmann <mats@linux.com>
…z/liblzma handling.

Changes:
* Remove searching for and prepending xz.exe to the environment path for windows.
* tar.exe in Windows 10 and GH windows-2022 don't appear to support xz even if on the system path.
* tar.exe in Windows 11 and GH windows-2025 appears to support xz without additions to the system path.
* If the candidate tar.exe is the windows tar.exe, check the version string for liblzma support.
* Remove test/packaging/tar/xz_packaging.py from thw windows test skip file.
…bz2/bz2lib handling.

Changes:
* Remove searching for and prepending bzip2.exe to the environment path for windows.
* tar.exe in Windows 10 and GH windows-2022 don't appear to support bzip2 even if on the system path.
* tar.exe in Windows 11 and GH windows-2025 appears to support bzip2 without additions to the system path.
* If the candidate tar.exe is the windows tar.exe, check the version string for bz2lib support.
* Strip the tar versions strings before processing.
… xz tests updates and GitHub workflow changes on Windows.
…tSConsTar.py and simplify packaging tar tests.
Testing: Update the packaging tar bz2 and xz tests on windows
Nitpicking: test the (probably rate) situation where the existing
value contained more than one instance of the value being appended.

Signed-off-by: Mats Wichmann <mats@linux.com>
Update AppendUnique, PrependUnique unit tests
….getpreferredencoding(False) instead of hardcoded utf-8
Alternate approach to avoid decoding problems: don't try to guess how
to encode the TEMPFILE.  Leave it utf-8 unless TEMPFILEENCODING is set.

Add comment to TEMPFILEDIR doc on the topic as well.

Signed-off-by: Mats Wichmann <mats@linux.com>
@bdbaddog bdbaddog closed this Jul 31, 2025
@mwichmann mwichmann deleted the fix_4746_TEMPFILE_ENC_ISSUE branch August 1, 2025 13:00
@mwichmann mwichmann restored the fix_4746_TEMPFILE_ENC_ISSUE branch August 1, 2025 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.