Automatically compile `*.mo files from *.po` files.

This commit is contained in:
Takayuki Shimizukawa
2014-08-03 16:22:08 +09:00
parent eb8dbf4631
commit eaed3ca9f1
11 changed files with 403 additions and 2 deletions

View File

@@ -7,6 +7,7 @@
:license: BSD, see LICENSE for details.
"""
import os
import sys
import tempfile
import shutil
@@ -233,3 +234,11 @@ def sprint(*args):
_unicode_literals_re = re.compile(r'u(".*?")|u(\'.*?\')')
def remove_unicode_literals(s):
return _unicode_literals_re.sub(lambda x: x.group(1) or x.group(2), s)
def find_files(root, suffix=None):
for dirpath, dirs, files in os.walk(root, followlinks=True):
dirpath = path(dirpath)
for f in [f for f in files if not suffix or f.endswith(suffix)]:
fpath = dirpath / f
yield os.path.relpath(fpath, root)