SCons: Fix running 'scons' without platform argument

The cache and progress logic assumed the 'env' to be defined,
but it is only when the selected platform is in the supported list.

Fixes #17497.
This commit is contained in:
Rémi Verschelde 2018-03-14 14:42:43 +01:00
parent ea204628ad
commit a44f9ca545
1 changed files with 104 additions and 106 deletions

View File

@ -491,21 +491,18 @@ else:
for x in platform_list:
print("\t" + x)
print("\nPlease run scons again with argument: platform=<string>")
sys.exit(255)
# The following only makes sense when the env is defined, and assumes it is
if 'env' in locals():
screen = sys.stdout
# Progress reporting is not available in non-TTY environments since it
# messes with the output (for example, when writing to a file)
show_progress = (env['progress'] and sys.stdout.isatty())
node_count = 0
node_count_max = 0
node_count_interval = 1
if ('env' in locals()):
node_count_fname = str(env.Dir('#')) + '/.scons_node_count'
# Progress reporting is not available in non-TTY environments since it
# messes with the output (for example, when writing to a file)
if sys.stdout.isatty():
show_progress = env['progress']
else:
show_progress = False
import time, math
@ -601,6 +598,7 @@ try:
node_count_max = int(f.readline())
except:
pass
cache_directory = os.environ.get("SCONS_CACHE")
# Simple cache pruning, attached to SCons' progress callback. Trim the
# cache directory to a size not larger than cache_limit.