Salome HOME
0089e656511f159d5610c95ee62ad6e3b02d4651
[modules/adao.git] / bin / AdaoYacsSchemaCreator.py
1 #-*-coding:iso-8859-1-*-
2 #
3 #  Copyright (C) 2010-2013 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 #  Author: AndrĂ© Ribes, andre.ribes@edf.fr, EDF R&D
20
21 import sys
22 import os
23 import traceback
24 import logging
25 logging.basicConfig(level=logging.INFO, format='%(levelname)-8s %(message)s')
26
27 print "-- Starting AdaoYacsSchemaCreator --"
28
29 # Check some basics variables
30 if "ADAO_ROOT_DIR" not in os.environ:
31   logging.fatal("You have to define ADAO_ROOT_DIR")
32   sys.exit(1)
33
34 try:
35   from daYacsSchemaCreator.run import *
36   from daYacsSchemaCreator.help_methods import *
37 except:
38   logging.fatal("Import of ADAO python modules failed !" +
39                 "\n add ADAO python installation directory in your PYTHONPATH")
40   traceback.print_exc()
41   sys.exit(1)
42
43 # Parse arguments
44 from optparse import OptionParser
45 usage = "usage: %prog [options] config_file yacs_schema_filename"
46 version="%prog 0.1"
47 my_parser = OptionParser(usage=usage, version=version)
48 (options, args) = my_parser.parse_args()
49 check_args(args)
50
51 config_file =  args[0]
52 yacs_schema_filename =  args[1]
53 create_schema(config_file, yacs_schema_filename)