Hi Tobias,

Le 01/06/2011 17:38, David Prévot a écrit :
> Le 01/06/2011 15:37, Tobias Quathamer a écrit :
>> Am Mittwoch, den 01.06.2011, 15:01 -0400 schrieb David Prévot:

>> You might want to double check, though, my French is quite rusty ...

Everything seems fine thanks for your care.

> Something must be wrong in my config somewhere :/. Will check once
> resolve this issue.

I locally solved the issue by pointing directly to wagner, while
git.debian.org normally points to vasks, I must be lost in migration.

>>> […] I can offer a much simple po4a config file and
>>> appropriate rule that won't need update when a new language is added.
>>> I don't know Python enough to propose as much simple rules to handle
>>> their rst2man generation or installation, but it would be a start.
>>
>> I'd be very interested in that config file.

Well, I just tricked the wscript to do its job without being edited for
every existing documentation. I simply adapted the mo rules. You will
probably need to improve those rules, especially the man/*/isoquery.rst
generation only need to be run once to build them all. I have no Python
knowledge, but there probably is a way to declare a multiple target with
something like that:

target =
        for translation in bld.path.ant_glob('man/*.po'):
        translation.change_ext('/isoquery.rst')
        ,

The attached hackish patch just works, but po4a is run for every
translation, while it just need to be run once.

Regards

David

From 2294d16f4e6c3468fd28362d43aab7cd176d7e91 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Pr=C3=A9vot?= <[email protected]>
Date: Wed, 1 Jun 2011 17:23:43 -0400
Subject: [PATCH] Handle po4a stuff in its own cfg file

Also simplify the build accordingly.
---
 man/po4a.cfg |    7 ++++
 wscript      |   90 ++++++++++++---------------------------------------------
 2 files changed, 26 insertions(+), 71 deletions(-)
 create mode 100644 man/po4a.cfg

diff --git a/man/po4a.cfg b/man/po4a.cfg
new file mode 100644
index 0000000..26267f8
--- /dev/null
+++ b/man/po4a.cfg
@@ -0,0 +1,7 @@
+[po_directory] ../man/
+
+[po4a_alias: text] text opt:"-o markdown"
+
+[type: text] ../man/isoquery.rst \
+	$lang:man/$lang/isoquery.rst \
+	add_$lang:?../man/$lang.add
diff --git a/wscript b/wscript
index 3fb2d61..f35fe15 100644
--- a/wscript
+++ b/wscript
@@ -30,7 +30,7 @@ def configure(conf):
     conf.find_program('msgfmt', var='MSGFMT')
     conf.find_program(['rst2man','rst2man.py'], var='RST2MAN')
     conf.find_program('gzip', var='GZIP')
-    conf.find_program('po4a-translate', var='PO4A_TRANSLATE')
+    conf.find_program('po4a', var='PO4A')
     conf.check_tool('python')
     conf.check_python_version((2,4))
     conf.check_tool('gnu_dirs')
@@ -53,82 +53,30 @@ def build(bld):
         target = 'man/isoquery.1',
         rule = '${RST2MAN} ${SRC} ${TGT}',
     )
-    bld(
-        source = 'man/de.add man/de.po man/isoquery.rst',
-        target = 'man/de/isoquery.rst',
-        rule = '${PO4A_TRANSLATE} ' + \
-               '--format text ' + \
-               '--option markdown ' + \
-               '--addendum ${SRC[0].bldpath()} ' + \
-               '--po ${SRC[1].bldpath()} ' + \
-               '--master ${SRC[2].bldpath()} ' + \
-               '--master-charset UTF-8 ' + \
-               '--localized ${TGT}',
-    )
-    bld(
-        source = 'man/fr.add man/fr.po man/isoquery.rst',
-        target = 'man/fr/isoquery.rst',
-        rule = '${PO4A_TRANSLATE} ' + \
-            '--format text ' + \
-            '--option markdown ' + \
-            '--addendum ${SRC[0].bldpath()} ' + \
-            '--po ${SRC[1].bldpath()} ' + \
-            '--master ${SRC[2].bldpath()} ' + \
-            '--master-charset UTF-8 ' + \
-            '--localized ${TGT}',
-    )
-    bld(
-        source = 'man/pt.add man/pt.po man/isoquery.rst',
-        target = 'man/pt/isoquery.rst',
-        rule = '${PO4A_TRANSLATE} ' + \
-               '--format text ' + \
-               '--option markdown ' + \
-               '--addendum ${SRC[0].bldpath()} ' + \
-               '--po ${SRC[1].bldpath()} ' + \
-               '--master ${SRC[2].bldpath()} ' + \
-               '--master-charset UTF-8 ' + \
-               '--localized ${TGT}',
-    )
-    bld(
-        source = 'man/de/isoquery.rst',
-        target = 'man/de/isoquery.1',
-        rule = '${RST2MAN} ${SRC} ${TGT}',
-    )
-    bld(
-	    source = 'man/fr/isoquery.rst',
-	    target = 'man/fr/isoquery.1',
-	    rule = '${RST2MAN} ${SRC} ${TGT}',
-    )
-    bld(
-        source = 'man/pt/isoquery.rst',
-        target = 'man/pt/isoquery.1',
-        rule = '${RST2MAN} ${SRC} ${TGT}',
-    )
     # Compress and install man pages
     bld(
         source = 'man/isoquery.1',
         target = 'man/isoquery.1.gz',
         rule = '${GZIP} --best --stdout ${SRC} > ${TGT}',
     )
-    bld.install_files('${MANDIR}/man1', 'man/isoquery.1.gz')
-    bld(
-        source = 'man/de/isoquery.1',
-        target = 'man/de/isoquery.1.gz',
-        rule = '${GZIP} --best --stdout ${SRC} > ${TGT}',
-    )
-    bld.install_files('${MANDIR}/de/man1', 'man/de/isoquery.1.gz')
-    bld(
-	    source = 'man/fr/isoquery.1',
-	    target = 'man/fr/isoquery.1.gz',
-	    rule = '${GZIP} --best --stdout ${SRC} > ${TGT}',
-    )
-    bld.install_files('${MANDIR}/fr/man1', 'man/fr/isoquery.1.gz')
-    bld(
-        source = 'man/pt/isoquery.1',
-        target = 'man/pt/isoquery.1.gz',
-        rule = '${GZIP} --best --stdout ${SRC} > ${TGT}',
-    )
-    bld.install_files('${MANDIR}/pt/man1', 'man/pt/isoquery.1.gz')
+    # Generate translated man pages
+    for translation in bld.path.ant_glob('man/*.po'):
+	# Create a task for each translation file
+	bld(
+		source = 'man/po4a.cfg',
+		target = translation.change_ext('/isoquery.rst'),
+		rule = '${PO4A} ${SRC}',
+	)
+	bld(
+		source = translation.change_ext('/isoquery.rst'),
+		target = translation.change_ext('/isoquery.1'),
+		rule = '${RST2MAN} ${SRC} ${TGT}',
+	)
+	bld(
+		source = translation.change_ext('/isoquery.1'),
+		target = translation.change_ext('/isoquery.1.gz'),
+		rule = '${GZIP} --best --stdout ${SRC} > ${TGT}',
+	)
 
     # Generate .mo files
     for translation in bld.path.ant_glob('po/*.po'):
-- 
1.7.5.3

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to