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.

(cherry picked from commit a44f9ca545)
This commit is contained in:
Rémi Verschelde 2018-03-14 14:42:43 +01:00 committed by Hein-Pieter van Braam
parent fa9e03996c
commit 9ab9dd73b0
1 changed files with 104 additions and 105 deletions

View File

@ -495,18 +495,16 @@ else:
print("\nPlease run scons again with argument: platform=<string>")
# 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
@ -602,6 +600,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.