Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
From John Doe:
- Whatever John Doe did.

From Thaddeus Crews:
- Implement type hints for Node subclasses.

From William Deegan:
- Fix SCons Docbook schema to work with lxml > 5

Expand Down
2 changes: 2 additions & 0 deletions RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ DEVELOPMENT

- Introduce some unit tests for the file locking utility routines

- Implement type hints for Node subclasses.

Thanks to the following contributors listed below for their contributions to this release.
==========================================================================================
.. code-block:: text
Expand Down
20 changes: 13 additions & 7 deletions SCons/Node/Alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,21 @@
This creates a hash of global Aliases (dummy targets).
"""

from __future__ import annotations

import collections
from typing import TYPE_CHECKING

import SCons.Errors
import SCons.Node
import SCons.Util
from SCons.Util import hash_signature

if TYPE_CHECKING:
from SCons.Node.FS import Dir

class AliasNameSpace(collections.UserDict):
def Alias(self, name, **kw):
def Alias(self, name: str | Alias, **kw) -> Alias:
if isinstance(name, SCons.Node.Alias.Alias):
return name
try:
Expand All @@ -44,7 +50,7 @@ def Alias(self, name, **kw):
self[name] = a
return a

def lookup(self, name, **kw):
def lookup(self, name: str, **kw) -> Alias | None:
try:
return self[name]
except KeyError:
Expand All @@ -66,13 +72,13 @@ class Alias(SCons.Node.Node):
NodeInfo = AliasNodeInfo
BuildInfo = AliasBuildInfo

def __init__(self, name) -> None:
def __init__(self, name: str) -> None:
super().__init__()
self.name = name
self.changed_since_last_build = 1
self.store_info = 0

def str_for_display(self):
def str_for_display(self) -> str:
return '"' + self.__str__() + '"'

def __str__(self) -> str:
Expand All @@ -84,13 +90,13 @@ def make_ready(self) -> None:
really_build = SCons.Node.Node.build
is_up_to_date = SCons.Node.Node.children_are_up_to_date

def is_under(self, dir) -> bool:
def is_under(self, dir: Dir) -> bool:
# Make Alias nodes get built regardless of
# what directory scons was run from. Alias nodes
# are outside the filesystem:
return True

def get_contents(self):
def get_contents(self) -> str:
"""The contents of an alias is the concatenation
of the content signatures of all its sources."""
childsigs = [n.get_csig() for n in self.children()]
Expand Down Expand Up @@ -120,7 +126,7 @@ def convert(self) -> None:
self.reset_executor()
self.build = self.really_build

def get_csig(self):
def get_csig(self) -> str:
"""
Generate a node's content signature, the digested signature
of its content.
Expand Down
Loading
Loading