summaryrefslogtreecommitdiffstats
path: root/SCons/Util.py
Commit message (Collapse)AuthorAgeFilesLines
* Added some comments for ninja updates.Daniel Moody2022-03-141-8/+10
|
* Added ninja mingw support and improved CommandGeneratorAction supportDaniel Moody2022-02-241-1/+1
|
* Merge pull request #4077 from SergBobrovsky/patch-4William Deegan2021-12-191-1/+1
|\ | | | | Update Util.py
| * Update Util.pySergBobrovsky2021-12-191-1/+1
| |
| * Update Util.pySergBobrovsky2021-12-191-1/+1
| | | | | | | | It looks like here is the only call of containsOnly(). This func looks a bit confusing: name like containsAll/Any, same signature but other semantics. So I propose to kick it out at all, with tests )
* | Merge pull request #4076 from SergBobrovsky/patch-3William Deegan2021-12-191-8/+2
|\ \ | | | | | | Update Util.py
| * | Update Util.pySergBobrovsky2021-12-191-8/+2
| |/ | | | | | | all() and any() are `Built-in Functions`. https://docs.python.org/3/library/functions.html#built-in-funcs.
* | Update Util.pySergBobrovsky2021-12-191-1/+1
|/ | | Calling dict() is redundant here.
* Tests pass in python 3.6 and 3.9 in LinuxJacob Cassagnol2021-11-091-31/+47
| | | | | | | | | | | | | | | Modified failing tests to use the new defaulted .sconsign database based on the hash algorithm For MD5, default database will be .sconsign.dblite For other algorithms the default will be .sconsign_<hashname>.dblite. For all cases where the user changes the hash algorithm used, the database will be .sconsign_<hashname>.dblite (including md5) For sub-scons directories it remains as .sconsign Also added unit-tests for Util.py for the new hash default changes. It's difficult to setup a fips-compliant platform using containers, and instead we mock that. option--config uses multiple types of hash algorithms so was skipped. Removed one f-string (python 3.5 doesn't support those) Corrupt.py is using an explicit .sconsign so that was left as-is, and only the parent default .sconsign was changed for work test 1. A fetch-database name option was added to the testing framework. The unlink_sconsignfile was not updated as no usages of it were found.
* Changed the fall-forward to an explicit version check instead.Jacob Cassagnol2021-11-041-15/+10
| | | | | | The original check was causing issues where 3.8 in Windows was throwing an unexpected error. This should hopefully fix 3.8 in Windows while maintaining the same support in Linux.
* This should fix the Slider issues identified.Jacob Cassagnol2021-11-021-7/+7
|
* Passes tests in >= python 3.9Jacob Cassagnol2021-11-021-14/+65
| | | | | | | | | | | 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.
* Code now works during FIPS mode.Jacob Cassagnol2021-11-011-6/+87
| | | | Test suite currently failing with FIPS enabled due to hard-coded MD5 tests.
* Update NodeList to get rid of old workaroundMats Wichmann2021-10-281-20/+14
| | | | | | | | The NodeList had code to sort of manually build up a new list due to some issues over slicing in very early Python 3. Added some return-type annotations. Signed-off-by: Mats Wichmann <mats@linux.com>
* Fix initialization of CLVarRyan Egesdahl2021-08-311-1/+1
| | | | | | | | Prior to commit 69dcebbd, CLVar could be initialized with no arguments, which would set its default value to an empty list. After that commit, the default value is a list with a single `None` element. This commit reverts CLVar back to the previous default value while preserving the intent of the original commit.
* [PR #3953] wrong return type on dictify() [ci skip]Mats Wichmann2021-06-091-1/+1
| | | | Signed-off-by: Mats Wichmann <mats@linux.com>
* [PR #3953] a few more Util tweaks [ci skip]Mats Wichmann2021-06-091-61/+106
| | | | | | | | | Return types on a few more funcs Use a __doc__ assignment for funcs that have per-platform implementations. Cygwin get_native_path now uses subprocess for its call. doctest examples added to CLVar docstring. Signed-off-by: Mats Wichmann <mats@linux.com>
* Address comments in PRWilliam Deegan2021-06-091-4/+8
|
* PR #3953: quiet sider complaintsMats Wichmann2021-06-081-16/+24
| | | | | | | Also remove a bit of syntax that was not introduced until Py3.8 - the use of a / as an argument in a function signature. Signed-off-by: Mats Wichmann <mats@linux.com>
* Reduce pylint complaints about UtilMats Wichmann2021-06-071-496/+636
| | | | | | | | | | | | | | | | | | | Fix up UniqueList - remves a Py2-era method and correct args on others; add a __repr__ which does the uniquing. Add "we know what we're doing" pylint comments on apparent redefinitions of builtins and globals that the type tests and type converters do. Add some more pylint comments on "local" (rather than top of file) imports. Remove WindowsError reference (necessitated changing some tool code as well) - partial fix for #3939, WinodwsError is no longer distinct Simplified semi-deepcopy stuff (and quieted complaints) Add class docstrings and fixup some docstrings. AddMethod examples had reversed arguments - now rendered as a doctest, and actually works. Fixed up other examples to (mostly) be doctest as well. Signed-off-by: Mats Wichmann <mats@linux.com>
* Some code modernizatoionMats Wichmann2021-05-031-6/+0
| | | | | | | | | 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>
* Avoid exception if tool set to emptyMats Wichmann2021-04-231-3/+9
| | | | | | | | | | | | | | When the reproducer in issue #1742 was run on git head, it failed in a different way than in the issue: an exception "list index out of range", caused by the test setting CC="" in the Environment call(). While this is a rather unuseful thing to do in general, the resulting call to env.WhereIs should not throw an exception because the general WhereIs function ends up indexing into something that can't be indexed. Avoid this by returning None immediately if the list of names to look for is empty. Note this does _not_ fix issue 1742, it just avoids the new problem it was failing on. Signed-off-by: Mats Wichmann <mats@linux.com>
* Add a __iadd__ method to CLVar to support inplace addsMats Wichmann2021-03-281-7/+23
| | | | | | | | | | | | | | | | Added a test for in-place adding of a string containing multiple words. The CLVar testcase in UtilTests is converted to use multicharacter argument words to tickle the parent class's tendency to do "list()" directly on an argument - overriding that behavior, but only for strings, is the whole purpose of the class. That is, "bbb" should not become ['b', 'b', 'b'] but instead ["bbb"]. We wouldn't see if that was happening when all the words in the test were single-character. Fixes #2399 Signed-off-by: Mats Wichmann <mats@linux.com>
* Merge pull request #3899 from mwichmann/shlib-tweaksWilliam Deegan2021-03-181-7/+18
|\ | | | | Don't chop some shlib names in _get_shlib_stem and adjustixes
| * remove logic to handle (for example) library name where the library name ↵William Deegan2021-03-151-3/+7
| | | | | | | | matches the expected library suffix (for example so for a shared library.) Not worth checking for very unusual and bad practice
| * need to always get the file name if pre or suf is defined when calling ↵William Deegan2021-03-141-7/+9
| | | | | | | | adjustixes. Note: This could have a perf impact
| * Added unittest for changes to SCons.Util.adjustixes() to handle when ↵William Deegan2021-03-141-1/+6
| | | | | | | | filename=prefix or filename=suffix and still prepend and append prefix and suffix respectively
| * Handle library (or any files) named just they're *PREFIX for their type. ↵William Deegan2021-03-141-1/+1
| | | | | | | | Don't truncate them to blank string
* | PR #3898: address review commentsMats Wichmann2021-03-111-2/+2
| | | | | | | | | | | | | | | | Sider fix - repeated __contains__ in one test Simplify __contains__ in Environment Add comment on performance hack in the two uniquer functions Signed-off-by: Mats Wichmann <mats@linux.com>
* | Drop dictionary has_key references: Py2-ism.Mats Wichmann2021-03-111-7/+6
|/ | | | | | | | | | | | | | 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>
* Merge branch 'master' into topic/grossag/newhashesWilliam Deegan2021-03-071-6/+6
|\
| * Add timing of sconsign write if --debugMats Wichmann2021-02-081-0/+5
| | | | | | | | | | | | | | | | | | | | | | A line is now emitted showing sconsign sync time if --debug=time Some calls to time.time replaced with time.perf_counter, where the objective was to time sections of code (i.e. where there wasn't an actual need to get time-since-epoch) - Python recommends this as getting the best-available timer. Signed-off-by: Mats Wichmann <mats@linux.com>
| * Work around Py3.10 optimizing out a builder testMats Wichmann2021-01-121-6/+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>
* | Fix sider errorAdam Gross2020-12-151-5/+2
| | | | | | | | | | | | Now that we have a much more limited selection of supported algorithms, I don't need the code to actually call the hash function in set_hash_format. This also means that I don't need a try/except and can instead use getattr().
* | More improvementsAdam Gross2020-12-151-6/+7
| | | | | | | | | | | | | | 1. Fix failure finding UserError. 2. Fix bad string formatting. 3. Add test case covering passing an invalid hash format. 4. Remove blake2b, as I haven't tested it. We can add it some day if people want it.
* | Address most review feedbackAdam Gross2020-12-141-8/+35
| | | | | | | | Only thing left is to pick a hash format based on the sconsign database name.
* | Merge branch 'master' into topic/grossag/newhashesWilliam Deegan2020-12-141-0/+4
|\ \ | |/
| * Make the sig for missing file differ from empty fileMats Wichmann2020-11-241-0/+4
| | | | | | | | | | | | Fixes #3014 Signed-off-by: Mats Wichmann <mats@linux.com>
* | Change the default sconsign DB file name if the hash is overriddenAdam Gross2020-11-121-3/+15
| | | | | | | | | | | | This was requested in the code review. The sconsign database file name is still .sconsign.dblite if the hash format is not overridden, but if it is, the name will be something like .sconsign_sha256.dblite.
* | Merge branch 'master' into topic/grossag/newhashesAdam Gross2020-11-061-82/+82
|\ \ | |/
| * Fix/update global AddMethodMats Wichmann2020-10-121-56/+76
| | | | | | | | | | | | Fixes #3028 Signed-off-by: Mats Wichmann <mats@linux.com>
| * Remove pywin32 from SCons.Util where it was used for reading registry if not ↵William Deegan2020-10-041-16/+3
| | | | | | | | available via Python's winreg package. It's (long been) part of Python's standard library so using pywin32 as a backup is not necessary
| * Update some copyright strings and drop __revision__ [skip appveyor]Mats Wichmann2020-09-231-9/+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>
| * 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>
* | Fix a few issuesAdam Gross2020-08-041-5/+3
| | | | | | | | Fixes one sider issue and a code error that broke some tests
* | Add support for overriding the default hash formatAdam Gross2020-08-041-42/+121
|/ | | | | | | 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.
* Docstring changes from Sphinx conversion [ci skip]Mats Wichmann2020-05-301-11/+19
| | | | | | | | 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-7/+7
| | | | | | In Python3 this is the default. 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/+1648
with current python packaging practices