summaryrefslogtreecommitdiff
path: root/SCons/Node
Commit message (Collapse)AuthorAgeFilesLines
* Add some cheap return and parameter annotationsMats Wichmann2023-05-018-395/+395
| | | | | | | | | | | | | | | | | 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>
* Address feedback from mwichmann in PRWilliam Deegan2022-12-201-4/+11
|
* Fixed using --diskcheck=none from command line. It was always broken. ↵William Deegan2022-12-191-17/+24
| | | | SetOption('diskcheck','none') has been working all along. Also refactored the DiskChecker class to have more meaningful properties and not shadow default python objects (list, dir)..
* Minor doc update for Value nodes [skip appveyor]Mats Wichmann2022-10-212-9/+16
| | | | | | | | | | | | Add a "changed in version 4.0" for a past change. Fiddled some docstrings. Tweaked docstring for env.Tool as well - proximity in the files was the motivation (it's just above in Environment.xml) - trying to get to a consistent added/changed notation format, following the Sphinx docstring directive style. Signed-off-by: Mats Wichmann <mats@linux.com>
* Update the Glob docs with more detailsMats Wichmann2022-09-161-31/+35
| | | | | | | | | Covers xml file for manpage, very minor stuff in uguide, and docstring in code. Also tweaked Ignore manpage entry, only because it was the very next description in Environment.xml and caught the eye. Signed-off-by: Mats Wichmann <mats@linux.com>
* doc: change five functions to appear global-onlyMats Wichmann2022-09-142-2/+2
| | | | | | | | | | | | | The five functions EnsureSConsVersion, EnsurePythonVersion, Exit, GetLaunchDir, SConscriptChdir were listed as both global and environment functions, but they do nothing in the context of an environment, so marked in the xml as "global". This only changes the presentation in the manpage & userguide appendix, not the behavior. Minor tweaks in the code around SConscriptChdir - actually use a bool True/False instead of 0/1, and added a couple of type annotations. Signed-off-by: Mats Wichmann <mats@linux.com>
* get_timestamp returns an int againMats Wichmann2022-05-061-4/+4
| | | | | | | | dropped the use of stat.st_mtime, which returns a float, didn't remeber to change the annotation back to int. Added a couple of other return-type annotations. Signed-off-by: Mats Wichmann <mats@linux.com>
* Revert to using stat.ST_MTIME in FS nodes for nowMats Wichmann2022-05-062-3/+3
| | | | | | | | | | | Part of the change to restore mtime checking of symlinked sources flipped from statobj[stat.ST_MTIME] to statobj.st_mtime. These return "the same thing" but the latter returns a float instead of an int. This had some unexpected side effects - like failing a half-dozen testcases. In the interest of moving the bugfix along, revert this piece and deal with it some other time. Signed-off-by: Mats Wichmann <mats@linux.com>
* Fix content-timestamp decider for symlinksMats Wichmann2022-05-062-21/+15
| | | | | | | | | | | | | | | | The base filesystem node class has getmtime() and getsize() functions. Those were changed in an early commit to use the lstat() method if the node represented a symbolic link. However, we actually want the information of the file the symlink points to, or we can't detect changes to the mtime or size of the underlying file, and miss rebuilds if content-timestamp is used. Added a testcase which shows the failure to rebuild from the symlinked source. Fixes #3880 Signed-off-by: Mats Wichmann <mats@linux.com>
* Use super call instead of direct class callMats Wichmann2022-03-155-13/+13
| | | | | | | | | - super used where direct call to superclass existed - convert a few older-style super() (two-argument) uses - in a few places, where there was an intersection with a super change, variables that override a builtin (e.g. "dict") were renamed. Signed-off-by: Mats Wichmann <mats@linux.com>
* Passes tests in >= python 3.9Jacob Cassagnol2021-11-021-2/+2
| | | | | | | | | | | Refactored code to match PR requirements Changed result ==... result== to result in(...) Updated the man page to reference the defaulting behavior for FIPS machines. Updated a typo and design of change in the CHANGES.txt file Made an ugly bit of code in Util.py that fixes it so python3.9 has MD5 support enabled in FIPS mode. The code is much more ugly than before, with the tradeoff being it's testable and usable. In python >= 3.9, SCons will now always default to MD5. Next commit will work on getting the tests to auto-skip the md5-required steps on versions <= python 3.8.
* Half the failing testcases fixed.Jacob Cassagnol2021-11-011-2/+2
| | | | | | | | | | | | | | Still failing on: SCons/UtilTests.py test/Configure/ConfigureDryRunError.py test/Configure/implicit-cache.py test/Configure/option--config.py test/option/hash-format.py test/option/option-n.py test/question/Configure.py These tests all have hardcoded md5 sums or use md5 directly Next commit should fix it so the md5-specific tests are skipped if fips mode detected. Also will figure out a way around the hardcoded m5sums.
* Merge branch 'master' into ninja-generationWilliam Deegan2021-07-091-5/+6
|\
| * Fix an incorrect return-type annotationMats Wichmann2021-06-131-5/+6
| | | | | | | | | | | | | | | | | | | | An earlier change added "-> str" to get_max_drift_csig's function sig. However, it can also return None, so the proper annotation is "-> Optional[str]". Also sorted the file inclusions. Signed-off-by: Mats Wichmann <mats@linux.com>
* | Merge branch 'master' into ninja-generationWilliam Deegan2021-05-244-27/+42
|\ \ | |/
| * Merge branch 'master' into importsWilliam Deegan2021-05-061-7/+0
| |\
| | * Drop overridden changed_since_last_build method in Value classMats Wichmann2021-05-061-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Value defined this method, but the __init__ methos also does "self.changed_since_last_build = 6" to set an index into the decider map, meaning no instance of Value will ever see that function. The map index will cause picking the "real" function, changed_since_last_build_python(), which has identical impl to the now removed method. Signed-off-by: Mats Wichmann <mats@linux.com>
| * | Fix several sider complaintsMats Wichmann2021-05-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately, this made for more reformatting - sider complains in some of these about indent not being a multiple of four because one line of a block was touched, to eliminate had to reindent the whole block, including all the lines not touched by the original commit. Used a tool... Signed-off-by: Mats Wichmann <mats@linux.com>
| * | Fix some imports and other checker warningsMats Wichmann2021-05-052-14/+7
| |/ | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| * Reformat LocalFS to quiet sider complaintsMats Wichmann2021-05-031-3/+26
| | | | | | | | Signed-off-by: Mats Wichmann <mats@linux.com>
| * Some code modernizatoionMats Wichmann2021-05-031-4/+6
| | | | | | | | | | | | | | | | | | Remove obsolete __getslice__ and __setslice_ definitions add Node.fs.scandir to call new (Py3.5) os.scandir Node.fs.makedirs now passes the exist_ok flag Cachedir creation now uses this fs.makedirs with exist_ok=True Signed-off-by: Mats Wichmann <mats@linux.com>
| * Merge pull request #3825 from grossag/topic/grossag/pythondynamicscanWilliam Deegan2021-04-181-1/+4
| |\ | | | | | | Teach the Python scanner to find generated files and directories
| | * Merge branch 'master' into topic/grossag/pythondynamicscanAdam Gross2021-01-095-46/+47
| | |\
| | * | Some initial fixesAdam Gross2020-11-161-5/+1
| | | |
| | * | First draft of teaching Python scanner about dynamic filesAdam Gross2020-11-131-1/+8
| | | |
* | | | fix broken target check in ninja_execute. It was improperly adding all nodes ↵William Deegan2021-04-131-1/+1
| | | | | | | | | | | | | | | | to NINJA_STATE.add_build(). Instead of only ones which weren't ninja files, nor conftest files
* | | | Add API to see if a node has a given attribute stored in node.attributesWilliam Deegan2021-04-131-0/+5
|/ / /
* | | Added support for passing custom CacheDir classes.Daniel Moody2021-04-011-3/+4
| | |
* | | remove extra spacesDillan Mills2021-03-171-2/+2
| | |
* | | Add support for TARGET.relpath propertyDillan Mills2021-03-171-3/+14
| | |
* | | Merge branch 'master' into topic/grossag/newhashesWilliam Deegan2021-03-072-5/+4
|\ \ \
| * | | For systems with symlink, use existing Base.lstat()'s logic instead of ↵William Deegan2021-01-211-4/+3
| | | | | | | | | | | | | | | | repeating it. Also use False return value to indicate false, instead of 0
| * | | Work around Py3.10 optimizing out a builder testMats Wichmann2021-01-121-1/+1
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BuilderBase class traps __bool__ call and raises InternalError. On Py 3.10a the unit test for this got optimized out, avoid this. While we're at it, eliminate remaining references to __nonzero__, which was a Py2-ism, replaced by __bool__. Closes #3860 Signed-off-by: Mats Wichmann <mats@linux.com>
* | | Merge branch 'master' into topic/grossag/newhashesWilliam Deegan2020-12-145-32/+42
|\ \ \ | |/ /
| * | Merge pull request #3384 from dragon512/fix/valuenode-contentWilliam Deegan2020-12-141-1/+2
| |\ \ | | | | | | | | Fix value node when used as part of a build on python3
| | * | Fix value node when used as part of a build on python3Unknown2020-06-151-1/+2
| | | |
| * | | Merge pull request #3817 from grossag/topic/grossag/clearcachednodeinfoWilliam Deegan2020-12-133-4/+15
| |\ \ \ | | | | | | | | | | Fix invalid cache state when using SCons interactive mode
| | * | | Remove one unnecessary part of a testAdam Gross2020-10-211-1/+0
| | | | |
| | * | | Fix invalid cache state when using SCons interactive modeAdam Gross2020-10-213-4/+16
| | | |/ | | |/| | | | | | | | | | | | | | | | | | | | | | | | | SCons.Node.Node.clear() had code to clear cache-related state but it was only clearing a non-unused variable _calculated_sig. Fix this by clearing the three variables now used in practice by get_cachedir_bsig() and the functions that it calls: `cachedir_csig`, `cachesig`, and `contentsig`. Also reset `cached` to 0 because the task scheduler depends on it but doesn't reset it.
| * | | [PR #3833] change another place where file might not existMats Wichmann2020-12-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | belt-and-suspenders: earlier check for file size should already have filtered out the "not rexists" case, but just to be sure, return NOFILE marker here as well. Signed-off-by: Mats Wichmann <mats@linux.com>
| * | | Make the sig for missing file differ from empty fileMats Wichmann2020-11-242-28/+25
| | | | | | | | | | | | | | | | | | | | | | | | Fixes #3014 Signed-off-by: Mats Wichmann <mats@linux.com>
* | | | Merge branch 'master' into topic/grossag/newhashesWilliam Deegan2020-12-122-8/+4
|\ \ \ \ | |/ / /
| * | | Drop yet more py2 compatibility stuffMats Wichmann2020-11-192-12/+4
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A checker flagged the zip_longest/izip_longest workaround, that's no longer needed. Similar for the shutil.SameFileError piece, that's standard since 3.4 and doesn't need checking for. The checker also complained about return contents.decode('utf-8', error='backslashreplace') the correct kward is errors, not error - corrected. Signed-off-by: Mats Wichmann <mats@linux.com>
* | | Merge branch 'master' into topic/grossag/newhashesAdam Gross2020-11-068-109/+65
|\ \ \ | |/ /
| * | [PR #3815] change per reveiw: drop unneeded try block in Python nodeMats Wichmann2020-10-131-7/+2
| | | | | | | | | | | | Signed-off-by: Mats Wichmann <mats@linux.com>
| * | Drop some more Py2 compat thingsMats Wichmann2020-10-132-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change exception type in a a couple of try block to what could go wrong, Py3 would not raise UniCodeDecodeError for these cases One try-import of StringIO module sconsign does not need a decode that was claimed as compat hack Remove some sys.version_info checks Use more modern way to get Python details in test frawmework AddMethod updated and RenameFunction dropped - it had become a one-liner and had no clients other than AddMethod (never exposed as public) Signed-off-by: Mats Wichmann <mats@linux.com>
| * | Update some copyright strings and drop __revision__ [skip appveyor]Mats Wichmann2020-09-238-76/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-214-19/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Fix one merge issue and the test I added yesterdayAdam Gross2020-08-042-7/+7
| | |
* | | Add support for overriding the default hash formatAdam Gross2020-08-043-16/+16
|/ / | | | | | | | | | | | | This change adds support for a new --hash-format parameter that can be used to override the default hash format used by SCons. The default remains MD5, but this allows consumers to opt into SHA1, SHA256, or any other hash algorithm offered by their implementation of hashlib.