Skip to content

Commit dc00207

Browse files
committed
Store verbosity in Environment
1 parent 0cc4e27 commit dc00207

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

‎bfg9000/driver.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ def environment_from_args(args):
7979
backend_version=backend.version(),
8080
srcdir=args.srcdir,
8181
builddir=args.builddir,
82+
verbose=args.verbose,
8283
)
8384

8485
return env, backend
@@ -122,6 +123,7 @@ def __call__(self, parser, namespace, values, option_string=None):
122123
namespace.builddir = None
123124

124125
if getattr(namespace, 'srcdir', None):
126+
namespace.verbose = False
125127
env, backend = environment_from_args(namespace)
126128
parser = build.fill_user_help(env, parser)
127129

‎bfg9000/environment.py‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def from_json(cls, data):
124124

125125

126126
class Environment:
127-
version = 17
127+
version = 18
128128
envfile = '.bfg_environ'
129129

130130
Mode = shell.Mode
@@ -136,10 +136,12 @@ def __new__(cls, *args, **kwargs):
136136
env.__tools = {}
137137
return env
138138

139-
def __init__(self, bfgdir, backend, backend_version, srcdir, builddir):
139+
def __init__(self, bfgdir, backend, backend_version, srcdir, builddir,
140+
verbose=False):
140141
self.bfgdir = bfgdir.as_directory()
141142
self.backend = backend
142143
self.backend_version = backend_version
144+
self.verbose = verbose
143145

144146
self.host_platform = platforms.host.platform_info()
145147
self.target_platform = platforms.target.platform_info()
@@ -260,6 +262,7 @@ def save(self, path):
260262
'bfgdir': self.bfgdir.to_json(),
261263
'backend': self.backend,
262264
'backend_version': str(self.backend_version),
265+
'verbose': self.verbose,
263266

264267
'host_platform': self.host_platform.to_json(),
265268
'target_platform': self.target_platform.to_json(),
@@ -379,6 +382,12 @@ def load(cls, path):
379382

380383
# ----- bfg v0.7.0 -----
381384

385+
# v18 adds verbose field.
386+
if version < 18:
387+
data['verbose'] = False
388+
389+
# ----- bfg v0.8.0 -----
390+
382391
# Now that we've upgraded, initialize the Environment object.
383392
env = cls.__new__(cls)
384393

@@ -387,7 +396,7 @@ def load(cls, path):
387396
data['target_platform']
388397
)
389398

390-
for i in ('backend', 'extra_args'):
399+
for i in ('backend', 'extra_args', 'compdb', 'verbose'):
391400
setattr(env, i, data[i])
392401

393402
for i in ('bfgdir', 'srcdir', 'builddir'):
@@ -402,6 +411,5 @@ def load(cls, path):
402411
env.mopack = [Path.from_json(i) for i in data['mopack']]
403412
env.variables = EnvVarDict.from_json(data['variables'])
404413
env.library_mode = LibraryMode(*data['library_mode'])
405-
env.compdb = data['compdb']
406414

407415
return env

0 commit comments

Comments
 (0)