From 77f7ea8c0a867968d9929263209da698cad72330 Mon Sep 17 00:00:00 2001 From: valerio <valerio@5a81b35b-ba03-0410-adc8-b2c5c5119f08> Date: Fri, 16 Jul 2010 15:10:05 +0000 Subject: [PATCH] Added parsing of ostrc file for dng. File is createdf with template if not existing git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2577 5a81b35b-ba03-0410-adc8-b2c5c5119f08 --- scripts/init.py | 16 ++++++++++++++++ scripts/init_cl.py | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/scripts/init.py b/scripts/init.py index d01420586..df9341020 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 5582502d4..eb7168357 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) -- GitLab