summaryrefslogtreecommitdiff
path: root/SCons/Scanner
Commit message (Collapse)AuthorAgeFilesLines
* Add some cheap return and parameter annotationsMats Wichmann2023-05-0117-216/+216
| | | | | | | | | | | | | | | | | 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>
* dictify_CPPDEFINES: also handle single tupleMats Wichmann2023-03-222-22/+60
| | | | | | | | | | | * Single-tuple CPPDEFINES was not handled. * Add some more unit tests. * Add some comments - that we need to keep in sync with processDefines, but don't actually call it (the routine *could* be rewritten to process the result of processDefines instead of the bare CPPDEFINES, but currently doesn't do that). Signed-off-by: Mats Wichmann <mats@linux.com>
* Fix dictifyCPPDEFINES handlong of macro stringsMats Wichmann2023-03-212-34/+85
| | | | | | | | | | | | | | | | | CPPDEFINES can contain name=value strings, either a single one, or one or more in a sequence type. After conversion (subsequent Append/Prepend to CPPDEFINES), these will be stored as tuples, but it is possible to hit cases where the type conversion has never been triggered. The C Scanner has its own routine to process CPPDEFINES, and missed these cases, which are now handled. The testcases in issue 4193 which showed this problem are now included in the C scanner unit tests, and the test for dictifyCPPDEFINES is expanded to check these two forms. Fixes #4193 Signed-off-by: Mats Wichmann <mats@linux.com>
* feat: adds JAVAPROCESSORPATH construction variable; updates JavaScanner to ↵djh2023-01-132-4/+69
| | | | scan JAVAPROCESSORPATH
* Add Java scanner to generated API docsMats Wichmann2022-10-201-6/+8
| | | | Signed-off-by: Mats Wichmann <mats@linux.com>
* Java scanner: fixes per review commentsMats Wichmann2022-10-181-1/+9
| | | | Signed-off-by: Mats Wichmann <mats@linux.com>
* Java scanner don't split JAVACLASSPATH on spaceMats Wichmann2022-10-172-35/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The scanner now splits JAVACLASSPATH before searching only if it is passed as a scalar (string); it no longer recurses to split elements of a list value - this is more consistent with other SCons usage. No longer splits on space, rather splits on os.pathsep, as considerably more useful for a search-path variable. The latter change avoids breaking paths with an embedded space (usually from Windows). This is a "breaking change" from the new behavior introduced in 4.4 where a JAVACLASSPATH like "aaa bbb ccc" would have been split into ["aaa", "bbb", "ccc"] - now it will be left unchanged in the scanner. However a JAVACLASSPATH like "aaa;bbb;ccc" will now be split into ["aaa", "bbb", "ccc"]. This behavior only affects the scanner - there is no change in how JAVACLASSPATH gets transformed into the "-classpath ARG" argument when calling JDK elements. The former behavior was presumably unintended, and definitely broke on a space-containing path (e.g. "My Classes". The unit test is expanded to test for a path string with spaces, and for a path string containing a search-path separator. Documentation tweaks: explain better how JAVACLASSPATH (and the other two Java path variables) can be specified, and whether or not SCons changes them before calling the JDK commands. Added note that JAVABOOTCLASSPATH is no longer useful, and a note about the side effect that SCons always supplies a "-sourcepath" argument when calling javac. Fixes #4243 Signed-off-by: Mats Wichmann <mats@linux.com>
* Merge branch 'master' into 4162-python-311-unittestsMats Wichmann2022-05-302-0/+259
|\
| * Merge remote-tracking branch 'upstream/master' into ↵William Deegan2022-05-1418-311/+402
| |\ | | | | | | | | | feature/minor_java_improvements
| * | Fix file headerWilliam Deegan2022-05-141-4/+2
| | |
| * | feat: adds minor java improvementsdjh2021-07-052-0/+261
| | |
* | | Fix some Py 3.11 depr warns in testsMats Wichmann2022-05-301-1/+3
| |/ |/| | | | | | | | | | | | | | | A couple of unittest methods that a few SCons tests use have been marked deprecated in Python 3.11, with replacements provided. Partial fix for #4162, do not close just off this PR. Signed-off-by: Mats Wichmann <mats@linux.com>
* | Fix dictify_CPPDEFINES execeptionMats Wichmann2022-03-032-2/+19
| | | | | | | | | | | | | | | | | | | | In converting CPPDEFINES to a dict, if an element is a single-item sequence c, it would take an IndexError trying to access c[1]. This could happen if AppendUnique has been called as it converts to tuples. Fixes #4108 Signed-off-by: Mats Wichmann <mats@linux.com>
* | Slider caught some bugs introduced in prior commitJacob Cassagnol2021-11-091-5/+5
| | | | | | | | | | Accidentally added two unused format strings. Also referenced a variable from a copy-paste error.
* | Normalized all sconsfiles and sub-sconsfiles to use algorithm if not ↵Jacob Cassagnol2021-11-092-20/+42
| | | | | | | | | | | | | | | | | | defaulted to md5. Dir search now excludes all types of sconsfiles that are now created. Environment now defaults to the current scons filename instead of .sconsfile Sconsign now has a function used by a lot of code that gets the default sconsign filename Any tests referring to .sconsfile have now been changed, including one old legacy test.
* | Change SCons.Scanner.Base to ScannerBaseMats Wichmann2021-10-046-94/+91
| | | | | | | | | | | | | | | | | | | | Maintenance: SCons has multiple classes named Base, which is a bit unfortunate. Some already use a context-qualified name, like BuilderBase, which seems preferable. Do that for ScannerBase, but leave the name Base in the SCons.Scanner package in case *external* users are depending on SCons.Scanner.Base working. SCons internally no longer uses that name. Signed-off-by: Mats Wichmann <mats@linux.com>
* | Scanner tweaksMats Wichmann2021-10-041-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Restore original behavior in Base.__call__Mats Wichmann2021-07-241-12/+7
| | | | | | | | | | | | A previous commit changed some of the existing logic incorrectly. Signed-off-by: Mats Wichmann <mats@linux.com>
* | [PR #3963] small review changes [ci skip]Mats Wichmann2021-07-241-2/+2
| | | | | | | | Signed-off-by: Mats Wichmann <mats@linux.com>
* | [PR #3863] Fix sider complaintsMats Wichmann2021-07-242-2/+7
| | | | | | | | Signed-off-by: Mats Wichmann <mats@linux.com>
* | Scanner tweaksMats Wichmann2021-07-2417-206/+257
|/ | | | | | | | | | | | | 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>
* Merge pull request #3825 from grossag/topic/grossag/pythondynamicscanWilliam Deegan2021-04-182-43/+150
|\ | | | | Teach the Python scanner to find generated files and directories
| * Address review feedbackAdam Gross2021-01-091-4/+5
| | | | | | | | Better handle relative imports if no paths are provided.
| * Fix tests, implement smarter version of scannerAdam Gross2020-11-172-45/+142
| |
| * Fix all testsAdam Gross2020-11-161-12/+10
| | | | | | | | This change fixes all tests. It's still a a WIP change because I think the "imports" logic is wrong for file imports.
| * [ci skip] Some fixes to the Python scanner and testAdam Gross2020-11-161-34/+42
| |
| * Fix up scanner a bitAdam Gross2020-11-161-6/+10
| | | | | | | | Tests still break
| * Some initial fixesAdam Gross2020-11-161-25/+32
| |
| * First draft of teaching Python scanner about dynamic filesAdam Gross2020-11-131-30/+22
| |
* | Drop dictionary has_key references: Py2-ism.Mats Wichmann2021-03-114-5/+5
|/ | | | | | | | | | | | | | In some cases, added a __contains__ method instead, not because it necessarily was needed, but for completeness. Also one completely unrelated change because it happened to be sitting modified in the tree when I committed modified files: be a little more cautious about building CHECK_METHODS in our subclassing of the optparse Option class... current cpython starts it at None, then fills it in, so it shouldn't be None when we subclass. Signed-off-by: Mats Wichmann <mats@linux.com>
* Update some copyright strings and drop __revision__ [skip appveyor]Mats Wichmann2020-09-2322-264/+186
| | | | | | | | | | | | | | | | | | 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-217-7/+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>
* Simplify more tests to use unittest.mainMats Wichmann2020-08-251-7/+0
| | | | | | | For issue #3113, but does not complete it - there are still uses of TestSuite where the "simple fix" from the issue requires more thought. Signed-off-by: Mats Wichmann <mats@linux.com>
* Rename some doc files; Packaging doc fixups [skip appveyor]Mats Wichmann2020-07-251-0/+0
| | | | | | | | | | | | | | | | | | | | | Renamed those documentation files named __init__.xml to the name of the component directory. Merged SCons/Tool/packaging.xml (which had no unique content) into the renamed SCons/Tool/packaging/packaging.xml Considerable rework was needed to the packaging content to fill in some gaps: * properly named the commandline option * add the option to the manpage (with a note it's not always avail) * only list the packagers once * add example of selecting packaging tool, and of specifying multiple packagers * more description of source, target and metadata for Packaging * mention use of PACKAGEROOT * redo tag description * add a bit of explanation to the complete packaging example Signed-off-by: Mats Wichmann <mats@linux.com>
* classes no longer explicitly inherit from objectMats Wichmann2020-05-249-23/+23
| | | | | | In Python3 this is the default. Signed-off-by: Mats Wichmann <mats@linux.com>
* [WIP] adjust docbuild for moved src [ci skip]Mats Wichmann2020-05-101-5/+5
| | | | | | | src/engine/SCons moved to SCons, affects wired in paths in documentation, and doc building scripts 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-0622-0/+5566
with current python packaging practices