summaryrefslogtreecommitdiff
path: root/SCons/Script
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2022-09-14 08:58:08 -0600
committerMats Wichmann <mats@linux.com>2022-09-14 10:36:35 -0600
commita1084687b353463fd6a0caedea4b00413431cf04 (patch)
tree25326c924d7a0b8e8ecb75ee513004b17526e3e2 /SCons/Script
parent4cc86dac98bbeb84587b7399efa3693283042f45 (diff)
downloadscons-git-a1084687b353463fd6a0caedea4b00413431cf04.tar.gz
doc: change five functions to appear global-only
The five functions EnsureSConsVersion, EnsurePythonVersion, Exit, GetLaunchDir, SConscriptChdir were listed as both global and environment functions, but they do nothing in the context of an environment, so marked in the xml as "global". This only changes the presentation in the manpage & userguide appendix, not the behavior. Minor tweaks in the code around SConscriptChdir - actually use a bool True/False instead of 0/1, and added a couple of type annotations. Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'SCons/Script')
-rw-r--r--SCons/Script/SConscript.py12
-rw-r--r--SCons/Script/SConscript.xml8
2 files changed, 10 insertions, 10 deletions
diff --git a/SCons/Script/SConscript.py b/SCons/Script/SConscript.py
index 99bb84d6e..2b11e2ff2 100644
--- a/SCons/Script/SConscript.py
+++ b/SCons/Script/SConscript.py
@@ -57,7 +57,7 @@ GlobalDict = None
global_exports = {}
# chdir flag
-sconscript_chdir = 1
+sconscript_chdir: bool = True
def get_calling_namespaces():
"""Return the locals and globals for the function that called
@@ -205,7 +205,7 @@ def _SConscript(fs, *files, **kw):
# Change directory to the top of the source
# tree to make sure the os's cwd and the cwd of
# fs match so we can open the SConscript.
- fs.chdir(top, change_os_dir=1)
+ fs.chdir(top, change_os_dir=True)
if f.rexists():
actual = f.rfile()
_file_ = open(actual.get_abspath(), "rb")
@@ -254,7 +254,7 @@ def _SConscript(fs, *files, **kw):
# fs.chdir(), because we still need to
# interpret the stuff within the SConscript file
# relative to where we are logically.
- fs.chdir(ldir, change_os_dir=0)
+ fs.chdir(ldir, change_os_dir=False)
os.chdir(actual.dir.get_abspath())
# Append the SConscript directory to the beginning
@@ -292,7 +292,7 @@ def _SConscript(fs, *files, **kw):
if old_file is not None:
call_stack[-1].globals.update({__file__:old_file})
-
+
else:
handle_missing_SConscript(f, kw.get('must_exist', None))
@@ -306,7 +306,7 @@ def _SConscript(fs, *files, **kw):
# There was no local directory, so chdir to the
# Repository directory. Like above, we do this
# directly.
- fs.chdir(frame.prev_dir, change_os_dir=0)
+ fs.chdir(frame.prev_dir, change_os_dir=False)
rdir = frame.prev_dir.rdir()
rdir._create() # Make sure there's a directory there.
try:
@@ -600,7 +600,7 @@ class SConsEnvironment(SCons.Environment.Base):
subst_kw['exports'] = exports
return _SConscript(self.fs, *files, **subst_kw)
- def SConscriptChdir(self, flag):
+ def SConscriptChdir(self, flag: bool) -> None:
global sconscript_chdir
sconscript_chdir = flag
diff --git a/SCons/Script/SConscript.xml b/SCons/Script/SConscript.xml
index eb52accee..7a4bc2916 100644
--- a/SCons/Script/SConscript.xml
+++ b/SCons/Script/SConscript.xml
@@ -84,7 +84,7 @@ env.Default(hello)
</scons_function>
<scons_function name="EnsurePythonVersion">
-<arguments>
+<arguments signature="global">
(major, minor)
</arguments>
<summary>
@@ -107,7 +107,7 @@ EnsurePythonVersion(2,2)
</scons_function>
<scons_function name="EnsureSConsVersion">
-<arguments>
+<arguments signature="global">
(major, minor, [revision])
</arguments>
<summary>
@@ -137,7 +137,7 @@ EnsureSConsVersion(0,96,90)
</scons_function>
<scons_function name="Exit">
-<arguments>
+<arguments signature="global">
([value])
</arguments>
<summary>
@@ -215,7 +215,7 @@ See the description below.
</scons_function>
<scons_function name="GetLaunchDir">
-<arguments>
+<arguments signature="global">
()
</arguments>
<summary>