Merge lp:~cboylan/boots/boots_setup into lp:boots

Proposed by Clark Boylan
Status: Merged
Merged at revision: not available
Proposed branch: lp:~cboylan/boots/boots_setup
Merge into: lp:boots
Diff against target: 94 lines (+35/-7)
3 files modified
boots/lib/__init__.py (+1/-1)
locale/README.txt (+3/-1)
setup.py (+31/-5)
To merge this branch: bzr merge lp:~cboylan/boots/boots_setup
Reviewer Review Type Date Requested Status
Boots Developers Pending
Review via email: mp+21709@code.launchpad.net

Description of the change

I have updated the setup.py file to compile .mo files from .po files and install them to /usr/share/locale/language/LC_MESSAGES/boots.mo. As part of this I moved boots/po to boots/locale. Now each translation .po file should go in boots/locale/language/LC_MESSAGES/language.po. These files are compiled to boots/locale/language/LC_MESSAGES/boots.mo before being installed. To allow an mo file to be installed add a path to its .po file to the list in setup.py.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'boots.py' (properties changed: +x to -x)
2=== modified file 'boots/lib/__init__.py'
3--- boots/lib/__init__.py 2010-03-14 22:29:40 +0000
4+++ boots/lib/__init__.py 2010-03-19 05:48:21 +0000
5@@ -1,4 +1,4 @@
6 import gettext
7 translation = gettext.translation("boots", fallback=True)
8 _ = translation.ugettext
9-n_ = translation.ungettext
10\ No newline at end of file
11+n_ = translation.ungettext
12
13=== renamed directory 'po' => 'locale'
14=== modified file 'locale/README.txt'
15--- po/README.txt 2010-03-07 09:17:54 +0000
16+++ locale/README.txt 2010-03-19 05:48:21 +0000
17@@ -13,4 +13,6 @@
18 should be wrapped as such:
19 help = _("Execute commands from file and exit"))
20
21-2) Generate the updated .pot file by running the /boots/po/createpots.sh script. This will overwrite the existing pot.cms file. Any prevously generated .po .mo files can then be updated from this new file.
22\ No newline at end of file
23+2) Generate the updated .pot file by running the boots/locale/createpots.sh
24+ script. This will overwrite the existing pot.cms file. Any prevously
25+ generated .po .mo files can then be updated from this new file.
26
27=== added directory 'locale/es'
28=== added directory 'locale/es/LC_MESSAGES'
29=== renamed file 'po/es.po' => 'locale/es/LC_MESSAGES/es.po'
30=== modified file 'setup.py'
31--- setup.py 2010-03-12 07:04:08 +0000
32+++ setup.py 2010-03-19 05:48:21 +0000
33@@ -25,22 +25,48 @@
34 """This is the setup script for boots. It uses the python distutils."""
35
36 from distutils.core import setup
37+import subprocess
38+import os.path
39
40-boots_version = "0.1"
41+boots_version = "0.1.1"
42 authors = ["Clark Boylan", "Ken Brotherton", "Max Goodman",
43 "Victoria Lewis", "David Rosenbaum", "Andreas Turriff"]
44
45 # Split out all packages making it easy to add new ones to the config.
46+# Specify the scripts that should go in /usr/local/bin.
47 boots_scripts = ["bin/boots"]
48+# List the packages that we want to install.
49 boots_api_packages = ["boots.api", "boots.api.nodes"]
50 boots_app_packages = ["boots.app"]
51 boots_lib_packages = ["boots.lib", "boots.lib.ui", "boots.lib.ui.components",
52 "boots.lib.lingos", "boots.lib.lingos.lisp"]
53 boots_packages = ["boots"] + boots_api_packages +\
54 boots_app_packages + boots_lib_packages
55-boots_data_files = [("share/man/man1", ["doc/man/boots.1"])]
56-
57-#TODO: Fix license
58+
59+# Given a list of paths to .po files generate boots.mo
60+# in the same dir an return a tuple useable by setup() for data files.
61+def gen_mo_files(po_files):
62+ result = []
63+ for ifile in po_files:
64+ path = os.path.dirname(ifile)
65+ ofile = path + "/boots.mo"
66+ subprocess.Popen(["msgfmt", ifile, "-o", ofile])
67+ # Apparently gettext will always look in /usr/share/locale
68+ # regardless of platform. Install the .mo files there.
69+ result.append(("/usr/share/" + path, [ofile]))
70+ return result
71+
72+# Compile po files specified in boots_po_files. Return a list of
73+# tuples passable as data files.
74+boots_po_files = ["locale/es/LC_MESSAGES/es.po"]
75+boots_mo_files = gen_mo_files(boots_po_files)
76+
77+# Specify a prefix which will be appended to /usr/share/ and the files to
78+# go in that dir.
79+boots_data_files = [("share/man/man1", ["doc/man/boots.1"]),
80+ ("share/man/man5", ["doc/man/bootsrc.5"]),
81+] + boots_mo_files
82+
83 setup(name="boots",
84 version=boots_version,
85 description="Drizzle CLI Client",
86@@ -48,7 +74,7 @@
87 author_email="boots-discuss@lists.launchpad.net",
88 license="GPLv3",
89 url="http://www.launchpad.net/boots/",
90- requires=["drizzle",],
91+ requires=["drizzle", "ply"],
92 scripts=boots_scripts,
93 packages=boots_packages,
94 provides=boots_packages,

Subscribers

People subscribed via source and target branches

to status/vote changes: