SCons: Add unobtrusive type hints in SCons files

This commit is contained in:
Thaddeus Crews 2024-06-11 15:19:07 -05:00
parent 0a9d8f04c1
commit 9f9ee0c813
No known key found for this signature in database
GPG Key ID: 62181B86FE9E5D84
173 changed files with 290 additions and 6 deletions

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
EnsureSConsVersion(3, 1, 2)
EnsurePythonVersion(3, 6)

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
import os
from pathlib import Path

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -0,0 +1,98 @@
"""
Adds type hints to SCons scripts. Implemented via
`from misc.utility.scons_hints import *`.
This is NOT a 1-1 representation of what the defines will represent in an
SCons build, as proxies are almost always utilized instead. Rather, this is
a means of tracing back what those proxies are calling to in the first place.
"""
from typing import TYPE_CHECKING
if TYPE_CHECKING:
# ruff: noqa: F401
from SCons.Action import Action
from SCons.Builder import Builder
from SCons.Defaults import Chmod, Copy, CScan, DefaultEnvironment, Delete, DirScanner, Mkdir, Move, Touch
from SCons.Environment import Base
from SCons.Platform import Platform
from SCons.Platform.virtualenv import Virtualenv
from SCons.Scanner import FindPathDirs, ScannerBase
from SCons.Script import ARGLIST, ARGUMENTS, BUILD_TARGETS, COMMAND_LINE_TARGETS, DEFAULT_TARGETS
from SCons.Script.Main import (
AddOption,
BuildTask,
CleanTask,
DebugOptions,
GetBuildFailures,
GetOption,
PrintHelp,
Progress,
QuestionTask,
SetOption,
ValidateOptions,
)
from SCons.Script.SConscript import Configure, Return, SConsEnvironment, call_stack
from SCons.Script.SConscript import SConsEnvironment as Environment
from SCons.Subst import SetAllowableExceptions as AllowSubstExceptions
from SCons.Tool import CScanner, DScanner, ProgramScanner, SourceFileScanner, Tool
from SCons.Util import AddMethod, WhereIs
from SCons.Variables import BoolVariable, EnumVariable, ListVariable, PackageVariable, PathVariable, Variables
# Global functions
GetSConsVersion = SConsEnvironment.GetSConsVersion
EnsurePythonVersion = SConsEnvironment.EnsurePythonVersion
EnsureSConsVersion = SConsEnvironment.EnsureSConsVersion
Exit = SConsEnvironment.Exit
GetLaunchDir = SConsEnvironment.GetLaunchDir
SConscriptChdir = SConsEnvironment.SConscriptChdir
# SConsEnvironment functions
Default = SConsEnvironment(DefaultEnvironment()).Default
Export = SConsEnvironment(DefaultEnvironment()).Export
Help = SConsEnvironment(DefaultEnvironment()).Help
Import = SConsEnvironment(DefaultEnvironment()).Import
SConscript = SConsEnvironment(DefaultEnvironment()).SConscript
# Environment functions
AddPostAction = DefaultEnvironment().AddPostAction
AddPreAction = DefaultEnvironment().AddPreAction
Alias = DefaultEnvironment().Alias
AlwaysBuild = DefaultEnvironment().AlwaysBuild
CacheDir = DefaultEnvironment().CacheDir
Clean = DefaultEnvironment().Clean
Command = DefaultEnvironment().Command
Decider = DefaultEnvironment().Decider
Depends = DefaultEnvironment().Depends
Dir = DefaultEnvironment().Dir
Entry = DefaultEnvironment().Entry
Execute = DefaultEnvironment().Execute
File = DefaultEnvironment().File
FindFile = DefaultEnvironment().FindFile
FindInstalledFiles = DefaultEnvironment().FindInstalledFiles
FindSourceFiles = DefaultEnvironment().FindSourceFiles
Flatten = DefaultEnvironment().Flatten
GetBuildPath = DefaultEnvironment().GetBuildPath
Glob = DefaultEnvironment().Glob
Ignore = DefaultEnvironment().Ignore
Install = DefaultEnvironment().Install
InstallAs = DefaultEnvironment().InstallAs
InstallVersionedLib = DefaultEnvironment().InstallVersionedLib
Literal = DefaultEnvironment().Literal
Local = DefaultEnvironment().Local
NoCache = DefaultEnvironment().NoCache
NoClean = DefaultEnvironment().NoClean
ParseDepends = DefaultEnvironment().ParseDepends
Precious = DefaultEnvironment().Precious
PyPackageDir = DefaultEnvironment().PyPackageDir
Repository = DefaultEnvironment().Repository
Requires = DefaultEnvironment().Requires
SConsignFile = DefaultEnvironment().SConsignFile
SideEffect = DefaultEnvironment().SideEffect
Split = DefaultEnvironment().Split
Tag = DefaultEnvironment().Tag
Value = DefaultEnvironment().Value
VariantDir = DefaultEnvironment().VariantDir
env: SConsEnvironment
env_modules: SConsEnvironment

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
import os

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,6 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,5 +1,6 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import('env')
Import("env")
env.add_source_files(env.modules_sources, "*.cpp")

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import('env')
Import("env")
env.add_source_files(env.modules_sources, "*.cpp")

View File

@ -1,5 +1,6 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import('env')
Import("env")
env.add_source_files(env.modules_sources, "*.cpp")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
import build_scripts.mono_configure as mono_configure

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_openxr")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_openxr")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_openxr")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")

Some files were not shown because too many files have changed in this diff Show More