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