summaryrefslogtreecommitdiff
path: root/po
diff options
context:
space:
mode:
authorDaniel Burrows <dburrows@debian.org>2010-04-27 17:59:39 -0700
committerDaniel Burrows <dburrows@debian.org>2010-04-27 17:59:39 -0700
commitd214de31b352de61d825f7f722dca24cc4347f7e (patch)
tree48f8e2048b6e4f87fdf95e00837725e23965c373 /po
parente59f0d38dd1b3c73ea12bb2a3c69c4ee14458cd7 (diff)
downloadaptitude-d214de31b352de61d825f7f722dca24cc4347f7e.tar.gz
Don't rebuild pofiles just because the .pot's date changed.
I tried a couple implementations, but the trick of writing a signature file that's calculated excluding the date line seemed like the cleanest option. Also, it was the only one that worked.
Diffstat (limited to 'po')
-rw-r--r--po/SConscript24
1 files changed, 22 insertions, 2 deletions
diff --git a/po/SConscript b/po/SConscript
index 51702b76..a9e0d80f 100644
--- a/po/SConscript
+++ b/po/SConscript
@@ -59,7 +59,9 @@ pofile_languages = [
'zh_TW',
]
-def BuildPoFile(env, lang, potfile = 'aptitude.pot'):
+def BuildPoFile(env, lang,
+ potfile = 'aptitude.pot',
+ potfile_sig = 'aptitude.pot.sig'):
'''Build the po file for the given language, compile it to a mo
file, and install the compiled form. Also distribute *both* the po
file and the mo file.'''
@@ -71,11 +73,29 @@ file and the mo file.'''
po_env.Dist(po_file, mo_file)
env.Install('$LOCALEDIR/$LANG/LC_MESSAGES', LANG = lang)
env.Alias('update-po', mo_file)
+
+ # Arrange to build the pofile iff the potfile signature changes.
+ env.Depends(po_file, potfile_sig)
+ env.Ignore(po_file, potfile)
+
return mo_file
aptitude_pot = po_env.Xgettext('aptitude.pot', all_aptitude_srcs)
po_env.Dist(aptitude_pot)
+# Reuse the clunky but functional POT-Creation-Date stripping script
+# from gettext.
+removepotdate = po_env.Command('remove-potcdate.sed',
+ 'remove-potcdate.sin',
+ ["sed -e '/^#/d' $SOURCE > ${TARGET}.new",
+ Move('${TARGET}', '${TARGET}.new')])
+
+aptitude_pot_sig = po_env.Command('aptitude.pot.sig',
+ aptitude_pot,
+ ['sed -f $REMOVEPOTDATE $SOURCE | sha512sum > ${TARGET}.new',
+ Move('${TARGET}', '${TARGET}.new')],
+ REMOVEPOTDATE = removepotdate)
+
# I seriously considered making aptitude.pot a default target, but
# that would pollute the version control history with a bunch of
# relatively meaningless changes. Better to only build it on request.
@@ -84,4 +104,4 @@ po_env.Alias('update-po', aptitude_pot)
# Rules relating to keeping the translations up-to-date.
for lang in pofile_languages:
- BuildPoFile(po_env, lang, aptitude_pot)
+ BuildPoFile(po_env, lang, aptitude_pot, aptitude_pot_sig)