Mercurial > p > roundup > code
annotate roundup/dist/command/build_doc.py @ 7052:4b6a6b794dfa
Fix errors in po files.
Trying to get translation files in shape for translationproject.org.
Not sure it wil happen but this checkin fixes errors in .po files found
by msgfmt -cv.
Recreated template and merged into .po files.
Also adds potest to makefile targets and improves diff target.
Fixes:
Project-Id-Version changed to 2.3.0. I can't find doc on what this
is supposed to be. I assume it is to match the .po file to the
release since there are other fields for recording the last
update to the translations.
Language header, is often blank. Added Language-Team value where missing.
Plural-Forms header for a couple of languages per:
https://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html
Japanese still has an issue. There are plural forms defined in the
file, but according to the above, there should only be one form.
I don't know Japanese, so am not qualified to remove the plural
forms or change the Plural-Forms header to the expected:
nplurals=1; plural=0;
So I have left it with: nplurals=2; plural=0;\n"
Which will always choose the first plural form (index 0).
Added Last-Translator, Language and Content-Transfer-Encoding for
en.po.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 20 Nov 2022 11:29:31 -0500 |
| parents | 42bf0a707763 |
| children | 4ff18b1cd9bf |
| rev | line source |
|---|---|
|
4033
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
1 # |
|
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
2 # Copyright (C) 2009 Stefan Seefeld |
|
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
3 # All rights reserved. |
|
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
4 # For license terms see the file COPYING.txt. |
|
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
5 # |
|
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
6 |
|
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
7 import os, sys |
|
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
8 import os.path |
|
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
9 import glob |
|
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
10 |
|
6647
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
5074
diff
changeset
|
11 try: |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
5074
diff
changeset
|
12 from setuptools.command.install import install as _build_py |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
5074
diff
changeset
|
13 raise ImportError |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
5074
diff
changeset
|
14 except ImportError: |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
5074
diff
changeset
|
15 from distutils.command.build import build as _build_py # try/except clause |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
5074
diff
changeset
|
16 orig_build = _build_py |
|
4033
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
17 |
|
6647
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
5074
diff
changeset
|
18 try: |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
5074
diff
changeset
|
19 # would be nice to use setuptools.Command.spawn() as it |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
5074
diff
changeset
|
20 # obeys the dry-run flag. |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
5074
diff
changeset
|
21 from subprocess import run as spawn |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
5074
diff
changeset
|
22 except ImportError: |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
5074
diff
changeset
|
23 from distutils.spawn import spawn # try/except: in except for subprocess |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
5074
diff
changeset
|
24 |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
5074
diff
changeset
|
25 try: |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
5074
diff
changeset
|
26 from distutils.spawn import find_executable # try/except: in try local find |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
5074
diff
changeset
|
27 except ImportError: |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
5074
diff
changeset
|
28 from roundup.dist.command import find_executable |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
5074
diff
changeset
|
29 |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
5074
diff
changeset
|
30 class build_doc(_build_py): |
|
4033
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
31 """Defines the specific procedure to build roundup's documentation.""" |
|
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
32 |
|
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
33 description = "build documentation" |
|
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
34 |
|
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
35 def run(self): |
|
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
36 """Run this command, i.e. do the actual document generation.""" |
|
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
37 |
|
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
38 sphinx = find_executable('sphinx-build') |
|
4810
7b575e1f7368
setup.py build_doc: try Python-installed Sphinx if command
anatoly techtonik <techtonik@gmail.com>
parents:
4033
diff
changeset
|
39 if sphinx: |
|
7b575e1f7368
setup.py build_doc: try Python-installed Sphinx if command
anatoly techtonik <techtonik@gmail.com>
parents:
4033
diff
changeset
|
40 sphinx = [sphinx] |
|
7b575e1f7368
setup.py build_doc: try Python-installed Sphinx if command
anatoly techtonik <techtonik@gmail.com>
parents:
4033
diff
changeset
|
41 else: |
|
7b575e1f7368
setup.py build_doc: try Python-installed Sphinx if command
anatoly techtonik <techtonik@gmail.com>
parents:
4033
diff
changeset
|
42 try: # try to find version installed with Python tools |
|
7b575e1f7368
setup.py build_doc: try Python-installed Sphinx if command
anatoly techtonik <techtonik@gmail.com>
parents:
4033
diff
changeset
|
43 # tested with Sphinx 1.1.3 |
|
7b575e1f7368
setup.py build_doc: try Python-installed Sphinx if command
anatoly techtonik <techtonik@gmail.com>
parents:
4033
diff
changeset
|
44 import sphinx as sp |
|
7b575e1f7368
setup.py build_doc: try Python-installed Sphinx if command
anatoly techtonik <techtonik@gmail.com>
parents:
4033
diff
changeset
|
45 except ImportError: |
|
7b575e1f7368
setup.py build_doc: try Python-installed Sphinx if command
anatoly techtonik <techtonik@gmail.com>
parents:
4033
diff
changeset
|
46 pass |
|
7b575e1f7368
setup.py build_doc: try Python-installed Sphinx if command
anatoly techtonik <techtonik@gmail.com>
parents:
4033
diff
changeset
|
47 else: |
|
7b575e1f7368
setup.py build_doc: try Python-installed Sphinx if command
anatoly techtonik <techtonik@gmail.com>
parents:
4033
diff
changeset
|
48 sphinx = [sys.executable, sp.__file__] |
|
7b575e1f7368
setup.py build_doc: try Python-installed Sphinx if command
anatoly techtonik <techtonik@gmail.com>
parents:
4033
diff
changeset
|
49 |
|
4033
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
50 if not sphinx: |
|
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
51 self.warn("could not find sphinx-build in PATH") |
|
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
52 self.warn("cannot build documentation") |
|
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
53 return |
|
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
54 |
|
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
55 doc_dir = os.path.join('share', 'doc', 'roundup', 'html') |
|
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
56 temp_dir = os.path.join(self.build_temp, 'doc') |
|
4810
7b575e1f7368
setup.py build_doc: try Python-installed Sphinx if command
anatoly techtonik <techtonik@gmail.com>
parents:
4033
diff
changeset
|
57 cmd = sphinx + ['-d', temp_dir, 'doc', doc_dir] |
|
4033
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
diff
changeset
|
58 spawn(cmd) |
