Ticket #7084: t7084-r8534.diff

File t7084-r8534.diff, 2.9 KB (added by Ramiro Morales, 16 years ago)

New version of patch, makemessages always creates/update .po files with Unix line-endings, even on Windows

  • django/core/management/commands/makemessages.py

     
    9797            if domain == 'djangojs' and file_ext == '.js':
    9898                if verbosity > 1:
    9999                    sys.stdout.write('processing file %s in %s\n' % (file, dirpath))
    100                 src = open(os.path.join(dirpath, file), "rb").read()
     100                src = open(os.path.join(dirpath, file), "rU").read()
    101101                src = pythonize_re.sub('\n#', src)
    102                 open(os.path.join(dirpath, '%s.py' % file), "wb").write(src)
    103102                thefile = '%s.py' % file
     103                open(os.path.join(dirpath, thefile), "w").write(src)
    104104                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))
    105105                (stdin, stdout, stderr) = os.popen3(cmd, 't')
    106106                msgs = stdout.read()
     
    121121            elif domain == 'django' and (file_ext == '.py' or file_ext in extensions):
    122122                thefile = file
    123123                if file_ext in extensions:
    124                     src = open(os.path.join(dirpath, file), "rb").read()
     124                    src = open(os.path.join(dirpath, file), "rU").read()
    125125                    thefile = '%s.py' % file
    126                     open(os.path.join(dirpath, thefile), "wb").write(templatize(src))
     126                    open(os.path.join(dirpath, thefile), "w").write(templatize(src))
    127127                if verbosity > 1:
    128128                    sys.stdout.write('processing file %s in %s\n' % (file, dirpath))
    129129                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"' % (
     
    148148                    os.unlink(os.path.join(dirpath, thefile))
    149149
    150150        if os.path.exists(potfile):
    151             (stdin, stdout, stderr) = os.popen3('msguniq --to-code=utf-8 "%s"' % potfile, 'b')
     151            (stdin, stdout, stderr) = os.popen3('msguniq --to-code=utf-8 "%s"' % potfile, 't')
    152152            msgs = stdout.read()
    153153            errors = stderr.read()
    154154            if errors:
    155155                raise CommandError("errors happened while running msguniq\n%s" % errors)
    156156            open(potfile, 'w').write(msgs)
    157157            if os.path.exists(pofile):
    158                 (stdin, stdout, stderr) = os.popen3('msgmerge -q "%s" "%s"' % (pofile, potfile), 'b')
     158                (stdin, stdout, stderr) = os.popen3('msgmerge -q "%s" "%s"' % (pofile, potfile), 't')
    159159                msgs = stdout.read()
    160160                errors = stderr.read()
    161161                if errors:
Back to Top