X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FsalomeTools.py;h=d74ad11122ef877b2bc00c7f5ba1666d166fa240;hb=606f9b6618e0e0659d4029c607eaa04d9b3501cc;hp=8fcf24430626cc1b21f649fe9051bc2552c7acfd;hpb=50dc9b77554632f9b9e903e6fc17d5ecfd3dfc4a;p=tools%2Fsat.git diff --git a/src/salomeTools.py b/src/salomeTools.py index 8fcf244..d74ad11 100755 --- a/src/salomeTools.py +++ b/src/salomeTools.py @@ -16,28 +16,87 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -'''This file is the main entry file to salomeTools -''' +""" +This file is the main API file for salomeTools + +| Warning: NO '__main__ ' call allowed, +| Use 'sat' (in parent directory) +| +| Usage: see file ../sat +""" + +import sys + +# exit OKSYS and KOSYS seems equal on linux or windows +_OKSYS = 0 # OK +_KOSYS = 1 # KO + +######################################################################## +# NO __main__ entry allowed, use sat +######################################################################## +if __name__ == "__main__": + msg = """ +ERROR: 'salomeTools.py' is not main command entry (CLI) for salomeTools. + Use 'sat' instead.\n\n""" + sys.stderr.write(msg) + sys.exit(_KOSYS) # python imports import os -import sys +import re +import tempfile import imp import types import gettext +import traceback -# salomeTools imports -import common.options -import config +import src +import src.debug as DBG # Easy print stderr (for DEBUG only) +import src.returnCode as RCO # Easy (ok/ko, why) return methods code +import src.utilsSat as UTS # get path to salomeTools sources -srcdir = os.path.dirname(os.path.realpath(__file__)) +satdir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) +srcdir = os.path.join(satdir, 'src') +cmdsdir = os.path.join(satdir, 'commands') + +import commands.config as CONFIG # load resources for internationalization -#es = gettext.translation('salomeTools', os.path.join(srcdir, 'common', 'i18n')) -#es.install() -gettext.install('salomeTools', os.path.join(srcdir, 'common', 'i18n')) +gettext.install("salomeTools", os.path.join(srcdir, "i18n")) +try: + _LANG = os.environ["LANG"] # original locale +except: + _LANG = "en_US.utf8" #default + +# The possible hooks : +# pre is for hooks to be executed before commands +# post is for hooks to be executed after commands +C_PRE_HOOK = "pre" +C_POST_HOOK = "post" + +# Define all possible option for salomeTools command : sat