diff options
Diffstat (limited to 'SCons/Node')
-rw-r--r-- | SCons/Node/Alias.py | 18 | ||||
-rw-r--r-- | SCons/Node/AliasTests.py | 7 | ||||
-rw-r--r-- | SCons/Node/FS.py | 31 | ||||
-rw-r--r-- | SCons/Node/FSTests.py | 7 | ||||
-rw-r--r-- | SCons/Node/NodeTests.py | 7 | ||||
-rw-r--r-- | SCons/Node/Python.py | 30 | ||||
-rw-r--r-- | SCons/Node/PythonTests.py | 6 | ||||
-rw-r--r-- | SCons/Node/__init__.py | 68 |
8 files changed, 65 insertions, 109 deletions
diff --git a/SCons/Node/Alias.py b/SCons/Node/Alias.py index 00e3726..b5e4eb4 100644 --- a/SCons/Node/Alias.py +++ b/SCons/Node/Alias.py @@ -1,14 +1,6 @@ - -"""scons.Node.Alias - -Alias nodes. - -This creates a hash of global Aliases (dummy targets). - -""" - +# MIT License # -# __COPYRIGHT__ +# Copyright The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -28,9 +20,11 @@ This creates a hash of global Aliases (dummy targets). # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +"""Alias nodes. + +This creates a hash of global Aliases (dummy targets). +""" import collections diff --git a/SCons/Node/AliasTests.py b/SCons/Node/AliasTests.py index 613a5c0..14662fd 100644 --- a/SCons/Node/AliasTests.py +++ b/SCons/Node/AliasTests.py @@ -1,5 +1,6 @@ +# MIT License # -# __COPYRIGHT__ +# Copyright The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -19,11 +20,7 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import sys import unittest import SCons.Errors diff --git a/SCons/Node/FS.py b/SCons/Node/FS.py index bf0598b..1e5d5b8 100644 --- a/SCons/Node/FS.py +++ b/SCons/Node/FS.py @@ -1,17 +1,6 @@ -"""scons.Node.FS - -File system nodes. - -These Nodes represent the canonical external objects that people think -of when they think of building software: files and directories. - -This holds a "default_fs" variable that should be initialized with an FS -that can be used by scripts or modules looking for the canonical default. - -""" - +# MIT License # -# __COPYRIGHT__ +# Copyright The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -31,7 +20,15 @@ that can be used by scripts or modules looking for the canonical default. # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +"""File system nodes. + +These Nodes represent the canonical external objects that people think +of when they think of building software: files and directories. + +This holds a "default_fs" variable that should be initialized with an FS +that can be used by scripts or modules looking for the canonical default. +""" import fnmatch import os @@ -46,7 +43,7 @@ import importlib.util import SCons.Action import SCons.Debug -from SCons.Debug import logInstanceCreation +from SCons.Debug import logInstanceCreation, Trace import SCons.Errors import SCons.Memoize import SCons.Node @@ -56,8 +53,6 @@ import SCons.Util from SCons.Util import hash_signature, hash_file_signature, hash_collect import SCons.Warnings -from SCons.Debug import Trace - print_duplicate = 0 MD5_TIMESTAMP_DEBUG = False @@ -439,7 +434,7 @@ class EntryProxy(SCons.Util.Proxy): # In PY3 if a class defines __eq__, then it must explicitly provide # __hash__. Since SCons.Util.Proxy provides __eq__ we need the following - # see: https://docs.python.org/3.1/reference/datamodel.html#object.__hash__ + # see: https://docs.python.org/3/reference/datamodel.html#object.__hash__ __hash__ = SCons.Util.Delegate('__hash__') def __get_abspath(self): diff --git a/SCons/Node/FSTests.py b/SCons/Node/FSTests.py index 85f9f0e..457d199 100644 --- a/SCons/Node/FSTests.py +++ b/SCons/Node/FSTests.py @@ -1,5 +1,6 @@ +# MIT License # -# __COPYRIGHT__ +# Copyright The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -19,11 +20,8 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.compat - import os import os.path import sys @@ -1694,7 +1692,6 @@ class FSTestCase(_tempdirTestCase): except AttributeError: # could be python 3.7 or newer, make sure splitdrive can do UNC assert ntpath.splitdrive(r'\\split\drive\test')[0] == r'\\split\drive' - pass path = strip_slash(path) return '//' + path[1:] diff --git a/SCons/Node/NodeTests.py b/SCons/Node/NodeTests.py index 729be01..6e240d4 100644 --- a/SCons/Node/NodeTests.py +++ b/SCons/Node/NodeTests.py @@ -1,5 +1,6 @@ +# MIT License # -# __COPYRIGHT__ +# Copyright The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -20,14 +21,10 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - import SCons.compat import collections -import os import re -import sys import unittest import SCons.Errors diff --git a/SCons/Node/Python.py b/SCons/Node/Python.py index 68c6ee8..0eab05c 100644 --- a/SCons/Node/Python.py +++ b/SCons/Node/Python.py @@ -1,11 +1,6 @@ -"""scons.Node.Python - -Python nodes. - -""" - +# MIT License # -# __COPYRIGHT__ +# Copyright The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -25,9 +20,8 @@ Python nodes. # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +"""Python nodes.""" import SCons.Node @@ -135,7 +129,7 @@ class Value(SCons.Node.Node): self.built_value = self.value return self.built_value - def get_text_contents(self): + def get_text_contents(self) -> str: """By the assumption that the node.built_value is a deterministic product of the sources, the contents of a Value are the concatenation of all the contents of its sources. As @@ -147,24 +141,16 @@ class Value(SCons.Node.Node): contents = contents + kid.get_contents().decode() return contents - def get_contents(self): - """ - Get contents for signature calculations. - :return: bytes - """ - text_contents = self.get_text_contents() - try: - return text_contents.encode() - except UnicodeDecodeError: - # Already encoded as python2 str are bytes - return text_contents + def get_contents(self) -> bytes: + """Get contents for signature calculations.""" + return self.get_text_contents().encode() def changed_since_last_build(self, target, prev_ni): cur_csig = self.get_csig() try: return cur_csig != prev_ni.csig except AttributeError: - return 1 + return True def get_csig(self, calc=None): """Because we're a Python value node and don't have a real diff --git a/SCons/Node/PythonTests.py b/SCons/Node/PythonTests.py index b6fa859..b6a3f79 100644 --- a/SCons/Node/PythonTests.py +++ b/SCons/Node/PythonTests.py @@ -1,5 +1,6 @@ +# MIT License # -# __COPYRIGHT__ +# Copyright The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -19,9 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import unittest diff --git a/SCons/Node/__init__.py b/SCons/Node/__init__.py index d64a468..6a3770e 100644 --- a/SCons/Node/__init__.py +++ b/SCons/Node/__init__.py @@ -1,26 +1,6 @@ -"""SCons.Node - -The Node package for the SCons software construction utility. - -This is, in many ways, the heart of SCons. - -A Node is where we encapsulate all of the dependency information about -any thing that SCons can build, or about any thing which SCons can use -to build some other thing. The canonical "thing," of course, is a file, -but a Node can also represent something remote (like a web page) or -something completely abstract (like an Alias). - -Each specific type of "thing" is specifically represented by a subclass -of the Node base class: Node.FS.File for files, Node.Alias for aliases, -etc. Dependency information is kept here in the base class, and -information specific to files/aliases/etc. is in the subclass. The -goal, if we've done this correctly, is that any type of "thing" should -be able to depend on any other type of "thing." - -""" - +# MIT License # -# __COPYRIGHT__ +# Copyright The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -41,9 +21,25 @@ be able to depend on any other type of "thing." # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +"""The Node package for the SCons software construction utility. + +This is, in many ways, the heart of SCons. + +A Node is where we encapsulate all of the dependency information about +any thing that SCons can build, or about any thing which SCons can use +to build some other thing. The canonical "thing," of course, is a file, +but a Node can also represent something remote (like a web page) or +something completely abstract (like an Alias). + +Each specific type of "thing" is specifically represented by a subclass +of the Node base class: Node.FS.File for files, Node.Alias for aliases, +etc. Dependency information is kept here in the base class, and +information specific to files/aliases/etc. is in the subclass. The +goal, if we've done this correctly, is that any type of "thing" should +be able to depend on any other type of "thing." + +""" -import os import collections import copy from itertools import chain @@ -823,25 +819,21 @@ class Node(object, metaclass=NoSlotsPyPy): def release_target_info(self): """Called just after this node has been marked - up-to-date or was built completely. + up-to-date or was built completely. - This is where we try to release as many target node infos - as possible for clean builds and update runs, in order - to minimize the overall memory consumption. + This is where we try to release as many target node infos + as possible for clean builds and update runs, in order + to minimize the overall memory consumption. - By purging attributes that aren't needed any longer after - a Node (=File) got built, we don't have to care that much how - many KBytes a Node actually requires...as long as we free - the memory shortly afterwards. + By purging attributes that aren't needed any longer after + a Node (=File) got built, we don't have to care that much how + many KBytes a Node actually requires...as long as we free + the memory shortly afterwards. - @see: built() and File.release_target_info() - """ + @see: built() and File.release_target_info() + """ pass - # - # - # - def add_to_waiting_s_e(self, node): self.waiting_s_e.add(node) |