diff --git a/scripts/init.py b/scripts/init.py index d014205864fa5fb87021d500f8185544cdb3fd50..df9341020e4725c5501a100a80f838f21441b0e0 100644 --- a/scripts/init.py +++ b/scripts/init.py @@ -164,6 +164,22 @@ if options.builder=="RULE_BASED": conop.Conopology.Instance().RegisterBuilder(rbb,'rbb') conop.Conopology.Instance().SetDefaultBuilder('rbb') +home = os.getenv('HOME') or os.getenv('USERPROFILE') +_ostrc=os.path.join(home, '.ostrc') +if os.path.exists(_ostrc): + try: + exec(open(_ostrc)) + except Exception, e: + print e +else: + rcfile=open(_ostrc,"w") + print >> rcfile, '# This python file is parsed by ost and dng at startup' + print >> rcfile, '# Its content is made available in the global namespace' + print >> rcfile, '# It can be used to define custom variables and functions' + print >> rcfile, '# For example:' + print >> rcfile, '# IMPORTANT_DIR="path/to/important/dir"' + rcfile.close() + PushVerbosityLevel(options.vlevel) _InitFrontEnd() diff --git a/scripts/init_cl.py b/scripts/init_cl.py index 5582502d44b37291f69db910be9c72f8cf71f710..eb7168357b83ad5636082c15db658524b9625d31 100644 --- a/scripts/init_cl.py +++ b/scripts/init_cl.py @@ -60,6 +60,14 @@ if os.path.exists(_ostrc): exec(open(_ostrc)) except Exception, e: print e +else: + rcfile=open(_ostrc,"w") + print >> rcfile, '# This python file is parsed by ost and dng at startup' + print >> rcfile, '# Its content is be made available in the global namespace' + print >> rcfile, '# It can be used to define custom variables and functions' + print >> rcfile, '# For example:' + print >> rcfile, '# IMPORTANT_DIR="path/to/important/dir"' + rcfile.close() PushVerbosityLevel(options.vlevel)