Commit 1ca8aec1 authored by Julien Pivotto's avatar Julien Pivotto

Limit changes per subprocess

Signed-off-by: Julien Pivotto's avatarJulien Pivotto <roidelapluie@inuits.eu>
parent cfdc1cc7
......@@ -31,55 +31,60 @@ class Pox:
def regen_pofiles(self, generate_pot=True):
logging.debug('Regenerating pofiles')
_dirpath = os.path.dirname(os.environ['WL_FILEMASK'])
if _dirpath == '':
_dirpath = '.'
for dirpath, _, filenames in os.walk('.'):
if 'locale.pot' in filenames:
logging.debug('Found potfiles in %s' % dirpath)
logging.debug('Pot in %s' % dirpath)
potfiles = self.get_pot_files(filenames)
for potfilename in potfiles:
orig_filename = '%s.en.xhtml' % (potfilename.split('.')[1])
command = ['html2po',
os.path.join(dirpath, orig_filename),
'-P',
os.path.join(dirpath, potfilename)]
if not dirpath == _dirpath:
logging.debug('%s != %s' % (dirpath, _dirpath))
continue
logging.debug('Found potfiles in %s' % dirpath)
logging.debug('Pot in %s' % dirpath)
potfiles = self.get_pot_files(filenames)
for potfilename in potfiles:
orig_filename = '%s.en.xhtml' % (potfilename.split('.')[1])
command = ['html2po',
os.path.join(dirpath, orig_filename),
'-P',
os.path.join(dirpath, potfilename)]
logging.info('Running %s' % ' '.join(command))
subprocess.call(command)
with open(os.path.join(dirpath, potfilename)) as f:
lines = f.readlines()
with open(os.path.join(dirpath, potfilename), 'w') as f:
changed = False
for line in lines:
if line.startswith('"POT-Creation-Date:') and not changed:
changed = True
else:
f.write(line)
try:
command = ['git', 'add', os.path.join(dirpath, potfilename)]
logging.info('Running %s' % ' '.join(command))
subprocess.call(command)
with open(os.path.join(dirpath, potfilename)) as f:
lines = f.readlines()
with open(os.path.join(dirpath, potfilename), 'w') as f:
changed = False
for line in lines:
if line.startswith('"POT-Creation-Date:') and not changed:
changed = True
else:
f.write(line)
try:
command = ['git', 'add', os.path.join(dirpath, potfilename)]
logging.info('Running %s' % ' '.join(command))
subprocess.call(command)
except:
pass
if len(potfiles) > 0:
command = ['msgcat'] + sorted([os.path.join(dirpath, x) for x in potfiles]) + ['-o', os.path.join(dirpath, 'locale.pot')]
except:
pass
if len(potfiles) > 0:
command = ['msgcat'] + sorted([os.path.join(dirpath, x) for x in potfiles]) + ['-o', os.path.join(dirpath, 'locale.pot')]
logging.info('Running %s' % ' '.join(command))
subprocess.call(command)
try:
command = ['git', 'add', os.path.join(dirpath, 'locale.pot')]
logging.info('Running %s' % ' '.join(command))
subprocess.call(command)
try:
command = ['git', 'add', os.path.join(dirpath, 'locale.pot')]
logging.info('Running %s' % ' '.join(command))
subprocess.call(command)
except:
pass
pofiles = self.get_po_files(filenames)
for pofile in pofiles:
command = ['msgmerge', '--backup=off', '-U', os.path.join(dirpath, pofile), os.path.join(dirpath, 'locale.pot')]
except:
pass
pofiles = self.get_po_files(filenames)
for pofile in pofiles:
command = ['msgmerge', '--backup=off', '-U', os.path.join(dirpath, pofile), os.path.join(dirpath, 'locale.pot')]
logging.info('Running %s' % ' '.join(command))
subprocess.call(command)
try:
command = ['git', 'add', os.path.join(dirpath, pofile)]
logging.info('Running %s' % ' '.join(command))
subprocess.call(command)
try:
command = ['git', 'add', os.path.join(dirpath, pofile)]
logging.info('Running %s' % ' '.join(command))
subprocess.call(command)
except:
pass
except:
pass
logging.debug('End Of Regenerating pofiles')
def walk_into_dirs(self, generate_pot=False):
......
......@@ -26,6 +26,7 @@ do
done
for i in tests/e;
do
export WL_FILEMASK="*.pot"
name="$(basename $i)"
echo "-------------${name//?/-}"
echo "Running test $name"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment