##// END OF EJS Templates
zsh_completion: install as _hg not hg...
Kyle Lippincott -
r32472:7a7c3369 default
parent child Browse files
Show More
@@ -1,300 +1,300
1 1 # If you want to change PREFIX, do not just edit it below. The changed
2 2 # value wont get passed on to recursive make calls. You should instead
3 3 # override the variable on the command like:
4 4 #
5 5 # % make PREFIX=/opt/ install
6 6
7 7 export PREFIX=/usr/local
8 8 PYTHON=python
9 9 $(eval HGROOT := $(shell pwd))
10 10 HGPYTHONS ?= $(HGROOT)/build/pythons
11 11 PURE=
12 12 PYFILES:=$(shell find mercurial hgext doc -name '*.py')
13 13 DOCFILES=mercurial/help/*.txt
14 14 export LANGUAGE=C
15 15 export LC_ALL=C
16 16 TESTFLAGS ?= $(shell echo $$HGTESTFLAGS)
17 17
18 18 # Set this to e.g. "mingw32" to use a non-default compiler.
19 19 COMPILER=
20 20
21 21 COMPILERFLAG_tmp_ =
22 22 COMPILERFLAG_tmp_${COMPILER} ?= -c $(COMPILER)
23 23 COMPILERFLAG=${COMPILERFLAG_tmp_${COMPILER}}
24 24
25 25 help:
26 26 @echo 'Commonly used make targets:'
27 27 @echo ' all - build program and documentation'
28 28 @echo ' install - install program and man pages to $$PREFIX ($(PREFIX))'
29 29 @echo ' install-home - install with setup.py install --home=$$HOME ($(HOME))'
30 30 @echo ' local - build for inplace usage'
31 31 @echo ' tests - run all tests in the automatic test suite'
32 32 @echo ' test-foo - run only specified tests (e.g. test-merge1.t)'
33 33 @echo ' dist - run all tests and create a source tarball in dist/'
34 34 @echo ' clean - remove files created by other targets'
35 35 @echo ' (except installed files or dist source tarball)'
36 36 @echo ' update-pot - update i18n/hg.pot'
37 37 @echo
38 38 @echo 'Example for a system-wide installation under /usr/local:'
39 39 @echo ' make all && su -c "make install" && hg version'
40 40 @echo
41 41 @echo 'Example for a local installation (usable in this directory):'
42 42 @echo ' make local && ./hg version'
43 43
44 44 all: build doc
45 45
46 46 local:
47 47 $(PYTHON) setup.py $(PURE) \
48 48 build_py -c -d . \
49 49 build_ext $(COMPILERFLAG) -i \
50 50 build_hgexe $(COMPILERFLAG) -i \
51 51 build_mo
52 52 env HGRCPATH= $(PYTHON) hg version
53 53
54 54 build:
55 55 $(PYTHON) setup.py $(PURE) build $(COMPILERFLAG)
56 56
57 57 wheel:
58 58 FORCE_SETUPTOOLS=1 $(PYTHON) setup.py $(PURE) bdist_wheel $(COMPILERFLAG)
59 59
60 60 doc:
61 61 $(MAKE) -C doc
62 62
63 63 cleanbutpackages:
64 64 -$(PYTHON) setup.py clean --all # ignore errors from this command
65 65 find contrib doc hgext hgext3rd i18n mercurial tests \
66 66 \( -name '*.py[cdo]' -o -name '*.so' \) -exec rm -f '{}' ';'
67 67 rm -f MANIFEST MANIFEST.in hgext/__index__.py tests/*.err
68 68 rm -f mercurial/__modulepolicy__.py
69 69 if test -d .hg; then rm -f mercurial/__version__.py; fi
70 70 rm -rf build mercurial/locale
71 71 $(MAKE) -C doc clean
72 72 $(MAKE) -C contrib/chg distclean
73 73
74 74 clean: cleanbutpackages
75 75 rm -rf packages
76 76
77 77 install: install-bin install-doc
78 78
79 79 install-bin: build
80 80 $(PYTHON) setup.py $(PURE) install --root="$(DESTDIR)/" --prefix="$(PREFIX)" --force
81 81
82 82 install-doc: doc
83 83 cd doc && $(MAKE) $(MFLAGS) install
84 84
85 85 install-home: install-home-bin install-home-doc
86 86
87 87 install-home-bin: build
88 88 $(PYTHON) setup.py $(PURE) install --home="$(HOME)" --prefix="" --force
89 89
90 90 install-home-doc: doc
91 91 cd doc && $(MAKE) $(MFLAGS) PREFIX="$(HOME)" install
92 92
93 93 MANIFEST-doc:
94 94 $(MAKE) -C doc MANIFEST
95 95
96 96 MANIFEST.in: MANIFEST-doc
97 97 hg manifest | sed -e 's/^/include /' > MANIFEST.in
98 98 echo include mercurial/__version__.py >> MANIFEST.in
99 99 sed -e 's/^/include /' < doc/MANIFEST >> MANIFEST.in
100 100
101 101 dist: tests dist-notests
102 102
103 103 dist-notests: doc MANIFEST.in
104 104 TAR_OPTIONS="--owner=root --group=root --mode=u+w,go-w,a+rX-s" $(PYTHON) setup.py -q sdist
105 105
106 106 check: tests
107 107
108 108 tests:
109 109 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS)
110 110
111 111 test-%:
112 112 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@
113 113
114 114 testpy-%:
115 115 @echo Looking for Python $* in $(HGPYTHONS)
116 116 [ -e $(HGPYTHONS)/$*/bin/python ] || ( \
117 117 cd $$(mktemp --directory --tmpdir) && \
118 118 $(MAKE) -f $(HGROOT)/contrib/Makefile.python PYTHONVER=$* PREFIX=$(HGPYTHONS)/$* python )
119 119 cd tests && $(HGPYTHONS)/$*/bin/python run-tests.py $(TESTFLAGS)
120 120
121 121 check-code:
122 122 hg manifest | xargs python contrib/check-code.py
123 123
124 124 update-pot: i18n/hg.pot
125 125
126 126 i18n/hg.pot: $(PYFILES) $(DOCFILES) i18n/posplit i18n/hggettext
127 127 $(PYTHON) i18n/hggettext mercurial/commands.py \
128 128 hgext/*.py hgext/*/__init__.py \
129 129 mercurial/fileset.py mercurial/revset.py \
130 130 mercurial/templatefilters.py mercurial/templatekw.py \
131 131 mercurial/templater.py \
132 132 mercurial/filemerge.py \
133 133 mercurial/hgweb/webcommands.py \
134 134 $(DOCFILES) > i18n/hg.pot.tmp
135 135 # All strings marked for translation in Mercurial contain
136 136 # ASCII characters only. But some files contain string
137 137 # literals like this '\037\213'. xgettext thinks it has to
138 138 # parse them even though they are not marked for translation.
139 139 # Extracting with an explicit encoding of ISO-8859-1 will make
140 140 # xgettext "parse" and ignore them.
141 141 echo $(PYFILES) | xargs \
142 142 xgettext --package-name "Mercurial" \
143 143 --msgid-bugs-address "<mercurial-devel@mercurial-scm.org>" \
144 144 --copyright-holder "Matt Mackall <mpm@selenic.com> and others" \
145 145 --from-code ISO-8859-1 --join --sort-by-file --add-comments=i18n: \
146 146 -d hg -p i18n -o hg.pot.tmp
147 147 $(PYTHON) i18n/posplit i18n/hg.pot.tmp
148 148 # The target file is not created before the last step. So it never is in
149 149 # an intermediate state.
150 150 mv -f i18n/hg.pot.tmp i18n/hg.pot
151 151
152 152 %.po: i18n/hg.pot
153 153 # work on a temporary copy for never having a half completed target
154 154 cp $@ $@.tmp
155 155 msgmerge --no-location --update $@.tmp $^
156 156 mv -f $@.tmp $@
157 157
158 158 # Packaging targets
159 159
160 160 osx:
161 161 rm -rf build/mercurial
162 162 /usr/bin/python2.7 setup.py install --optimize=1 \
163 163 --root=build/mercurial/ --prefix=/usr/local/ \
164 164 --install-lib=/Library/Python/2.7/site-packages/
165 165 make -C doc all install DESTDIR="$(PWD)/build/mercurial/"
166 166 # Place a bogon .DS_Store file in the target dir so we can be
167 167 # sure it doesn't get included in the final package.
168 168 touch build/mercurial/.DS_Store
169 169 # install zsh completions - this location appears to be
170 170 # searched by default as of macOS Sierra.
171 171 install -d build/mercurial/usr/local/share/zsh/site-functions/
172 install -m 0644 contrib/zsh_completion build/mercurial/usr/local/share/zsh/site-functions/hg
172 install -m 0644 contrib/zsh_completion build/mercurial/usr/local/share/zsh/site-functions/_hg
173 173 # install bash completions - there doesn't appear to be a
174 174 # place that's searched by default for bash, so we'll follow
175 175 # the lead of Apple's git install and just put it in a
176 176 # location of our own.
177 177 install -d build/mercurial/usr/local/hg/contrib/
178 178 install -m 0644 contrib/bash_completion build/mercurial/usr/local/hg/contrib/hg-completion.bash
179 179 make -C contrib/chg \
180 180 HGPATH=/usr/local/bin/hg \
181 181 PYTHON=/usr/bin/python2.7 \
182 182 HG=/usr/local/bin/hg \
183 183 HGEXTDIR=/Library/Python/2.7/site-packages/hgext \
184 184 DESTDIR=../../build/mercurial \
185 185 PREFIX=/usr/local \
186 186 clean install
187 187 mkdir -p $${OUTPUTDIR:-dist}
188 188 HGVER=$$((cat build/mercurial/Library/Python/2.7/site-packages/mercurial/__version__.py; echo 'print(version)') | python) && \
189 189 OSXVER=$$(sw_vers -productVersion | cut -d. -f1,2) && \
190 190 pkgbuild --filter \\.DS_Store --root build/mercurial/ \
191 191 --identifier org.mercurial-scm.mercurial \
192 192 --version "$${HGVER}" \
193 193 build/mercurial.pkg && \
194 194 productbuild --distribution contrib/macosx/distribution.xml \
195 195 --package-path build/ \
196 196 --version "$${HGVER}" \
197 197 --resources contrib/macosx/ \
198 198 "$${OUTPUTDIR:-dist/}"/Mercurial-"$${HGVER}"-macosx"$${OSXVER}".pkg
199 199
200 200 deb:
201 201 contrib/builddeb
202 202
203 203 ppa:
204 204 contrib/builddeb --source-only
205 205
206 206 docker-debian-jessie:
207 207 mkdir -p packages/debian-jessie
208 208 contrib/dockerdeb debian jessie
209 209
210 210 contrib/docker/ubuntu-%: contrib/docker/ubuntu.template
211 211 sed "s/__CODENAME__/$*/" $< > $@
212 212
213 213 docker-ubuntu-trusty: contrib/docker/ubuntu-trusty
214 214 contrib/dockerdeb ubuntu trusty
215 215
216 216 docker-ubuntu-trusty-ppa: contrib/docker/ubuntu-trusty
217 217 contrib/dockerdeb ubuntu trusty --source-only
218 218
219 219 docker-ubuntu-xenial: contrib/docker/ubuntu-xenial
220 220 contrib/dockerdeb ubuntu xenial
221 221
222 222 docker-ubuntu-xenial-ppa: contrib/docker/ubuntu-xenial
223 223 contrib/dockerdeb ubuntu xenial --source-only
224 224
225 225 docker-ubuntu-yakkety: contrib/docker/ubuntu-yakkety
226 226 contrib/dockerdeb ubuntu yakkety
227 227
228 228 docker-ubuntu-yakkety-ppa: contrib/docker/ubuntu-yakkety
229 229 contrib/dockerdeb ubuntu yakkety --source-only
230 230
231 231 fedora20:
232 232 mkdir -p packages/fedora20
233 233 contrib/buildrpm
234 234 cp rpmbuild/RPMS/*/* packages/fedora20
235 235 cp rpmbuild/SRPMS/* packages/fedora20
236 236 rm -rf rpmbuild
237 237
238 238 docker-fedora20:
239 239 mkdir -p packages/fedora20
240 240 contrib/dockerrpm fedora20
241 241
242 242 fedora21:
243 243 mkdir -p packages/fedora21
244 244 contrib/buildrpm
245 245 cp rpmbuild/RPMS/*/* packages/fedora21
246 246 cp rpmbuild/SRPMS/* packages/fedora21
247 247 rm -rf rpmbuild
248 248
249 249 docker-fedora21:
250 250 mkdir -p packages/fedora21
251 251 contrib/dockerrpm fedora21
252 252
253 253 centos5:
254 254 mkdir -p packages/centos5
255 255 contrib/buildrpm --withpython
256 256 cp rpmbuild/RPMS/*/* packages/centos5
257 257 cp rpmbuild/SRPMS/* packages/centos5
258 258
259 259 docker-centos5:
260 260 mkdir -p packages/centos5
261 261 contrib/dockerrpm centos5 --withpython
262 262
263 263 centos6:
264 264 mkdir -p packages/centos6
265 265 contrib/buildrpm
266 266 cp rpmbuild/RPMS/*/* packages/centos6
267 267 cp rpmbuild/SRPMS/* packages/centos6
268 268
269 269 docker-centos6:
270 270 mkdir -p packages/centos6
271 271 contrib/dockerrpm centos6
272 272
273 273 centos7:
274 274 mkdir -p packages/centos7
275 275 contrib/buildrpm
276 276 cp rpmbuild/RPMS/*/* packages/centos7
277 277 cp rpmbuild/SRPMS/* packages/centos7
278 278
279 279 docker-centos7:
280 280 mkdir -p packages/centos7
281 281 contrib/dockerrpm centos7
282 282
283 283 linux-wheels: linux-wheels-x86_64 linux-wheels-i686
284 284
285 285 linux-wheels-x86_64:
286 286 docker run -e "HGTEST_JOBS=$(shell nproc)" --rm -ti -v `pwd`:/src quay.io/pypa/manylinux1_x86_64 /src/contrib/build-linux-wheels.sh
287 287
288 288 linux-wheels-i686:
289 289 docker run -e "HGTEST_JOBS=$(shell nproc)" --rm -ti -v `pwd`:/src quay.io/pypa/manylinux1_i686 linux32 /src/contrib/build-linux-wheels.sh
290 290
291 291 .PHONY: help all local build doc cleanbutpackages clean install install-bin \
292 292 install-doc install-home install-home-bin install-home-doc \
293 293 dist dist-notests check tests check-code update-pot \
294 294 osx deb ppa docker-debian-jessie \
295 295 docker-ubuntu-trusty docker-ubuntu-trusty-ppa \
296 296 docker-ubuntu-xenial docker-ubuntu-xenial-ppa \
297 297 docker-ubuntu-yakkety docker-ubuntu-yakkety-ppa \
298 298 fedora20 docker-fedora20 fedora21 docker-fedora21 \
299 299 centos5 docker-centos5 centos6 docker-centos6 centos7 docker-centos7 \
300 300 linux-wheels
@@ -1,63 +1,63
1 1 #require test-repo slow osx osxpackaging
2 2
3 3 $ . "$TESTDIR/helpers-testrepo.sh"
4 4
5 5 $ OUTPUTDIR="`pwd`"
6 6 $ export OUTPUTDIR
7 7 $ KEEPMPKG=yes
8 8 $ export KEEPMPKG
9 9
10 10 $ cd "$TESTDIR"/..
11 11 $ make osx > "$OUTPUTDIR/build.log" 2>&1
12 12 $ cd "$OUTPUTDIR"
13 13 $ ls -d *.pkg
14 14 Mercurial-*-macosx10.*.pkg (glob)
15 15
16 16 $ xar -xf Mercurial*.pkg
17 17
18 18 Gather list of all installed files:
19 19 $ lsbom mercurial.pkg/Bom > boms.txt
20 20
21 21 We've had problems with the filter logic in the past. Make sure no
22 22 .DS_Store files ended up in the final package:
23 23 $ grep DS_S boms.txt
24 24 [1]
25 25
26 26 Spot-check some randomly selected files:
27 27 $ grep bdiff boms.txt | cut -d ' ' -f 1,2,3
28 28 ./Library/Python/2.7/site-packages/mercurial/cext/bdiff.so 100755 0/0
29 29 ./Library/Python/2.7/site-packages/mercurial/pure/bdiff.py 100644 0/0
30 30 ./Library/Python/2.7/site-packages/mercurial/pure/bdiff.pyc 100644 0/0
31 31 ./Library/Python/2.7/site-packages/mercurial/pure/bdiff.pyo 100644 0/0
32 $ grep zsh/site-functions/hg boms.txt | cut -d ' ' -f 1,2,3
33 ./usr/local/share/zsh/site-functions/hg 100644 0/0
32 $ grep zsh/site-functions/_hg boms.txt | cut -d ' ' -f 1,2,3
33 ./usr/local/share/zsh/site-functions/_hg 100644 0/0
34 34 $ grep hg-completion.bash boms.txt | cut -d ' ' -f 1,2,3
35 35 ./usr/local/hg/contrib/hg-completion.bash 100644 0/0
36 36 $ egrep 'man[15]' boms.txt | cut -d ' ' -f 1,2,3
37 37 ./usr/local/share/man/man1 40755 0/0
38 38 ./usr/local/share/man/man1/chg.1 100644 0/0
39 39 ./usr/local/share/man/man1/hg.1 100644 0/0
40 40 ./usr/local/share/man/man5 40755 0/0
41 41 ./usr/local/share/man/man5/hgignore.5 100644 0/0
42 42 ./usr/local/share/man/man5/hgrc.5 100644 0/0
43 43 $ grep bser boms.txt | cut -d ' ' -f 1,2,3
44 44 ./Library/Python/2.7/site-packages/hgext/fsmonitor/pywatchman/bser.so 100755 0/0
45 45 ./Library/Python/2.7/site-packages/hgext/fsmonitor/pywatchman/pybser.py 100644 0/0
46 46 ./Library/Python/2.7/site-packages/hgext/fsmonitor/pywatchman/pybser.pyc 100644 0/0
47 47 ./Library/Python/2.7/site-packages/hgext/fsmonitor/pywatchman/pybser.pyo 100644 0/0
48 48 $ grep localrepo boms.txt | cut -d ' ' -f 1,2,3
49 49 ./Library/Python/2.7/site-packages/mercurial/localrepo.py 100644 0/0
50 50 ./Library/Python/2.7/site-packages/mercurial/localrepo.pyc 100644 0/0
51 51 ./Library/Python/2.7/site-packages/mercurial/localrepo.pyo 100644 0/0
52 52 $ egrep 'bin/' boms.txt | cut -d ' ' -f 1,2,3
53 53 ./usr/local/bin/chg 100755 0/0
54 54 ./usr/local/bin/hg 100755 0/0
55 55
56 56 Make sure the built binary uses the system Python interpreter
57 57 $ bsdtar xf mercurial.pkg/Payload usr/local/bin
58 58 Use a glob to find this to avoid check-code whining about a fixed path.
59 59 $ head -n 1 usr/local/b?n/hg
60 60 #!/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
61 61
62 62 Note that we're not currently installing any /etc/mercurial stuff,
63 63 including merge-tool configurations.
General Comments 0
You need to be logged in to leave comments. Login now