aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2017-03-23 18:56:50 +0100
committerSimon Warta <[email protected]>2017-03-25 19:28:49 +0100
commitf37885f53bbdf7fd1764ec2e8bd58c4df32dcb27 (patch)
tree297b32d2ea477734e275a10bd01bc911c197633a
parent8b1ada76cd9d0610bd498576802b355ede6d4ba7 (diff)
Use JSON to store build config
to improve debuggability
-rwxr-xr-xconfigure.py5
-rwxr-xr-xsrc/scripts/install.py4
2 files changed, 6 insertions, 3 deletions
diff --git a/configure.py b/configure.py
index 86ce4b6e1..d067c5b32 100755
--- a/configure.py
+++ b/configure.py
@@ -19,6 +19,7 @@ CPython 2.5 and earlier are not supported.
On Jython target detection does not work (use --os and --cpu).
"""
+import json
import sys
import os
import os.path
@@ -2495,8 +2496,8 @@ def main(argv=None):
link_headers(build_config.external_headers, 'external',
build_config.external_include_dir)
- with open(os.path.join(build_config.build_dir, 'build_config.py'), 'w') as f:
- f.write(str(template_vars))
+ with open(os.path.join(build_config.build_dir, 'build_config.json'), 'w') as f:
+ json.dump(template_vars, f, sort_keys=True, indent=2)
if options.amalgamation:
amalgamation_cpp_files = generate_amalgamation(build_config, options)
diff --git a/src/scripts/install.py b/src/scripts/install.py
index 0a9683ca0..a92cd43eb 100755
--- a/src/scripts/install.py
+++ b/src/scripts/install.py
@@ -9,6 +9,7 @@ Botan is released under the Simplified BSD License (see license.txt)
"""
import errno
+import json
import logging
import optparse
import os
@@ -105,7 +106,8 @@ def main(args = None):
copy_file(src, dst)
os.chmod(dst, exe_mode)
- cfg = eval(open(os.path.join(options.build_dir, 'build_config.py')).read())
+ with open(os.path.join(options.build_dir, 'build_config.json')) as f:
+ cfg = json.load(f)
def process_template(template_str):
class PercentSignTemplate(string.Template):