Ticket #13936: makemessages.py.patch

File makemessages.py.patch, 2.3 KB (added by ciupicri, 5 years ago)

Patch for "makemessages.py"

  • makemessages.py

    old new  
    3838    # trick xgettext to parse them as Python files)
    3939    return set([x for x in ext_list if x != '.py'])
    4040
    41 def _popen(cmd):
     41def _popen(cmd, cwd=None):
    4242    """
    4343    Friendly wrapper around Popen for Windows
    4444    """
    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)
    4646    return p.communicate()
    4747
    4848def walk(root, topdown=True, onerror=None, followlinks=False):
     
    190190                    f.write(src)
    191191                finally:
    192192                    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)
    195195                if errors:
    196196                    raise CommandError("errors happened while running xgettext on %s\n%s" % (file, errors))
    197197                old = '#: '+os.path.join(dirpath, thefile)[2:]
     
    226226                if verbosity > 1:
    227227                    sys.stdout.write('processing file %s in %s\n' % (file, dirpath))
    228228                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)
    231231                if errors:
    232232                    raise CommandError("errors happened while running xgettext on %s\n%s" % (file, errors))
    233233
Back to Top