Changeset 904702d for waflib/Tools/intltool.py
- Timestamp:
- Mar 14, 2015, 6:06:10 PM (10 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 6d7acc8
- Parents:
- 5525507
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waflib/Tools/intltool.py
r5525507 r904702d 4 4 5 5 import os,re 6 from waflib import Configure, TaskGen,Task,Utils,Runner,Options,Build,Logs6 from waflib import Configure,Context,TaskGen,Task,Utils,Runner,Options,Build,Logs 7 7 import waflib.Tools.ccroot 8 from waflib.TaskGen import feature,before_method 8 from waflib.TaskGen import feature,before_method,taskgen_method 9 9 from waflib.Logs import error 10 from waflib.Configure import conf 11 _style_flags={'ba':'-b','desktop':'-d','keys':'-k','quoted':'--quoted-style','quotedxml':'--quotedxml-style','rfc822deb':'-r','schemas':'-s','xml':'-x',} 12 @taskgen_method 13 def ensure_localedir(self): 14 if not self.env.LOCALEDIR: 15 if self.env.DATAROOTDIR: 16 self.env.LOCALEDIR=os.path.join(self.env.DATAROOTDIR,'locale') 17 else: 18 self.env.LOCALEDIR=os.path.join(self.env.PREFIX,'share','locale') 10 19 @before_method('process_source') 11 20 @feature('intltool_in') … … 13 22 try:self.meths.remove('process_source') 14 23 except ValueError:pass 15 if not self.env.LOCALEDIR: 16 self.env.LOCALEDIR=self.env.PREFIX+'/share/locale' 24 self.ensure_localedir() 25 podir=getattr(self,'podir','.') 26 podirnode=self.path.find_dir(podir) 27 if not podirnode: 28 error("could not find the podir %r"%podir) 29 return 30 cache=getattr(self,'intlcache','.intlcache') 31 self.env.INTLCACHE=[os.path.join(str(self.path.get_bld()),podir,cache)] 32 self.env.INTLPODIR=podirnode.bldpath() 33 self.env.append_value('INTLFLAGS',getattr(self,'flags',self.env.INTLFLAGS_DEFAULT)) 34 if'-c'in self.env.INTLFLAGS: 35 self.bld.fatal('Redundant -c flag in intltool task %r'%self) 36 style=getattr(self,'style',None) 37 if style: 38 try: 39 style_flag=_style_flags[style] 40 except KeyError: 41 self.bld.fatal('intltool_in style "%s" is not valid'%style) 42 self.env.append_unique('INTLFLAGS',[style_flag]) 17 43 for i in self.to_list(self.source): 18 44 node=self.path.find_resource(i) 19 podir=getattr(self,'podir','po')20 podirnode=self.path.find_dir(podir)21 if not podirnode:22 error("could not find the podir %r"%podir)23 continue24 cache=getattr(self,'intlcache','.intlcache')25 self.env['INTLCACHE']=os.path.join(self.path.bldpath(),podir,cache)26 self.env['INTLPODIR']=podirnode.bldpath()27 self.env['INTLFLAGS']=getattr(self,'flags',['-q','-u','-c'])28 45 task=self.create_task('intltool',node,node.change_ext('')) 29 inst=getattr(self,'install_path', '${LOCALEDIR}')46 inst=getattr(self,'install_path',None) 30 47 if inst: 31 48 self.bld.install_files(inst,task.outputs) … … 34 51 try:self.meths.remove('process_source') 35 52 except ValueError:pass 36 if not self.env.LOCALEDIR: 37 self.env.LOCALEDIR=self.env.PREFIX+'/share/locale' 38 appname=getattr(self,'appname','set_your_app_name') 39 podir=getattr(self,'podir','') 53 self.ensure_localedir() 54 appname=getattr(self,'appname',getattr(Context.g_module,Context.APPNAME,'set_your_app_name')) 55 podir=getattr(self,'podir','.') 40 56 inst=getattr(self,'install_path','${LOCALEDIR}') 41 57 linguas=self.path.find_node(os.path.join(podir,'LINGUAS')) … … 63 79 color='BLUE' 64 80 class intltool(Task.Task): 65 run_str='${INTLTOOL} ${INTLFLAGS} ${INTLCACHE } ${INTLPODIR} ${SRC} ${TGT}'81 run_str='${INTLTOOL} ${INTLFLAGS} ${INTLCACHE_ST:INTLCACHE} ${INTLPODIR} ${SRC} ${TGT}' 66 82 color='BLUE' 83 @conf 84 def find_msgfmt(conf): 85 conf.find_program('msgfmt',var='MSGFMT') 86 @conf 87 def find_intltool_merge(conf): 88 if not conf.env.PERL: 89 conf.find_program('perl',var='PERL') 90 conf.env.INTLCACHE_ST='--cache=%s' 91 conf.env.INTLFLAGS_DEFAULT=['-q','-u'] 92 conf.find_program('intltool-merge',interpreter='PERL',var='INTLTOOL') 67 93 def configure(conf): 68 conf.find_program('msgfmt',var='MSGFMT') 69 conf.find_perl_program('intltool-merge',var='INTLTOOL') 70 prefix=conf.env.PREFIX 71 datadir=conf.env.DATADIR 72 if not datadir: 73 datadir=os.path.join(prefix,'share') 74 conf.define('LOCALEDIR',os.path.join(datadir,'locale').replace('\\','\\\\')) 75 conf.define('DATADIR',datadir.replace('\\','\\\\')) 94 conf.find_msgfmt() 95 conf.find_intltool_merge() 76 96 if conf.env.CC or conf.env.CXX: 77 97 conf.check(header_name='locale.h')
Note: See TracChangeset
for help on using the changeset viewer.