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