From 4cdfa6391ef261fd92fa5d33391c949c9a81e632 Mon Sep 17 00:00:00 2001 From: Roselyne Chotin Date: Fri, 9 Mar 2012 07:49:45 +0000 Subject: [PATCH] add a configuration file --- stratus1/src/stratus/st_config.py | 2 ++ stratus1/src/stratus/stratus.py | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 stratus1/src/stratus/st_config.py diff --git a/stratus1/src/stratus/st_config.py b/stratus1/src/stratus/st_config.py new file mode 100644 index 00000000..0b62d0a7 --- /dev/null +++ b/stratus1/src/stratus/st_config.py @@ -0,0 +1,2 @@ +format = 'vst' +simulator = 'asimut' diff --git a/stratus1/src/stratus/stratus.py b/stratus1/src/stratus/stratus.py index b72080ca..25a026ce 100644 --- a/stratus1/src/stratus/stratus.py +++ b/stratus1/src/stratus/stratus.py @@ -47,6 +47,28 @@ # x-----------------------------------------------------------------x +# Get configuration of Stratus +def getConfigFile(): + import os + + config_file = os.path.join(os.getcwd(),".st_config.py") + if os.path.exists(config_file): + return config_file + else: + config_file = os.path.join(os.getenv('HOME'),".st_config.py") + if os.path.exists(config_file): + return config_file + else: + return None + +configFile = getConfigFile() +if configFile: + import imp + imp.load_source('st_config',configFile) +else: + print "No configuration file found, using default configuration" + import st_config + from st_model import * from st_net import * @@ -69,3 +91,6 @@ from util_uRom import * from util import * from patterns import * + + +