annotate doc/setup.txt @ 2:b2492365f186

Forgot to check in the doc directory.
author cmlenz
date Wed, 30 May 2007 07:37:26 +0000
parents
children 4525549aa6cc
rev   line source
2
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
1 .. -*- mode: rst; encoding: utf-8 -*-
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
2
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
3 ================================
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
4 Distutils/Setuptools Integration
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
5 ================================
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
6
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
7 Babel provides commands for integration into ``setup.py`` scripts, based on
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
8 either the ``distutils`` package that is part of the Python standard library,
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
9 or the third-party ``setuptools`` package.
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
10
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
11 These commands are available by default when Babel has been properly installed,
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
12 and ``setup.py`` is using ``setuptools``. For projects that use plain old
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
13 ``distutils``, the commands need to be registered explicitly, for example::
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
14
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
15 from distutils.core import setup
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
16 from babel.catalog import frontend as babel
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
17
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
18 setup(
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
19 ...
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
20 cmd_class = {'extract_messages': babel.extract_messages}
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
21 )
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
22
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
23
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
24 .. contents:: Contents
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
25 :depth: 2
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
26 .. sectnum::
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
27
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
28
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
29 extract_messages
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
30 ================
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
31
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
32 The ``extract_messages`` command is comparabe to the GNU ``xgettext`` program:
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
33 it can extract localizable messages from a variety of difference source files,
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
34 and generate a PO (portable object) template file from the collected messages.
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
35
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
36 If the command has been correctly installed or registered, another project's
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
37 ``setup.py`` script should allow you to use the command::
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
38
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
39 $ ./setup.py extract_messages --help
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
40 Global options:
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
41 --verbose (-v) run verbosely (default)
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
42 --quiet (-q) run quietly (turns verbosity off)
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
43 --dry-run (-n) don't actually do anything
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
44 --help (-h) show detailed help message
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
45
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
46 Options for 'extract_messages' command:
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
47 --charset charset to use in the output
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
48 --keywords (-k) comma-separated list of keywords to look for in addition
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
49 to the defaults
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
50 --no-location do not write filename/lineno location comments
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
51 --output-file filename of the output PO file
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
52
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
53 Running the command will produce a PO file::
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
54
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
55 $ ./setup.py extract_messages --output-file webapp/locales/messages.pot
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
56 running extract_messages
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
57 extracting messages from 'webapp'
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
58 extracting messages from 'webparts'
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
59 writing PO file to webapp/locales/messages.pot
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
60
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
61
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
62 Options
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
63 -------
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
64
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
65 As shown in the ``--help`` output above, the ``extract_messages`` command
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
66 accepts the following options:
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
67
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
68 ``--charset``
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
69 The character set / encoding to use in the generated PO file.
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
70 ``--keywords``
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
71 A comma-separated list of keywords (function names) to look for in addition
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
72 to the default keywords
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
73 ``--no-location``
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
74 If this flag is set, location comments will not be included in the generated
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
75 PO file.
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
76 ``--output-file`` or ``-o``
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
77 The path to the PO file that should be generated
b2492365f186 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
78
Copyright (C) 2012-2017 Edgewall Software