Ticket #13936: makemessages.py.patch
File makemessages.py.patch, 2.3 KB (added by , 14 years ago) |
---|
-
makemessages.py
old new 38 38 # trick xgettext to parse them as Python files) 39 39 return set([x for x in ext_list if x != '.py']) 40 40 41 def _popen(cmd ):41 def _popen(cmd, cwd=None): 42 42 """ 43 43 Friendly wrapper around Popen for Windows 44 44 """ 45 p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE, close_fds=os.name != 'nt', universal_newlines=True )45 p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE, close_fds=os.name != 'nt', universal_newlines=True, cwd=cwd) 46 46 return p.communicate() 47 47 48 48 def walk(root, topdown=True, onerror=None, followlinks=False): … … 190 190 f.write(src) 191 191 finally: 192 192 f.close() 193 cmd = 'xgettext -d %s -L Perl --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy:1,2 --from-code UTF-8 -o - "%s"' % (domain, os.path.join( dirpath, thefile))194 msgs, errors = _popen(cmd )193 cmd = 'xgettext -d %s -L Perl --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy:1,2 --from-code UTF-8 -o - "%s"' % (domain, os.path.join(os.path.relpath(dirpath, basedir), thefile)) 194 msgs, errors = _popen(cmd, cwd=basedir) 195 195 if errors: 196 196 raise CommandError("errors happened while running xgettext on %s\n%s" % (file, errors)) 197 197 old = '#: '+os.path.join(dirpath, thefile)[2:] … … 226 226 if verbosity > 1: 227 227 sys.stdout.write('processing file %s in %s\n' % (file, dirpath)) 228 228 cmd = 'xgettext -d %s -L Python --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy:1,2 --keyword=ugettext_noop --keyword=ugettext_lazy --keyword=ungettext_lazy:1,2 --from-code UTF-8 -o - "%s"' % ( 229 domain, os.path.join( dirpath, thefile))230 msgs, errors = _popen(cmd )229 domain, os.path.join(os.path.relpath(dirpath, basedir), thefile)) 230 msgs, errors = _popen(cmd, cwd=basedir) 231 231 if errors: 232 232 raise CommandError("errors happened while running xgettext on %s\n%s" % (file, errors)) 233 233