Autogenerate POTFILES.in

This commit is contained in:
Cole Robinson 2013-04-03 19:07:42 -04:00
parent d5c9f62f36
commit dfaf00af4c
3 changed files with 39 additions and 68 deletions

View File

@ -1,64 +0,0 @@
virt-manager
virt-manager-tui
data/virt-manager.desktop.in
virtManager/__init__.py
virtManager/about.py
virtManager/addhardware.py
virtManager/asyncjob.py
virtManager/choosecd.py
virtManager/clone.py
virtManager/config.py
virtManager/connect.py
virtManager/connection.py
virtManager/connectauth.py
virtManager/console.py
virtManager/create.py
virtManager/createinterface.py
virtManager/createnet.py
virtManager/createpool.py
virtManager/createvol.py
virtManager/delete.py
virtManager/details.py
virtManager/domain.py
virtManager/engine.py
virtManager/error.py
virtManager/graphwidgets.py
virtManager/halhelper.py
virtManager/host.py
virtManager/keyring.py
virtManager/manager.py
virtManager/mediadev.py
virtManager/migrate.py
virtManager/netdev.py
virtManager/network.py
virtManager/packageutils.py
virtManager/preferences.py
virtManager/remote.py
virtManager/serialcon.py
virtManager/storagebrowse.py
virtManager/storagepool.py
virtManager/storagevol.py
virtManager/systray.py
virtManager/uihelpers.py
virtManager/util.py
[type: gettext/glade]ui/vmm-about.ui
[type: gettext/glade]ui/vmm-add-hardware.ui
[type: gettext/glade]ui/vmm-choose-cd.ui
[type: gettext/glade]ui/vmm-clone.ui
[type: gettext/glade]ui/vmm-create-interface.ui
[type: gettext/glade]ui/vmm-create-net.ui
[type: gettext/glade]ui/vmm-create-pool.ui
[type: gettext/glade]ui/vmm-create-vol.ui
[type: gettext/glade]ui/vmm-create.ui
[type: gettext/glade]ui/vmm-delete.ui
[type: gettext/glade]ui/vmm-details.ui
[type: gettext/glade]ui/vmm-host.ui
[type: gettext/glade]ui/vmm-manager.ui
[type: gettext/glade]ui/vmm-migrate.ui
[type: gettext/glade]ui/vmm-open-connection.ui
[type: gettext/glade]ui/vmm-preferences.ui
[type: gettext/glade]ui/vmm-progress.ui
[type: gettext/glade]ui/vmm-storage-browse.ui

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python
import glob
import fnmatch
import os
import sys
import unittest
@ -16,6 +17,31 @@ from DistUtilsExtra.command.build_icons import build_icons
from virtcli import cliconfig
def _generate_potfiles_in():
def find(dirname, ext):
ret = []
for root, dirnames, filenames in os.walk(dirname):
for filename in fnmatch.filter(filenames, ext):
ret.append(os.path.join(root, filename))
ret.sort(key=lambda s: s.lower())
return ret
scripts = ["virt-manager", "virt-manager-tui", "virt-install",
"virt-clone", "virt-image", "virt-convert"]
potfiles = "\n".join(scripts) + "\n\n"
potfiles += "\n".join(find("virtManager", "*.py")) + "\n\n"
potfiles += "\n".join(find("virtManagerTui", "*.py")) + "\n\n"
potfiles += "\n".join(find("virtcli", "*.py")) + "\n\n"
potfiles += "\n".join(find("virtconv", "*.py")) + "\n\n"
potfiles += "\n".join(find("virtinst", "*.py")) + "\n\n"
potfiles += "\n".join(["[type: gettext/glade]" + f for
f in find("ui", "*.ui")])
return potfiles
class my_build_i18n(build_i18n):
"""
Add our desktop files to the list, saves us having to track setup.cfg
@ -26,6 +52,18 @@ class my_build_i18n(build_i18n):
self.desktop_files = ('[("share/applications",' +
' ("data/virt-manager.desktop.in", ))]')
def run(self):
potfiles = _generate_potfiles_in()
potpath = "po/POTFILES.in"
try:
print "Writing %s" % potpath
file(potpath, "w").write(potfiles)
build_i18n.run(self)
finally:
print "Removing %s" % potpath
os.unlink(potpath)
class my_build(build_extra):
"""
@ -330,7 +368,6 @@ class TestURLFetch(TestBaseCommand):
TestBaseCommand.run(self)
setup(
name = "virt-manager",
version = cliconfig.__version__,

View File

@ -4,11 +4,9 @@
virtinst merge bits:
translations:
autogenerate POTFILES
merge in existing translations from virtinst.git. may need to
massage this by hand but in my head it sounds easy enough.
make sure translations actually work when installed
why isn't distutils doing msgmerge? maybe I'm missing something
merge pylint scripts, make sure there are no warnings
break out osdistro bits so we don't need to carry virt-install.pod
merge README, reference that we merged virtinst and see that repo for
@ -75,7 +73,7 @@ setup.py rpm: dump output in sourcedir, or dist/
INSTALL docs about python setup.py refresh_translations from virtinst,
or whatever the distutils extra equiv is. or update po/README,
or have a TRANSLATORS file, or update HACKING, etc. see what other
projects do.
projects do. msgmerge with python setup.py build_i18n --merge-po
Problems in other packages