damned-lies r1332 - in trunk: . stats stats/tests
- From: claudep svn gnome org
- To: svn-commits-list gnome org
- Subject: damned-lies r1332 - in trunk: . stats stats/tests
- Date: Sat, 10 Jan 2009 16:10:28 +0000 (UTC)
Author: claudep
Date: Sat Jan 10 16:10:28 2009
New Revision: 1332
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1332&view=rev
Log:
2009-01-10 Claude Paroz <claude 2xlibre net>
* stats/models.py: Put XGETTEXT_ARG in env dict.
Add --previous to msgmerge call.
Fixes bug #550208.
* stats/tests/__init__.py: Make test really pass!
Modified:
trunk/ChangeLog
trunk/stats/models.py
trunk/stats/tests/__init__.py
Modified: trunk/stats/models.py
==============================================================================
--- trunk/stats/models.py (original)
+++ trunk/stats/models.py Sat Jan 10 16:10:28 2009
@@ -325,7 +325,7 @@
# 6. Update language po files and update DB
# *****************************************
- command = "msgmerge -o %(outpo)s %(pofile)s %(potfile)s"
+ command = "msgmerge --previous -o %(outpo)s %(pofile)s %(potfile)s"
stats_with_linguas_errors = Statistics.objects.filter(branch=self, domain=dom, information__description__contains='LINGUAS')
langs_with_linguas_errors = [stat.language.locale for stat in stats_with_linguas_errors]
for lang, pofile in self.get_lang_files(dom, domain_path):
@@ -530,11 +530,10 @@
pot_command = self.pot_method
podir = vcs_path
+ env = None
if not self.pot_method: # default is intltool
- pot_command = r"""XGETTEXT_ARGS="\"--msgid-bugs-address=%(bugs_enterurl)s\"" intltool-update -g '%(domain)s' -p""" % {
- 'bugs_enterurl': self.module.get_bugs_enter_url(),
- 'domain': self.potbase()
- }
+ env = {"XGETTEXT_ARGS": "\"--msgid-bugs-address=%s\"" % self.module.get_bugs_enter_url()}
+ pot_command = "intltool-update -g '%(domain)s' -p" % {'domain': self.potbase()}
elif self.module.name == 'damned-lies':
# special case for d-l, pot file should be generated from running instance dir
podir = "."
@@ -543,7 +542,7 @@
"dir" : podir,
"pot_command" : pot_command,
}
- (status, output, errs) = utils.run_shell_command(command)
+ (status, output, errs) = utils.run_shell_command(command, env=env)
potfile = os.path.join(vcs_path, self.potbase() + ".pot")
Modified: trunk/stats/tests/__init__.py
==============================================================================
--- trunk/stats/tests/__init__.py (original)
+++ trunk/stats/tests/__init__.py Sat Jan 10 16:10:28 2009
@@ -48,7 +48,7 @@
def testCreateAndDeleteBranch(self):
# Create branch (include checkout)
- branch = Branch(name="trunk",
+ branch = Branch(name="HEAD",
module = self.mod)
branch.save()
self.assertTrue(branch.is_head())
@@ -70,36 +70,37 @@
# Link gnome-hello trunk to a string_frozen release
cat = Category(release=self.rel, branch=branch, name='desktop')
cat.save()
-
+
# Create a new file with translation
- new_file_path = os.path.join(branch.co_path(), "dummy_file.h")
+ new_file_path = os.path.join(branch.co_path(), "dummy_file.py")
new_string = "Dummy string for D-L tests"
f = open(new_file_path,'w')
- f.write("a = _('%s')" % new_string)
+ f.write("a = _('%s')\n" % new_string)
f.close()
# Add the new file to POTFILES.in
f = open(os.path.join(branch.co_path(), "po", "POTFILES.in"), 'a')
- f.write("dummy_file.h")
+ f.write("dummy_file.py\n")
f.close()
# Regenerate stats (mail should be sent)
branch.update_stats(force=False)
# Assertions
self.assertEquals(len(mail.outbox), 1);
- self.assertEquals(mail.outbox[0].subject, "String additions to '%s'")
- self.assertTrue(new_string in mail.outbox[0].message)
+ self.assertEquals(mail.outbox[0].subject, "String additions to 'gnome-hello.HEAD'")
+ self.assertTrue(mail.outbox[0].message().as_string().find(new_string)>-1)
# Detect warning if translated figure is identical to original figure
orig_figure = os.path.join(branch.co_path(), "help", "C", "figures", "gnome-hello.png")
shutil.copy(orig_figure, os.path.join(branch.co_path(), "help", "fr", "figures", "gnome-hello.png"))
branch.update_stats(force=True)
- stat = Statistics.objects.get(branch=branch, domain__name='help', language__locale='fr')
- warn_infos = Information.objects.filter(statistics=stat, type='warn')
+ doc_stat = Statistics.objects.get(branch=branch, domain__name='help', language__locale='fr')
+ warn_infos = Information.objects.filter(statistics=doc_stat, type='warn')
self.assertEquals(len(warn_infos), 1);
- self.assertEquals(stat.po_url(), "/POT/gnome-hello.HEAD/gnome-hello.HEAD.fr.po");
+ ui_stat = Statistics.objects.get(branch=branch, domain__name='po', language__locale='fr')
+ self.assertEquals(ui_stat.po_url(), u"/POT/gnome-hello.HEAD/gnome-hello.HEAD.fr.po");
# Delete the branch (removing the repo checkout in the file system)
checkout_path = branch.co_path()
- branch = Branch.objects.get(name="trunk", module = self.mod)
+ branch = Branch.objects.get(name="HEAD", module = self.mod)
branch.delete()
self.assertFalse(os.access(checkout_path, os.F_OK))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]