Salome HOME
Suppression code mort
[modules/adao.git] / src / daSalome / daYacsSchemaCreator / run.py
1 #-*- coding: utf-8 -*-
2 #  Copyright (C) 2008-2009  EDF R&D
3 #
4 #  This library is free software; you can redistribute it and/or
5 #  modify it under the terms of the GNU General Public
6 #  License as published by the Free Software Foundation; either
7 #  version 2.1 of the License.
8 #
9 #  This library is distributed in the hope that it will be useful,
10 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 #  Lesser General Public License for more details.
13 #
14 #  You should have received a copy of the GNU Lesser General Public
15 #  License along with this library; if not, write to the Free Software
16 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # --
19 # Author : AndrĂ© RIBES (EDF R&D)
20 # --
21
22 import sys
23 import os
24 import traceback
25 import logging
26 from optparse import OptionParser
27 from daYacsSchemaCreator.methods import *
28 from daYacsSchemaCreator.help_methods import *
29
30 def create_schema(config_file, yacs_schema_filename):
31
32   # Import config_file
33   try:
34     execfile(config_file)
35   except:
36     logging.fatal("Exception in loading " + config_file)
37     traceback.print_exc()
38     sys.exit(1)
39
40   if "study_config" not in locals():
41     logging.fatal("Cannot found study_config in " + str(config_file))
42     sys.exit(1)
43   else:
44     globals()['study_config'] = locals()['study_config']
45
46   check_study(study_config)
47   proc = create_yacs_proc(study_config)
48   write_yacs_proc(proc, yacs_schema_filename)