diff options
author | Jack Lloyd <[email protected]> | 2017-09-19 21:02:27 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-09-19 21:02:27 -0400 |
commit | 64971bfa4ce4886c019ac31fa95aa6ae79bdadc4 (patch) | |
tree | e170bfa17c041797b4f920c231f81240c69ca77d /configure.py | |
parent | f613472171d07f48eed7c567524f2bef6578484b (diff) |
Using ast.literal_eval is no good here
Diffstat (limited to 'configure.py')
-rwxr-xr-x | configure.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/configure.py b/configure.py index 08ef220a7..3d788d2eb 100755 --- a/configure.py +++ b/configure.py @@ -36,7 +36,6 @@ import logging import time import errno import optparse # pylint: disable=deprecated-module -import ast # An error caused by and to be fixed by the user, e.g. invalid command line argument class UserError(Exception): @@ -62,7 +61,17 @@ def parse_version_file(version_path): continue match = key_and_val.match(line) if match: - results[match.group(1)] = ast.literal_eval(match.group(2)) + key = match.group(1) + val = match.group(2) + + if val == 'None': + val = None + elif val.startswith("'") and val.endswith("'"): + val = val[1:len(val)-1] + else: + val = int(val) + + results[key] = val return results class Version(object): |