diff --git a/scripts/build.sh b/scripts/build.sh index 2b72bb4..151ca3b 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -4,24 +4,49 @@ set -ex rm -rf build dist export TMPDIR=/var/tmp/ +export PYI_LOG_LEVEL=WARN -pyinstaller -y --onefile \ - --optimize 2 \ - --name md2po \ - --copy-metadata mdpo \ - src/mdpo/md2po/__main__.py -pyinstaller -y --onefile \ - --optimize 2 \ - --name po2md \ - --copy-metadata mdpo \ - src/mdpo/po2md/__main__.py -pyinstaller -y --onefile \ - --optimize 2 \ - --name md2po2md \ - --copy-metadata mdpo \ - src/mdpo/md2po2md/__main__.py -pyinstaller -y --onefile \ - --optimize 2 \ - --name mdpo2html \ - --copy-metadata mdpo \ - src/mdpo/mdpo2html/__main__.py +mdpo() { + pyinstaller -y --onefile \ + --optimize 2 \ + --name md2po \ + --copy-metadata mdpo \ + src/mdpo/md2po/__main__.py +} + +po2md() { + pyinstaller -y --onefile \ + --optimize 2 \ + --name po2md \ + --copy-metadata mdpo \ + src/mdpo/po2md/__main__.py +} + +md2po2md() { + pyinstaller -y --onefile \ + --optimize 2 \ + --name md2po2md \ + --copy-metadata mdpo \ + src/mdpo/md2po2md/__main__.py +} + +mdpo2html() { + pyinstaller -y --onefile \ + --optimize 2 \ + --name mdpo2html \ + --copy-metadata mdpo \ + src/mdpo/mdpo2html/__main__.py +} + +# Parallel build on Linux +if [ $(uname) = "Linux" ]; then + mdpo & + po2md & + md2po2md & + mdpo2html +else + mdpo + po2md + md2po2md + mdpo2html +fi diff --git a/src/mdpo/md2po/__init__.py b/src/mdpo/md2po/__init__.py index bc1c0ae..2eba65d 100644 --- a/src/mdpo/md2po/__init__.py +++ b/src/mdpo/md2po/__init__.py @@ -1044,11 +1044,12 @@ def _parse(content): self.found_entries, ) elif self.mark_not_found_as_obsolete: - mark_not_found_entries_as_obsoletes( + obsoletes = mark_not_found_entries_as_obsoletes( self.pofile, self.found_entries, ) - self.obsoletes = True + if not self.obsoletes: + self.obsoletes = obsoletes if self.metadata: self.pofile.metadata.update(self.metadata) diff --git a/src/mdpo/po.py b/src/mdpo/po.py index 5c888cd..dde3408 100644 --- a/src/mdpo/po.py +++ b/src/mdpo/po.py @@ -62,6 +62,7 @@ def mark_not_found_entries_as_obsoletes( will be marked as obsoletes. entries (list): Entries to search against. """ + obsolete = False for entry in pofile: if not find_entry_in_entries( entry, @@ -78,8 +79,10 @@ def mark_not_found_entries_as_obsoletes( pofile.remove(entry) else: entry.obsolete = True + obsolete = True else: entry.obsolete = False + return obsolete def remove_not_found_entries(pofile, entries): diff --git a/tests/test_unit/test_md2po/test_md2po_cli.py b/tests/test_unit/test_md2po/test_md2po_cli.py index 5558214..7aa68dd 100644 --- a/tests/test_unit/test_md2po/test_md2po_cli.py +++ b/tests/test_unit/test_md2po/test_md2po_cli.py @@ -771,12 +771,9 @@ def test_no_obsolete(capsys, arg, tmp_file): pofile, exitcode = run([arg, '-p', filename, '--no-location', 'Bye']) stdout, stderr = capsys.readouterr() - assert exitcode == 3 + assert exitcode == 0 assert f'{pofile}\n' == expected_output assert stdout == expected_output - assert stderr == ( - f"Obsolete messages found at {filename} and passed '--no-obsolete'\n" - ) @pytest.mark.parametrize('arg', ('--no-empty-msgstr',))