summaryrefslogtreecommitdiffstats
path: root/SCons/cpp.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix CPP conditional scanner (cpp.py) and test suite (cppTests.py).Joseph Brill2024-11-101-7/+45
| | | | | | | | | | | | | Changes: - Preserve non-integer literals that contain valid integer specifications. - Add binary integer specifications - Add octal integer specification - Zero (0) is considered an octal number - Add negative lookbehind/lookahead for number specifications (text is not word/token based) - Add method to evaluate constant expression for define constant expressions - Replace int conversion with constant evaluation expression - int conversion failed for hex numbers due to default base 10 [int(s)] vs unknown base [int(s, 0)] - Add additional tests
* Be more careful about file readingMats Wichmann2024-02-081-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | If SCons reads a file to interpret the contents, codecs are a concern. The File node class has a get_text_contents() method which makes a best effort at decoding bytes data, but there are other places that don't get their file contents via that method, and so should do their own careful decoding - but don't, they just read as text and hope it's okay. Move the decode-bytes portion out of File.get_text_contents() to SCons.Util.to_Text() so that everyone that needs this can call it. Add a couple of additional known BOM codes (after consulting Python's codecs module). Note that while get_text_contents acts on nodes, the new (moved) routine to_Text acts on passed bytes, so it can be used in a non-Node context as well - for example the Java tool initializer reads a file and tries to decode it, and can get it wrong (see #3569), this change provides it some help. Fixes #3569 FIxes #4462 Signed-off-by: Mats Wichmann <mats@linux.com>
* Elminate http: referencesMats Wichmann2023-10-171-5/+6
| | | | | | | | | | Most remaining http: references are either changed to https: or removed or changed in case they were also stale links, and a replacement was findable. Does not affect schema and stylesheet references, which can remain http: Signed-off-by: Mats Wichmann <mats@linux.com>
* Add some cheap return and parameter annotationsMats Wichmann2023-05-011-22/+22
| | | | | | | | | | | | | | | | | Use: https://github.com/JelleZijlstra/autotyping to add "safe" return annotations. Where a parameter has a default value that is an obvious scalar type (bool, int, str, etc.) add those annotations as well. Also fixed two small bugs that popped up when sanity-checking with mypy. One in FortranCommon, where a return had been previously annotated to be a tuple of Action, which should be ActionBase - Action is the factory function, not the base class. The other was a typo in the error raised in _add_cppdefines - the message was formatted with the value of "define" which should have been "defines". Signed-off-by: Mats Wichmann <mats@linux.com>
* Conditional C/C++ Preprocessor: Strip shell's backslashes from the computed ↵Ivan Kravets2022-07-061-0/+3
| | | | include (-DFOO_H=\"foo.h\")
* Scanner tweaksMats Wichmann2021-07-241-23/+12
| | | | | | | | | | | | | Maintenance and doc: - add new sconsign filenames to skip_entry_list in Scanner/Dir.py - modernize some usage in Scanner package such as calling super() - switch some initializations to comprehensions - some code formatting - Docstring for scanner Base moved from init-method to class-level so it's picked up by Sphinx (which skips dunder methods) - Manpage tweaks Signed-off-by: Mats Wichmann <mats@linux.com>
* Fix some imports and other checker warningsMats Wichmann2021-05-051-4/+0
| | | | | | | | | | | | | * Removed a number of imports reported as unused. * Reorganize imports in a few places. * Checker reported warnings problems ("Instantiating an exception, but not raising it, has no effect"): serveral tool modules instantiated a warning class thinking (?) it would issue the warning; changed these to the standard use - calling the warn() function with the warnclass as an arg. * Tool modules that were touched had the copyright header munging applied. * Removed irritating "####" lines from gettext and msgfmt tools. Signed-off-by: Mats Wichmann <mats@linux.com>
* Update some copyright strings and drop __revision__ [skip appveyor]Mats Wichmann2020-09-231-8/+3
| | | | | | | | | | | | | | | | | | Touches the first and second levels of SCons (except SCons.Tool), not tests or docs which remain TODO. Make sure docstring is first non-comment content, eliminate cases where docstring is set elsewhere but assigns to __doc__ - this approach of course worked inside Python, but confuses various tools. Some module-level docstrings modified a bit, in particular the convention of having the name of the module as the first line is dropped, replaced by a summary description going there instead - this improves the look in the API Docs, which otherwise display something like: SCons.Foo - SCons.Foo Signed-off-by: Mats Wichmann <mats@linux.com>
* Docstring changes from Sphinx conversion [ci skip]Mats Wichmann2020-05-301-2/+1
| | | | | | | | These changes are prompted by complaints Sphinx makes about existing docstrings; split from the Sphinx-build PR to make for easier reviewing. Signed-off-by: Mats Wichmann <mats@linux.com>
* classes no longer explicitly inherit from objectMats Wichmann2020-05-241-2/+2
| | | | | | In Python3 this is the default. Signed-off-by: Mats Wichmann <mats@linux.com>
* Python 3.9 supportMats Wichmann2020-05-121-4/+4
| | | | | | | Fixes to ActionTests to support bytecode, etc. Eliminate some warnings when running testsuite (rawstrings) Signed-off-by: Mats Wichmann <mats@linux.com>
* Reorganize the repo. Moved src/engine/SCons to ./SCons to be more in line ↵William Deegan2020-05-061-0/+661
with current python packaging practices