Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit c4eadb8

Browse files
committed
Bug 1258618 - Serialize substs/configs and defines bools as '1' or '' in config.status. r=nalexander
This allows to use True and False as values given to set_config/set_define in moz.configure files, while postponing having to deal with the long tail of things depending on the values from substs and defines. Ideally, everything would handle the bools just fine, but there are too many things involved to deal with this right now: scripts using buildconfig.{substs,defines}, scripts using ConfigEnvironment (e.g. process_define_files.py), ConfigEnvironment itself, etc.
1 parent c5fa990 commit c4eadb8

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

configure.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,24 @@ def main(argv):
2929

3030
def config_status(config):
3131
# Sanitize config data to feed config.status
32+
# Ideally, all the backend and frontend code would handle the booleans, but
33+
# there are so many things involved, that it's easier to keep config.status
34+
# untouched for now.
35+
def sanitized_bools(v):
36+
if v is True:
37+
return '1'
38+
if v is False:
39+
return ''
40+
return v
41+
3242
sanitized_config = {}
3343
sanitized_config['substs'] = {
34-
k: v for k, v in config.iteritems()
44+
k: sanitized_bools(v) for k, v in config.iteritems()
3545
if k not in ('DEFINES', 'non_global_defines', 'TOPSRCDIR', 'TOPOBJDIR')
3646
}
37-
sanitized_config['defines'] = config['DEFINES']
47+
sanitized_config['defines'] = {
48+
k: sanitized_bools(v) for k, v in config['DEFINES'].iteritems()
49+
}
3850
sanitized_config['non_global_defines'] = config['non_global_defines']
3951
sanitized_config['topsrcdir'] = config['TOPSRCDIR']
4052
sanitized_config['topobjdir'] = config['TOPOBJDIR']

0 commit comments

Comments
 (0)