Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate python files and UI files in the temporary PRO file #29

Merged
merged 1 commit into from Sep 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions qgispluginci/translation.py
Expand Up @@ -57,19 +57,25 @@ def update_strings(self):
"""
Update TS files from plugin source strings
"""
source_files = []
source_py_files = []
source_ui_files = []
relative_path = './{plugin_path}'.format(plugin_path=self.parameters.plugin_path)
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(relative_path)))
file_path = str(Path(file).relative_to(relative_path))
if ext == 'py':
source_py_files.append(file_path)
else:
source_ui_files.append(file_path)

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('SOURCES = {}\n'.format(' '.join(source_py_files)))
assert f.write('FORMS = {}\n'.format(' '.join(source_ui_files)))
assert f.write('TRANSLATIONS = {}\n'.format(Path(self.ts_file).relative_to(relative_path)))
f.flush()
f.close()
Expand Down