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
24 ROOT_DIR = os.path.dirname(os.path.realpath(__file__))
25 dir_bin_name = TO BE FILLED 1
27 appli_config_name = "appli_config.xml"
28 appli_config_contain = '''<application>
29 <prerequisites path="env_launch.sh"/>
30 <resources path="CatalogResources.xml"/>
32 TO BE FILLED 2</modules>
35 # Write the appli_config.xml file
36 appli_config_stream = open(os.path.join(ROOT_DIR, appli_config_name), "w")
37 appli_config_stream.write(appli_config_contain)
38 appli_config_stream.close()
40 # Put the absolute path of the application in the env_launch file
41 env_file_name = "env_launch.sh"
42 env_file_save_name = "env_launch.sh_save"
43 shutil.move(os.path.join(ROOT_DIR, env_file_name), os.path.join(ROOT_DIR, env_file_save_name))
44 env_file_save_stream = open(os.path.join(ROOT_DIR, env_file_save_name), "r")
45 env_file_stream = open(os.path.join(ROOT_DIR, env_file_name), "w")
46 for line in env_file_save_stream.readlines():
47 if 'export out_dir_Path=' in line:
48 line_to_write = 'export out_dir_Path="' + ROOT_DIR + '"\n'
51 env_file_stream.write(line_to_write)
53 for stream in [env_file_save_stream, env_file_stream]:
56 os.chmod(os.path.join(ROOT_DIR, env_file_name),
65 command = "python " + os.path.join(ROOT_DIR, dir_bin_name, "KERNEL", "bin", "salome", "appli_gen.py") + " --prefix=APPLI --config=" + appli_config_name
66 subprocess.call(command, shell=True)