]> rtime.felk.cvut.cz Git - linux-conf-perf.git/commitdiff
Simplify conf.py
authorMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 16 Oct 2015 20:20:24 +0000 (22:20 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 16 Oct 2015 20:20:24 +0000 (22:20 +0200)
conf.py

diff --git a/conf.py b/conf.py
index caafa04f65bd0d8d7b863a21a348e47465c8e889..955f515a38f3bbb8969a2b7cf390d17fac60fbb3 100644 (file)
--- a/conf.py
+++ b/conf.py
@@ -117,20 +117,18 @@ allconfig = 'scripts/allconfig/allconfig'
 absroot = os.path.dirname(os.path.realpath(__file__))
 
 #######################################
-# Overlap configuration for specified target
-if os.path.isfile(os.path.join(absroot, '.target')):
-       target = None
-       with open(os.path.join(absroot, '.target'), 'r') as f:
-               target = f.readline().rstrip()
+# Override configuration for specified target
+try:
+       target = open(os.path.join(absroot, '.target'), 'r').readline().rstrip()
        conffile = os.path.join(absroot, 'targets', target, 'conf.py')
-       if os.path.isfile(conffile):
+       try:
                ovconf = importlib.machinery.SourceFileLoader("module.name", conffile).load_module()
                for name in dir(ovconf):
                        if not re.match('__*__', name):
                                vars()[name] = vars(ovconf)[name]
-       else:
+       except:
                print("E: Invalid target specifier. Write valid target to .target file.")
                sys.exit(-99)
-else:
+except:
        print("E: No target specifier. Write target to .target file.")
        sys.exit(-99)