9 "Converts .po files to the Qt .qm format"
12 class po2qm_obj(Object
.genobj
):
14 s_default_ext
= ['.po']
16 Object
.genobj
.__init
__(self
, 'other')
17 self
.inst_var
= 'QMDIR'
23 # create the nodes corresponding to the sources
24 for filename
in self
.to_list(self
.source
):
26 base
, ext
= os
.path
.splitext(filename
)
27 if not ext
in self
.s_default_ext
:
28 Params
.fatal("unknown file " + filename
)
30 split_filename
= Utils
.split_path(filename
)
31 node
= self
.path
.find_source_lst(split_filename
)
33 task
= self
.create_task(NAME
, self
.env
, 101)
35 task
.set_outputs(node
.change_ext('.qm'))
38 for i
in self
.m_tasks
:
39 current
= Params
.g_build
.m_curdirnode
40 lst
=[a
.relpath_gen(current
) for a
in i
.m_outputs
]
41 Common
.install_files(self
.inst_var
, self
.inst_dir
, lst
, chmod
=self
.chmod
)
44 Object
.register(NAME
, po2qm_obj
)
45 Action
.simple_action(NAME
, '${MSGFMT} ${MSGFMT_FLAGS} -o ${TGT} ${SRC}', color
='YELLOW')
48 if not conf
.find_program('msgfmt', var
='MSGFMT'):
50 conf
.env
['MSGFMT_FLAGS'] = '--qt'
51 conf
.env
['MSGFMT_EXT'] = ['.po']
52 conf
.env
['QMDIR'] = os
.path
.join(
53 conf
.env
['PREFIX'], 'share',
54 Utils
.g_module
.APPNAME
, 'qm')