summaryrefslogtreecommitdiffstats
path: root/SCons/DefaultsTests.py
Commit message (Collapse)AuthorAgeFilesLines
* Add some cheap return and parameter annotationsMats Wichmann2023-05-011-6/+6
| | | | | | | | | | | | | | | | | 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>
* Tweak Append/Prepend e2e testsMats Wichmann2023-02-151-5/+3
| | | | | | | | | | | | | Added another try block so complete prepend e2e test can be run on a branch where PR #4263 is not applied (for comparison). Added license header. Changed invalid-tuple unittest to use assertRaises (behavior is the same) Also added a versionadded and a versionchanged to docstrings. Signed-off-by: Mats Wichmann <mats@linux.com>
* Added DefaultEnvironment(tools=[]) to fixtures for CPPDEFINES. Added ↵William Deegan2023-02-111-0/+10
| | | | negative test for non-two-tuple. Minor wording change
* Adjusted CPPDEFINES behavior for list and tupleMats Wichmann2023-02-091-1/+6
| | | | | | | | | | | | | | After the previous proposals, addition of a bare tuple is restored to the valued-macro behavior (this previously did not work consistently). Strings are now consistently split if they contain spaces, except if entered as a list member, in which case (as documented) they are left alone. tuples with nore than two members are now flagged as a UserError; previously the first two members were taken as name=value and any further members were silently ignored. More tests added. Signed-off-by: Mats Wichmann <mats@linux.com>
* Fix some CPPDEFINES handling problemsMats Wichmann2023-01-301-10/+46
| | | | | | | | | | A few places were deciding what to do based on result of is_List, when the intent was really list-or-tuple-or-derivatives - changed to is_Sequence. Added some test cases, including a unit test for processDefines (which would have caught one of these cases). Signed-off-by: Mats Wichmann <mats@linux.com>
* Added default values for source and target arguments to _defines (used for ↵William Deegan2022-03-201-5/+43
| | | | expanding among other things CPPDEFINES). source and target arguements were previously added to allow those values to be used by alternative definitions for _defines. This broke previous usage, including scons-contribs qt4 and qt5 tools. (See https://github.com/SCons/scons-contrib/issues/45 )
* 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>
* Remove some "star imports"Mats Wichmann2020-11-161-1/+1
| | | | | | | | | | | | | | Usually, it's unit tests that do this, and it's not really crucial to kill those off, but checkers do complain, including sider if you touch anything in one of those files. In SCons/Environment,py, removed all SCons.Util prefixes, than turned the import of Util into a star import, running a tool on that then changes it to import only the used symbols from Util. Since there are lots, that ought to be a small performance win, since it doesn't have to do namespace lookups on SCons.Util. Signed-off-by: Mats Wichmann <mats@linux.com>
* Update some copyright strings and drop __revision__ [skip appveyor]Mats Wichmann2020-09-231-4/+2
| | | | | | | | | | | | | | | | | | 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>
* Run autoflake on codeMats Wichmann2020-09-211-1/+0
| | | | | | | | | | Eliminate unneeded imports, and a few unneeded statements - usually "pass" where it is not syntactically needed. A couple of import try blocks were eliminated or changed when they're "cannot happen" due to current floor Python version. 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/+83
with current python packaging practices