scons_hints.py 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. """
  2. Adds type hints to SCons scripts. Implemented via
  3. `from misc.utility.scons_hints import *`.
  4. This is NOT a 1-1 representation of what the defines will represent in an
  5. SCons build, as proxies are almost always utilized instead. Rather, this is
  6. a means of tracing back what those proxies are calling to in the first place.
  7. """
  8. from typing import TYPE_CHECKING
  9. if TYPE_CHECKING:
  10. # ruff: noqa: F401
  11. from SCons.Action import Action
  12. from SCons.Builder import Builder
  13. from SCons.Defaults import Chmod, Copy, CScan, DefaultEnvironment, Delete, DirScanner, Mkdir, Move, Touch
  14. from SCons.Environment import Base
  15. from SCons.Platform import Platform
  16. from SCons.Platform.virtualenv import Virtualenv
  17. from SCons.Scanner import FindPathDirs, ScannerBase
  18. from SCons.Script import ARGLIST, ARGUMENTS, BUILD_TARGETS, COMMAND_LINE_TARGETS, DEFAULT_TARGETS
  19. from SCons.Script.Main import (
  20. AddOption,
  21. BuildTask,
  22. CleanTask,
  23. DebugOptions,
  24. GetBuildFailures,
  25. GetOption,
  26. PrintHelp,
  27. Progress,
  28. QuestionTask,
  29. SetOption,
  30. ValidateOptions,
  31. )
  32. from SCons.Script.SConscript import Configure, Return, SConsEnvironment, call_stack
  33. from SCons.Script.SConscript import SConsEnvironment as Environment
  34. from SCons.Subst import SetAllowableExceptions as AllowSubstExceptions
  35. from SCons.Tool import CScanner, DScanner, ProgramScanner, SourceFileScanner, Tool
  36. from SCons.Util import AddMethod, WhereIs
  37. from SCons.Variables import BoolVariable, EnumVariable, ListVariable, PackageVariable, PathVariable, Variables
  38. # Global functions
  39. GetSConsVersion = SConsEnvironment.GetSConsVersion
  40. EnsurePythonVersion = SConsEnvironment.EnsurePythonVersion
  41. EnsureSConsVersion = SConsEnvironment.EnsureSConsVersion
  42. Exit = SConsEnvironment.Exit
  43. GetLaunchDir = SConsEnvironment.GetLaunchDir
  44. SConscriptChdir = SConsEnvironment.SConscriptChdir
  45. # SConsEnvironment functions
  46. Default = SConsEnvironment(DefaultEnvironment()).Default
  47. Export = SConsEnvironment(DefaultEnvironment()).Export
  48. Help = SConsEnvironment(DefaultEnvironment()).Help
  49. Import = SConsEnvironment(DefaultEnvironment()).Import
  50. SConscript = SConsEnvironment(DefaultEnvironment()).SConscript
  51. # Environment functions
  52. AddPostAction = DefaultEnvironment().AddPostAction
  53. AddPreAction = DefaultEnvironment().AddPreAction
  54. Alias = DefaultEnvironment().Alias
  55. AlwaysBuild = DefaultEnvironment().AlwaysBuild
  56. CacheDir = DefaultEnvironment().CacheDir
  57. Clean = DefaultEnvironment().Clean
  58. Command = DefaultEnvironment().Command
  59. Decider = DefaultEnvironment().Decider
  60. Depends = DefaultEnvironment().Depends
  61. Dir = DefaultEnvironment().Dir
  62. Entry = DefaultEnvironment().Entry
  63. Execute = DefaultEnvironment().Execute
  64. File = DefaultEnvironment().File
  65. FindFile = DefaultEnvironment().FindFile
  66. FindInstalledFiles = DefaultEnvironment().FindInstalledFiles
  67. FindSourceFiles = DefaultEnvironment().FindSourceFiles
  68. Flatten = DefaultEnvironment().Flatten
  69. GetBuildPath = DefaultEnvironment().GetBuildPath
  70. Glob = DefaultEnvironment().Glob
  71. Ignore = DefaultEnvironment().Ignore
  72. Install = DefaultEnvironment().Install
  73. InstallAs = DefaultEnvironment().InstallAs
  74. InstallVersionedLib = DefaultEnvironment().InstallVersionedLib
  75. Literal = DefaultEnvironment().Literal
  76. Local = DefaultEnvironment().Local
  77. NoCache = DefaultEnvironment().NoCache
  78. NoClean = DefaultEnvironment().NoClean
  79. ParseDepends = DefaultEnvironment().ParseDepends
  80. Precious = DefaultEnvironment().Precious
  81. PyPackageDir = DefaultEnvironment().PyPackageDir
  82. Repository = DefaultEnvironment().Repository
  83. Requires = DefaultEnvironment().Requires
  84. SConsignFile = DefaultEnvironment().SConsignFile
  85. SideEffect = DefaultEnvironment().SideEffect
  86. Split = DefaultEnvironment().Split
  87. Tag = DefaultEnvironment().Tag
  88. Value = DefaultEnvironment().Value
  89. VariantDir = DefaultEnvironment().VariantDir
  90. env: SConsEnvironment
  91. env_modules: SConsEnvironment