3 # Copyright (C) 2010-2012 CEA/DEN
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License.
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.
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
23 ROOT_DIR = os.path.dirname(os.path.realpath(__file__))
24 dir_bin_name = TO BE FILLED 1
26 appli_config_name = "appli_config.xml"
27 appli_config_contain = '''<application>
28 <prerequisites path="env_launch.sh"/>
29 <resources path="CatalogResources.xml"/>
31 TO BE FILLED 2</modules>
34 # Write the appli_config.xml file
35 appli_config_stream = open(os.path.join(ROOT_DIR, appli_config_name), "w")
36 appli_config_stream.write(appli_config_contain)
37 appli_config_stream.close()
39 # Put the absolute path of the application in the env_launch file
40 env_file_name = "env_launch.sh"
41 env_file_save_name = "env_launch.sh_save"
42 shutil.move(os.path.join(ROOT_DIR, env_file_name), os.path.join(ROOT_DIR, env_file_save_name))
43 env_file_save_stream = open(os.path.join(ROOT_DIR, env_file_save_name), "r")
44 env_file_stream = open(os.path.join(ROOT_DIR, env_file_name), "w")
45 for line in env_file_save_stream.readlines():
46 if 'export out_dir_Path=' in line:
47 line_to_write = 'export out_dir_Path="' + ROOT_DIR + '"\n'
50 env_file_stream.write(line_to_write)
52 for stream in [env_file_save_stream, env_file_stream]:
55 os.chmod(os.path.join(ROOT_DIR, env_file_name),
64 command = "python " + os.path.join(ROOT_DIR, dir_bin_name, "KERNEL", "bin", "salome", "appli_gen.py") + " --prefix=APPLI --config=" + appli_config_name
65 subprocess.call(command, shell=True)