Skip to content

Commit

Permalink
Revert "Create temporary .pro file to make pylupdate5 work with unico…
Browse files Browse the repository at this point in the history
…de chars"

This reverts commit ff34fec.
  • Loading branch information
suricactus committed Jul 14, 2020
1 parent ff34fec commit 409cf7f
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions qgispluginci/translation.py
@@ -1,7 +1,6 @@

import glob
import subprocess
from pathlib import Path
from pytransifex import Transifex
from qgispluginci.parameters import Parameters
from qgispluginci.exceptions import TranslationFailed, TransifexNoResource, TransifexManyResources
Expand Down Expand Up @@ -57,28 +56,14 @@ def update_strings(self):
"""
Update TS files from plugin source strings
"""
source_files = []
cmd = [self.parameters.pylupdate5_path, '-noobsolete']
for ext in ('py', 'ui'):
for file in glob.glob('{dir}/**/*.{ext}'.format(dir=self.parameters.plugin_path, ext=ext), recursive=True):
source_files.append(str(Path(file).relative_to('./qgis_plugin_ci_testing')))

cmd.append(file)
touch_file(self.ts_file)

project_file = Path(self.parameters.plugin_path).joinpath(self.parameters.plugin_name + '.pro')

with open(project_file, 'w') as f:
assert f.write('CODECFORTR = UTF-8\n')
assert f.write('SOURCES = {}\n'.format(' '.join(source_files)))
assert f.write('TRANSLATIONS = {}\n'.format(Path(self.ts_file).relative_to('./qgis_plugin_ci_testing')))
f.flush()
f.close()

cmd = [self.parameters.pylupdate5_path, '-noobsolete', str(project_file)]

cmd.append('-ts')
cmd.append(self.ts_file)
output = subprocess.run(cmd, capture_output=True, text=True)

project_file.unlink()

if output.returncode != 0:
raise TranslationFailed(output.stderr)
else:
Expand Down

0 comments on commit 409cf7f

Please sign in to comment.