1 | #! /usr/bin/env python |
---|
2 | # encoding: utf-8 |
---|
3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file |
---|
4 | |
---|
5 | import os,sys,re |
---|
6 | from waflib import Options,TaskGen,Task,Utils |
---|
7 | from waflib.TaskGen import feature,after_method |
---|
8 | @feature('msgfmt') |
---|
9 | def apply_msgfmt(self): |
---|
10 | for lang in self.to_list(self.langs): |
---|
11 | node=self.path.find_resource(lang+'.po') |
---|
12 | task=self.create_task('msgfmt',node,node.change_ext('.mo')) |
---|
13 | langname=lang.split('/') |
---|
14 | langname=langname[-1] |
---|
15 | inst=getattr(self,'install_path','${KDE4_LOCALE_INSTALL_DIR}') |
---|
16 | self.bld.install_as(inst+os.sep+langname+os.sep+'LC_MESSAGES'+os.sep+getattr(self,'appname','set_your_appname')+'.mo',task.outputs[0],chmod=getattr(self,'chmod',Utils.O644)) |
---|
17 | class msgfmt(Task.Task): |
---|
18 | color='BLUE' |
---|
19 | run_str='${MSGFMT} ${SRC} -o ${TGT}' |
---|
20 | def configure(self): |
---|
21 | kdeconfig=self.find_program('kde4-config') |
---|
22 | prefix=self.cmd_and_log(kdeconfig+['--prefix']).strip() |
---|
23 | fname='%s/share/apps/cmake/modules/KDELibsDependencies.cmake'%prefix |
---|
24 | try:os.stat(fname) |
---|
25 | except OSError: |
---|
26 | fname='%s/share/kde4/apps/cmake/modules/KDELibsDependencies.cmake'%prefix |
---|
27 | try:os.stat(fname) |
---|
28 | except OSError:self.fatal('could not open %s'%fname) |
---|
29 | try: |
---|
30 | txt=Utils.readf(fname) |
---|
31 | except EnvironmentError: |
---|
32 | self.fatal('could not read %s'%fname) |
---|
33 | txt=txt.replace('\\\n','\n') |
---|
34 | fu=re.compile('#(.*)\n') |
---|
35 | txt=fu.sub('',txt) |
---|
36 | setregexp=re.compile('([sS][eE][tT]\s*\()\s*([^\s]+)\s+\"([^"]+)\"\)') |
---|
37 | found=setregexp.findall(txt) |
---|
38 | for(_,key,val)in found: |
---|
39 | self.env[key]=val |
---|
40 | self.env['LIB_KDECORE']=['kdecore'] |
---|
41 | self.env['LIB_KDEUI']=['kdeui'] |
---|
42 | self.env['LIB_KIO']=['kio'] |
---|
43 | self.env['LIB_KHTML']=['khtml'] |
---|
44 | self.env['LIB_KPARTS']=['kparts'] |
---|
45 | self.env['LIBPATH_KDECORE']=[os.path.join(self.env.KDE4_LIB_INSTALL_DIR,'kde4','devel'),self.env.KDE4_LIB_INSTALL_DIR] |
---|
46 | self.env['INCLUDES_KDECORE']=[self.env['KDE4_INCLUDE_INSTALL_DIR']] |
---|
47 | self.env.append_value('INCLUDES_KDECORE',[self.env['KDE4_INCLUDE_INSTALL_DIR']+os.sep+'KDE']) |
---|
48 | self.find_program('msgfmt',var='MSGFMT') |
---|