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 /src | |
parent | f613472171d07f48eed7c567524f2bef6578484b (diff) |
Using ast.literal_eval is no good here
Diffstat (limited to 'src')
-rw-r--r-- | src/configs/sphinx/conf.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/configs/sphinx/conf.py b/src/configs/sphinx/conf.py index 6856f371a..67f4a5678 100644 --- a/src/configs/sphinx/conf.py +++ b/src/configs/sphinx/conf.py @@ -1,7 +1,6 @@ # Sphinx configuration file import sys -import ast import re #import sphinx @@ -26,7 +25,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 version_info = parse_version_file('../../../version.txt') |