~ubuntu-branches/ubuntu/precise/python-distutils-extra/precise-updates

« back to all changes in this revision

Viewing changes to DistUtilsExtra/command/build_i18n.py

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt, Didier Roche, Martin Pitt
  • Date: 2010-07-21 10:46:18 UTC
  • Revision ID: james.westby@ubuntu.com-20100721104618-x2eoo0bbx4xbtrpu
Tags: 2.20
[ Didier Roche ]
* build_i18n.py: add support for LINGUAS (Siegfried Gevatter) (LP: #510957)

[ Martin Pitt ]
* debian/local/python-mkdebian: Make langpack.mk include optional, as it
  only exists in Ubuntu, not Debian. (Closes: #589802)
* debian/local/python-mkdebian: If we are on Debian, set upload target to
  "unstable". (Closes: #589794)

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
         from setup.cfg.
78
78
         Remove the Makefile to avoid problems.""")
79
79
 
 
80
        # If there is a po/LINGUAS file, or the LINGUAS environment variable
 
81
        # is set, only compile the languages listed there.
 
82
        selected_languages = None
 
83
        linguas_file = os.path.join(self.po_dir, "LINGUAS")
 
84
        if os.path.isfile(linguas_file):
 
85
            selected_languages = open(linguas_file).read().split()
 
86
        if "LINGUAS" in os.environ:
 
87
            selected_languages = os.environ["LINGUAS"].split()
 
88
 
80
89
        # Update po(t) files and print a report
81
90
        # We have to change the working dir to the po dir for intltool
82
91
        cmd = ["intltool-update", (self.merge_po and "-r" or "-p"), "-g", self.domain]
87
96
        max_po_mtime = 0
88
97
        for po_file in glob.glob("%s/*.po" % self.po_dir):
89
98
            lang = os.path.basename(po_file[:-3])
 
99
            if selected_languages and not lang in selected_languages:
 
100
                continue
90
101
            mo_dir =  os.path.join("build", "mo", lang, "LC_MESSAGES")
91
102
            mo_file = os.path.join(mo_dir, "%s.mo" % self.domain)
92
103
            if not os.path.exists(mo_dir):