diff options
author | Cole Robinson <crobinso@redhat.com> | 2013-04-03 19:07:42 -0400 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2013-04-03 19:42:59 -0400 |
commit | dfaf00af4c29a2dd59afe78f1f249f17cc1dad0e (patch) | |
tree | bbd476f2239371c1cd82cea5b3c98f4b3bcf77a6 /setup.py | |
parent | d5c9f62f363450784beb801af955e920ee4b3ea4 (diff) | |
download | virt-manager-dfaf00af4c29a2dd59afe78f1f249f17cc1dad0e.tar.gz |
Autogenerate POTFILES.in
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 39 |
1 files changed, 38 insertions, 1 deletions
@@ -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__, |