##// END OF EJS Templates
i18n: extract strings with xgettext...
Martin Geisler -
r7710:88326ee8 default
parent child Browse files
Show More
@@ -1,88 +1,94 b''
1 PREFIX=/usr/local
1 PREFIX=/usr/local
2 export PREFIX
2 export PREFIX
3 PYTHON=python
3 PYTHON=python
4 PURE=
4 PURE=
5
5
6 help:
6 help:
7 @echo 'Commonly used make targets:'
7 @echo 'Commonly used make targets:'
8 @echo ' all - build program and documentation'
8 @echo ' all - build program and documentation'
9 @echo ' install - install program and man pages to PREFIX ($(PREFIX))'
9 @echo ' install - install program and man pages to PREFIX ($(PREFIX))'
10 @echo ' install-home - install with setup.py install --home=HOME ($(HOME))'
10 @echo ' install-home - install with setup.py install --home=HOME ($(HOME))'
11 @echo ' local - build for inplace usage'
11 @echo ' local - build for inplace usage'
12 @echo ' tests - run all tests in the automatic test suite'
12 @echo ' tests - run all tests in the automatic test suite'
13 @echo ' test-foo - run only specified tests (e.g. test-merge1)'
13 @echo ' test-foo - run only specified tests (e.g. test-merge1)'
14 @echo ' dist - run all tests and create a source tarball in dist/'
14 @echo ' dist - run all tests and create a source tarball in dist/'
15 @echo ' clean - remove files created by other targets'
15 @echo ' clean - remove files created by other targets'
16 @echo ' (except installed files or dist source tarball)'
16 @echo ' (except installed files or dist source tarball)'
17 @echo ' update-pot - update i18n/hg.pot'
17 @echo ' update-pot - update i18n/hg.pot'
18 @echo
18 @echo
19 @echo 'Example for a system-wide installation under /usr/local:'
19 @echo 'Example for a system-wide installation under /usr/local:'
20 @echo ' make all && su -c "make install" && hg version'
20 @echo ' make all && su -c "make install" && hg version'
21 @echo
21 @echo
22 @echo 'Example for a local installation (usable in this directory):'
22 @echo 'Example for a local installation (usable in this directory):'
23 @echo ' make local && ./hg version'
23 @echo ' make local && ./hg version'
24
24
25 all: build doc
25 all: build doc
26
26
27 local:
27 local:
28 $(PYTHON) setup.py $(PURE) build_py -c -d . build_ext -i build_mo
28 $(PYTHON) setup.py $(PURE) build_py -c -d . build_ext -i build_mo
29 $(PYTHON) hg version
29 $(PYTHON) hg version
30
30
31 build:
31 build:
32 $(PYTHON) setup.py $(PURE) build
32 $(PYTHON) setup.py $(PURE) build
33
33
34 doc:
34 doc:
35 $(MAKE) -C doc
35 $(MAKE) -C doc
36
36
37 clean:
37 clean:
38 -$(PYTHON) setup.py clean --all # ignore errors of this command
38 -$(PYTHON) setup.py clean --all # ignore errors of this command
39 find . -name '*.py[cdo]' -exec rm -f '{}' ';'
39 find . -name '*.py[cdo]' -exec rm -f '{}' ';'
40 rm -f MANIFEST mercurial/__version__.py mercurial/*.so tests/*.err
40 rm -f MANIFEST mercurial/__version__.py mercurial/*.so tests/*.err
41 $(MAKE) -C doc clean
41 $(MAKE) -C doc clean
42
42
43 install: install-bin install-doc
43 install: install-bin install-doc
44
44
45 install-bin: build
45 install-bin: build
46 $(PYTHON) setup.py $(PURE) install --prefix="$(PREFIX)" --force
46 $(PYTHON) setup.py $(PURE) install --prefix="$(PREFIX)" --force
47
47
48 install-doc: doc
48 install-doc: doc
49 cd doc && $(MAKE) $(MFLAGS) install
49 cd doc && $(MAKE) $(MFLAGS) install
50
50
51 install-home: install-home-bin install-home-doc
51 install-home: install-home-bin install-home-doc
52
52
53 install-home-bin: build
53 install-home-bin: build
54 $(PYTHON) setup.py $(PURE) install --home="$(HOME)" --force
54 $(PYTHON) setup.py $(PURE) install --home="$(HOME)" --force
55
55
56 install-home-doc: doc
56 install-home-doc: doc
57 cd doc && $(MAKE) $(MFLAGS) PREFIX="$(HOME)" install
57 cd doc && $(MAKE) $(MFLAGS) PREFIX="$(HOME)" install
58
58
59 MANIFEST-doc:
59 MANIFEST-doc:
60 $(MAKE) -C doc MANIFEST
60 $(MAKE) -C doc MANIFEST
61
61
62 MANIFEST: MANIFEST-doc
62 MANIFEST: MANIFEST-doc
63 hg manifest > MANIFEST
63 hg manifest > MANIFEST
64 echo mercurial/__version__.py >> MANIFEST
64 echo mercurial/__version__.py >> MANIFEST
65 cat doc/MANIFEST >> MANIFEST
65 cat doc/MANIFEST >> MANIFEST
66
66
67 dist: tests dist-notests
67 dist: tests dist-notests
68
68
69 dist-notests: doc MANIFEST
69 dist-notests: doc MANIFEST
70 TAR_OPTIONS="--owner=root --group=root --mode=u+w,go-w,a+rX-s" $(PYTHON) setup.py -q sdist
70 TAR_OPTIONS="--owner=root --group=root --mode=u+w,go-w,a+rX-s" $(PYTHON) setup.py -q sdist
71
71
72 tests:
72 tests:
73 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS)
73 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS)
74
74
75 test-%:
75 test-%:
76 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@
76 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@
77
77
78 update-pot:
78 update-pot:
79 mkdir -p i18n
79 mkdir -p i18n
80 pygettext -d doc -p i18n --docstrings \
80 pygettext -d hg -p i18n --docstrings \
81 mercurial/commands.py hgext/*.py hgext/*/__init__.py
81 mercurial/commands.py hgext/*.py hgext/*/__init__.py
82 pygettext -d all -p i18n mercurial hgext doc
82 # All strings marked for translation in Mercurial contain
83 msgcat --sort-by-file i18n/doc.pot i18n/all.pot > i18n/hg.pot
83 # ASCII characters only. But some files contain string
84 rm i18n/doc.pot i18n/all.pot
84 # literals like this '\037\213'. xgettext thinks it has to
85 # parse these them even though they are not marked for
86 # translation. Extracting with an explicit encoding of
87 # ISO-8859-1 will make xgettext "parse" and ignore them.
88 find mercurial hgext doc -name '*.py' | xargs \
89 xgettext --from-code ISO-8859-1 --join --sort-by-file \
90 -d hg -p i18n -o hg.pot
85
91
86 .PHONY: help all local build doc clean install install-bin install-doc \
92 .PHONY: help all local build doc clean install install-bin install-doc \
87 install-home install-home-bin install-home-doc dist dist-notests tests \
93 install-home install-home-bin install-home-doc dist dist-notests tests \
88 update-pot
94 update-pot
General Comments 0
You need to be logged in to leave comments. Login now