Commits

Anonymous committed a38ae59

fix some errors and add module test

Comments (0)

Files changed (6)

src/engine/SCons/Action.py

         name = self.function_name()
         if name == 'ActionCaller':
             return str(self.execfunction)
-        return _("%s(target, source, env)") % name
+        return "%s(target, source, env)" % name
 
     def execute(self, target, source, env, executor=None):
         exc_info = (None,None,None)

src/engine/SCons/Builder.py

             for src in map(str, source):
                 my_ext = match_splitext(src, suffixes)[1]
                 if ext and my_ext != ext:
-                    raise UserError(_("While building `%(target)s' from `%(source)s': Cannot build multiple sources with different extensions: %(ext)s, %(myext)s") % {"target":repr(map(str, target)), "source":src, "ext":ext, "my_ext":my_ext)}
+                    raise UserError(_("While building `%(target)s' from `%(source)s': Cannot build multiple sources with different extensions: %(ext)s, %(my_ext)s") % {"target":repr(map(str, target)), "source":src, "ext":ext, "my_ext":my_ext})
                 ext = my_ext
         else:
             ext = match_splitext(str(source[0]), self.src_suffixes())[1]

src/engine/SCons/CacheDir.py

                 self.debugFP = None
             self.current_cache_debug = cache_debug
         if self.debugFP:
-            self.debugFP.write(fmt % {"t":target, "cachefile":os.path.split(cachefile)[1])}
+            self.debugFP.write(fmt % {"t":target, "cachefile":os.path.split(cachefile)[1]})
 
     def is_enabled(self):
         return (cache_enabled and not self.path is None)

src/engine/SCons/SConsign.py

                 raise
             except Exception, e:
                 SCons.Warnings.warn(SCons.Warnings.CorruptSConsignWarning,
-                                   _("Ignoring corrupt sconsign entry : %(tpath)s (%(e)s)\n")%{"tpath":self.dir.tpath, "e":e)}
+                                   _("Ignoring corrupt sconsign entry : %(tpath)s (%(e)s)\n")%{"tpath":self.dir.tpath, "e":e})
             for key, entry in self.entries.items():
                 entry.convert_from_sconsign(dir, key)
 

src/engine/SCons/i18nTests.py

+# *-* coding: utf-8 *-*
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import os
+import sys
+import unittest
+import gettext
+
+from SCons.i18n import _, N_
+
+class i18nTestCase(unittest.TestCase):
+    def test_noop_func(self):
+        assert N_("Test Text") == "Test Text"
+
+    def test_gettext_func(self):
+        # compile a translated catalog temporarily
+        os.system("msgfmt i18n/tr.po -o /tmp/tr/LC_MESSAGES/scons.mo")
+
+        # set LC_ALL to "tr" to test gettext
+        os.environ["LC_ALL"] = "tr"
+
+        text = _("Usage")
+        assert text == "Kullanım", text
+
+if __name__ == "__main__":
+    suite = unittest.TestSuite()
+    tclasses = [ i18nTestCase,
+               ]
+    for tclass in tclasses:
+        names = unittest.getTestCaseNames(tclass, 'test_')
+        suite.addTests(map(tclass, names))
+    if not unittest.TextTestRunner().run(suite).wasSuccessful():
+        sys.exit(1)
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
         else:
             self.data_files = []
 
-        for locale in locales:
-            dst = os.path.join("share", "locale", locale, "LC_MESSAGES")
-            self.data_files.append( (dst, ["i18n/%s/scons.mo" % locale] ) )
+#        for locale in locales:
+#            dst = os.path.join("share", "locale", locale, "LC_MESSAGES")
+#            self.data_files.append( (dst, ["./i18n/%s/scons.mo" % locale] ) )
 
 description = "Open Source next-generation build tool."