setup: Tweak extract_messages
* Use long xgettext options * Truncate .pot file upfront so every call uses --join-existing Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
fec9f0b136
commit
14f8d2ff7a
15
setup.py
15
setup.py
|
@ -657,14 +657,19 @@ class ExtractMessages(distutils.core.Command):
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
bug_address = "https://github.com/virt-manager/virt-manager/issues"
|
bug_address = "https://github.com/virt-manager/virt-manager/issues"
|
||||||
|
potfile = "po/virt-manager.pot"
|
||||||
xgettext_args = [
|
xgettext_args = [
|
||||||
"xgettext",
|
"xgettext",
|
||||||
"-F",
|
|
||||||
"--msgid-bugs-address=" + bug_address,
|
"--msgid-bugs-address=" + bug_address,
|
||||||
"-o", "po/virt-manager.pot",
|
|
||||||
"--package-name=virt-manager",
|
"--package-name=virt-manager",
|
||||||
|
"--output=" + potfile,
|
||||||
|
"--sort-by-file",
|
||||||
|
"--join-existing",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Truncate .pot file to ensure it exists
|
||||||
|
open(potfile, "w").write("")
|
||||||
|
|
||||||
# First extract the messages from the AppStream sources,
|
# First extract the messages from the AppStream sources,
|
||||||
# creating the template
|
# creating the template
|
||||||
appdata_files = [f for sublist in _appdata_files for f in sublist[1]]
|
appdata_files = [f for sublist in _appdata_files for f in sublist[1]]
|
||||||
|
@ -673,20 +678,20 @@ class ExtractMessages(distutils.core.Command):
|
||||||
|
|
||||||
# Extract the messages from the desktop files
|
# Extract the messages from the desktop files
|
||||||
desktop_files = [f for sublist in _desktop_files for f in sublist[1]]
|
desktop_files = [f for sublist in _desktop_files for f in sublist[1]]
|
||||||
cmd = xgettext_args + ["-j", "-L", "Desktop"] + desktop_files
|
cmd = xgettext_args + ["--language=Desktop"] + desktop_files
|
||||||
self.spawn(cmd)
|
self.spawn(cmd)
|
||||||
|
|
||||||
# Extract the messages from the Python sources
|
# Extract the messages from the Python sources
|
||||||
py_sources = list(Path("virtManager").rglob("*.py"))
|
py_sources = list(Path("virtManager").rglob("*.py"))
|
||||||
py_sources += list(Path("virtinst").rglob("*.py"))
|
py_sources += list(Path("virtinst").rglob("*.py"))
|
||||||
py_sources = [str(src) for src in py_sources]
|
py_sources = [str(src) for src in py_sources]
|
||||||
cmd = xgettext_args + ["-j", "-L", "Python"] + py_sources
|
cmd = xgettext_args + ["--language=Python"] + py_sources
|
||||||
self.spawn(cmd)
|
self.spawn(cmd)
|
||||||
|
|
||||||
# Extract the messages from the Glade UI files
|
# Extract the messages from the Glade UI files
|
||||||
ui_files = list(Path(".").rglob("*.ui"))
|
ui_files = list(Path(".").rglob("*.ui"))
|
||||||
ui_files = [str(src) for src in ui_files]
|
ui_files = [str(src) for src in ui_files]
|
||||||
cmd = xgettext_args + ["-j", "-L", "Glade"] + ui_files
|
cmd = xgettext_args + ["--language=Glade"] + ui_files
|
||||||
self.spawn(cmd)
|
self.spawn(cmd)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue