SCons: Implement minor fixes
This commit is contained in:
parent
15ff450680
commit
2949ab0707
14
SConstruct
14
SConstruct
@ -1082,11 +1082,11 @@ if "check_c_headers" in env:
|
|||||||
for header in headers:
|
for header in headers:
|
||||||
if conf.CheckCHeader(header):
|
if conf.CheckCHeader(header):
|
||||||
env.AppendUnique(CPPDEFINES=[headers[header]])
|
env.AppendUnique(CPPDEFINES=[headers[header]])
|
||||||
|
conf.Finish()
|
||||||
|
|
||||||
|
# Miscellaneous & post-build methods.
|
||||||
methods.show_progress(env)
|
if not env.GetOption("clean") and not env.GetOption("help"):
|
||||||
# TODO: replace this with `env.Dump(format="json")`
|
methods.dump(env)
|
||||||
# once we start requiring SCons 4.0 as min version.
|
methods.show_progress(env)
|
||||||
methods.dump(env)
|
methods.prepare_purge(env)
|
||||||
methods.prepare_purge(env)
|
methods.prepare_timer()
|
||||||
methods.prepare_timer()
|
|
||||||
|
22
methods.py
22
methods.py
@ -768,9 +768,10 @@ def show_progress(env):
|
|||||||
|
|
||||||
# Progress reporting is not available in non-TTY environments since it
|
# Progress reporting is not available in non-TTY environments since it
|
||||||
# messes with the output (for example, when writing to a file).
|
# messes with the output (for example, when writing to a file).
|
||||||
self.display = cast(bool, self.max and env["progress"] and sys.stdout.isatty())
|
self.display = cast(bool, env["progress"] and sys.stdout.isatty())
|
||||||
if self.display and not self.max:
|
if self.display and not self.max:
|
||||||
print_info("Performing initial build, progress percentage unavailable!")
|
print_info("Performing initial build, progress percentage unavailable!")
|
||||||
|
self.display = False
|
||||||
|
|
||||||
def __call__(self, node, *args, **kw):
|
def __call__(self, node, *args, **kw):
|
||||||
self.count += 1
|
self.count += 1
|
||||||
@ -853,9 +854,6 @@ def clean_cache(cache_path: str, cache_limit: int, verbose: bool) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def prepare_cache(env) -> None:
|
def prepare_cache(env) -> None:
|
||||||
if env.GetOption("clean"):
|
|
||||||
return
|
|
||||||
|
|
||||||
cache_path = ""
|
cache_path = ""
|
||||||
if env["cache_path"]:
|
if env["cache_path"]:
|
||||||
cache_path = cast(str, env["cache_path"])
|
cache_path = cast(str, env["cache_path"])
|
||||||
@ -907,21 +905,19 @@ def prepare_timer():
|
|||||||
def print_elapsed_time(time_at_start: float):
|
def print_elapsed_time(time_at_start: float):
|
||||||
time_elapsed = time.time() - time_at_start
|
time_elapsed = time.time() - time_at_start
|
||||||
time_formatted = time.strftime("%H:%M:%S", time.gmtime(time_elapsed))
|
time_formatted = time.strftime("%H:%M:%S", time.gmtime(time_elapsed))
|
||||||
time_centiseconds = round((time_elapsed % 1) * 100)
|
time_centiseconds = (time_elapsed % 1) * 100
|
||||||
print_info(f"Time elapsed: {time_formatted}.{time_centiseconds}")
|
print_info(f"Time elapsed: {time_formatted}.{time_centiseconds:02.0f}")
|
||||||
|
|
||||||
atexit.register(print_elapsed_time, time.time())
|
atexit.register(print_elapsed_time, time.time())
|
||||||
|
|
||||||
|
|
||||||
def dump(env):
|
def dump(env):
|
||||||
# Dumps latest build information for debugging purposes and external tools.
|
"""
|
||||||
from json import dump
|
Dumps latest build information for debugging purposes and external tools.
|
||||||
|
"""
|
||||||
|
|
||||||
def non_serializable(obj):
|
with open(".scons_env.json", "w", encoding="utf-8", newline="\n") as file:
|
||||||
return "<<non-serializable: %s>>" % (type(obj).__qualname__)
|
file.write(env.Dump(format="json"))
|
||||||
|
|
||||||
with open(".scons_env.json", "w", encoding="utf-8", newline="\n") as f:
|
|
||||||
dump(env.Dictionary(), f, indent=4, default=non_serializable)
|
|
||||||
|
|
||||||
|
|
||||||
# Custom Visual Studio project generation logic that supports any platform that has a msvs.py
|
# Custom Visual Studio project generation logic that supports any platform that has a msvs.py
|
||||||
|
Loading…
x
Reference in New Issue
Block a user