2626This creates a hash of global Aliases (dummy targets).
2727"""
2828
29+ from __future__ import annotations
30+
2931import collections
32+ from typing import TYPE_CHECKING
3033
3134import SCons .Errors
3235import SCons .Node
3336import SCons .Util
3437from SCons .Util import hash_signature
3538
39+ if TYPE_CHECKING :
40+ from SCons .Node .FS import Dir
41+
3642class AliasNameSpace (collections .UserDict ):
37- def Alias (self , name , ** kw ):
43+ def Alias (self , name : str | Alias , ** kw ) -> Alias :
3844 if isinstance (name , SCons .Node .Alias .Alias ):
3945 return name
4046 try :
@@ -44,7 +50,7 @@ def Alias(self, name, **kw):
4450 self [name ] = a
4551 return a
4652
47- def lookup (self , name , ** kw ):
53+ def lookup (self , name : str , ** kw ) -> Alias | None :
4854 try :
4955 return self [name ]
5056 except KeyError :
@@ -66,13 +72,13 @@ class Alias(SCons.Node.Node):
6672 NodeInfo = AliasNodeInfo
6773 BuildInfo = AliasBuildInfo
6874
69- def __init__ (self , name ) -> None :
75+ def __init__ (self , name : str ) -> None :
7076 super ().__init__ ()
7177 self .name = name
7278 self .changed_since_last_build = 1
7379 self .store_info = 0
7480
75- def str_for_display (self ):
81+ def str_for_display (self ) -> str :
7682 return '"' + self .__str__ () + '"'
7783
7884 def __str__ (self ) -> str :
@@ -84,13 +90,13 @@ def make_ready(self) -> None:
8490 really_build = SCons .Node .Node .build
8591 is_up_to_date = SCons .Node .Node .children_are_up_to_date
8692
87- def is_under (self , dir ) -> bool :
93+ def is_under (self , dir : Dir ) -> bool :
8894 # Make Alias nodes get built regardless of
8995 # what directory scons was run from. Alias nodes
9096 # are outside the filesystem:
9197 return True
9298
93- def get_contents (self ):
99+ def get_contents (self ) -> str :
94100 """The contents of an alias is the concatenation
95101 of the content signatures of all its sources."""
96102 childsigs = [n .get_csig () for n in self .children ()]
@@ -120,7 +126,7 @@ def convert(self) -> None:
120126 self .reset_executor ()
121127 self .build = self .really_build
122128
123- def get_csig (self ):
129+ def get_csig (self ) -> str :
124130 """
125131 Generate a node's content signature, the digested signature
126132 of its content.
0 commit comments