Salome HOME
Ajout de l'executable
[modules/adao.git] / bin / DatassimYacsSchemaCreator.py
1 #!/usr/bin/python
2 #-*-coding:iso-8859-1-*-
3 #  Copyright (C) 2008-2009  EDF R&D
4 #
5 #  This library is free software; you can redistribute it and/or
6 #  modify it under the terms of the GNU General Public
7 #  License as published by the Free Software Foundation; either
8 #  version 2.1 of the License.
9 #
10 #  This library is distributed in the hope that it will be useful,
11 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 #  Lesser General Public License for more details.
14 #
15 #  You should have received a copy of the GNU Lesser General Public
16 #  License along with this library; if not, write to the Free Software
17 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
18 #
19 # --
20 # Author : AndrĂ© RIBES (EDF R&D)
21 # --
22
23 import sys
24 import os
25 import traceback
26 import logging
27 logging.basicConfig(level=logging.DEBUG, format='%(levelname)-8s %(message)s')
28
29 print "-- Starting DatassimYacsSchemaCreator --"
30
31 # Check some basics variables
32 if "DATASSIM_ROOT_DIR" not in os.environ:
33   logging.fatal("You have to define DATASSIM_ROOT_DIR")
34   sys.exit(1)
35
36 try:
37   from daYacsSchemaCreator.run import *
38   from daYacsSchemaCreator.help_methods import *
39 except:
40   logging.fatal("Import of DATASSIM python modules failed !" +
41                 "\n add DATASSIM python installation directory in your PYTHONPATH")
42   sys.exit(1)
43
44 # Parse arguments
45 from optparse import OptionParser
46 usage = "usage: %prog [options] config_file yacs_schema_filename"
47 version="%prog 0.1"
48 my_parser = OptionParser(usage=usage, version=version)
49 (options, args) = my_parser.parse_args()
50 check_args(args)
51
52 config_file =  args[0]
53 yacs_schema_filename =  args[1]
54 create_schema(config_file, yacs_schema_filename)