]> SALOME platform Git repositories - tools/sat.git/blob - data/templates/Application/config/compile.py
Salome HOME
add the template command
[tools/sat.git] / data / templates / Application / config / compile.py
1 #!/usr/bin/env python
2 #-*- coding:utf-8 -*-
3
4 # This script is used to build the application module.
5 # First, it copies the content of the sources directory to the install directory.
6 # Then it runs 'lrelease' to build the resources.
7
8 import subprocess
9
10 import src
11
12 def compil(config, builder, logger):
13     builder.prepare()
14     if not builder.source_dir.smartcopy(builder.install_dir):
15         raise src.SatException(_("Error when copying %s sources to install dir") % builder.product_info.name)
16     
17     # test lrelease #.pyconf needs in ..._APPLI pre_depend : ['qt']
18     command = "which lrelease" 
19     res = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE,env=builder.build_environ.environ.environ).communicate()
20     if res[1] != "": #an error occured
21         logger.write("ERROR: %s" % res[1])
22         builder.log(res[1]+"\n")
23         return 1
24     
25     # run lrelease
26     command = "lrelease *.ts"
27     res = subprocess.call(command,
28                           shell=True,
29                           cwd=str(builder.install_dir + "resources"),
30                           env=builder.build_environ.environ.environ,
31                           stdout=logger.logTxtFile,
32                           stderr=subprocess.STDOUT)
33     if res != 0:
34         res = 1
35     
36     return res