##// END OF EJS Templates
completion: install completers to conventional locations...
Matthew Martin -
r49845:8d7eaff9 default
parent child Browse files
Show More
@@ -235,16 +235,6 b' osx:'
235 235 # Place a bogon .DS_Store file in the target dir so we can be
236 236 # sure it doesn't get included in the final package.
237 237 touch build/mercurial/.DS_Store
238 # install zsh completions - this location appears to be
239 # searched by default as of macOS Sierra.
240 install -d build/mercurial/usr/local/share/zsh/site-functions/
241 install -m 0644 contrib/zsh_completion build/mercurial/usr/local/share/zsh/site-functions/_hg
242 # install bash completions - there doesn't appear to be a
243 # place that's searched by default for bash, so we'll follow
244 # the lead of Apple's git install and just put it in a
245 # location of our own.
246 install -d build/mercurial/usr/local/hg/contrib/
247 install -m 0644 contrib/bash_completion build/mercurial/usr/local/hg/contrib/hg-completion.bash
248 238 make -C contrib/chg \
249 239 HGPATH=/usr/local/bin/hg \
250 240 PYTHON=/usr/bin/python2.7 \
@@ -92,10 +92,8 b' override_dh_auto_install: $(DEB_HG_PYTHO'
92 92 mkdir -p "$(CURDIR)"/debian/mercurial/etc/mercurial/hgrc.d/
93 93 cp contrib/packaging/debian/*.rc "$(CURDIR)"/debian/mercurial/etc/mercurial/hgrc.d/
94 94 # completions
95 mkdir -p "$(CURDIR)"/debian/mercurial/usr/share/bash-completion/completions
96 cp contrib/bash_completion "$(CURDIR)"/debian/mercurial/usr/share/bash-completion/completions/hg
97 95 mkdir -p "$(CURDIR)"/debian/mercurial/usr/share/zsh/vendor-completions
98 cp contrib/zsh_completion "$(CURDIR)"/debian/mercurial/usr/share/zsh/vendor-completions/_hg
96 mv "$(CURDIR)"/debian/mercurial/usr/share/zsh/site-functions/_hg "$(CURDIR)"/debian/mercurial/usr/share/zsh/vendor-completions/_hg
99 97 if [ "$(DEB_HG_CHG_BY_DEFAULT)" -eq 1 ]; then \
100 98 mkdir -p "$(CURDIR)"/debian/mercurial/usr/lib/mercurial; \
101 99 mv "$(CURDIR)"/debian/mercurial/usr/bin/hg "$(CURDIR)"/debian/mercurial/usr/lib/mercurial/hg; \
@@ -23,7 +23,6 b' from .util import ('
23 23
24 24
25 25 STAGING_RULES_WINDOWS = [
26 ('contrib/bash_completion', 'contrib/'),
27 26 ('contrib/hgk', 'contrib/hgk.tcl'),
28 27 ('contrib/hgweb.fcgi', 'contrib/'),
29 28 ('contrib/hgweb.wsgi', 'contrib/'),
@@ -36,7 +35,6 b' STAGING_RULES_WINDOWS = ['
36 35 ('contrib/win32/postinstall.txt', 'ReleaseNotes.txt'),
37 36 ('contrib/win32/ReadMe.html', 'ReadMe.html'),
38 37 ('contrib/xml.rnc', 'contrib/'),
39 ('contrib/zsh_completion', 'contrib/'),
40 38 ('doc/*.html', 'doc/'),
41 39 ('doc/style.css', 'doc/'),
42 40 ('COPYING', 'Copying.txt'),
@@ -126,14 +126,6 b' install -m 755 contrib/chg/chg $RPM_BUIL'
126 126 install -m 755 contrib/hgk $RPM_BUILD_ROOT%{_bindir}/
127 127 install -m 755 contrib/hg-ssh $RPM_BUILD_ROOT%{_bindir}/
128 128
129 bash_completion_dir=$RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d
130 mkdir -p $bash_completion_dir
131 install -m 644 contrib/bash_completion $bash_completion_dir/mercurial.sh
132
133 zsh_completion_dir=$RPM_BUILD_ROOT%{_datadir}/zsh/site-functions
134 mkdir -p $zsh_completion_dir
135 install -m 644 contrib/zsh_completion $zsh_completion_dir/_mercurial
136
137 129 mkdir -p $RPM_BUILD_ROOT%{emacs_lispdir}
138 130 install -m 644 contrib/mercurial.el $RPM_BUILD_ROOT%{emacs_lispdir}/
139 131 install -m 644 contrib/mq.el $RPM_BUILD_ROOT%{emacs_lispdir}/
@@ -148,9 +140,12 b' rm -rf $RPM_BUILD_ROOT'
148 140 %doc CONTRIBUTORS COPYING doc/README doc/hg*.txt doc/hg*.html *.cgi contrib/*.fcgi contrib/*.wsgi
149 141 %doc %attr(644,root,root) %{_mandir}/man?/hg*
150 142 %doc %attr(644,root,root) contrib/*.svg
143 %dir %{_datadir}/bash-completion/
144 %dir %{_datadir}/bash-completion/completions
145 %{_datadir}/bash-completion/completions/hg
151 146 %dir %{_datadir}/zsh/
152 147 %dir %{_datadir}/zsh/site-functions/
153 %{_datadir}/zsh/site-functions/_mercurial
148 %{_datadir}/zsh/site-functions/_hg
154 149 %dir %{_datadir}/emacs/site-lisp/
155 150 %{_datadir}/emacs/site-lisp/mercurial.el
156 151 %{_datadir}/emacs/site-lisp/mq.el
@@ -158,8 +153,6 b' rm -rf $RPM_BUILD_ROOT'
158 153 %{_bindir}/chg
159 154 %{_bindir}/hgk
160 155 %{_bindir}/hg-ssh
161 %dir %{_sysconfdir}/bash_completion.d/
162 %config(noreplace) %{_sysconfdir}/bash_completion.d/mercurial.sh
163 156 %dir %{_sysconfdir}/mercurial
164 157 %dir %{_sysconfdir}/mercurial/hgrc.d
165 158 %if "%{?withpython}"
@@ -982,6 +982,10 b' class hginstall(install):'
982 982 ),
983 983 ]
984 984
985 sub_commands = install.sub_commands + [
986 ('install_completion', lambda self: True)
987 ]
988
985 989 # Also helps setuptools not be sad while we refuse to create eggs.
986 990 single_version_externally_managed = True
987 991
@@ -1101,6 +1105,33 b' class hginstallscripts(install_scripts):'
1101 1105 fp.write(data)
1102 1106
1103 1107
1108 class hginstallcompletion(Command):
1109 description = 'Install shell completion'
1110
1111 def initialize_options(self):
1112 self.install_dir = None
1113
1114 def finalize_options(self):
1115 self.set_undefined_options(
1116 'install_data', ('install_dir', 'install_dir')
1117 )
1118
1119 def run(self):
1120 for src, dir_path, dest in (
1121 (
1122 'bash_completion',
1123 ('share', 'bash-completion', 'completions'),
1124 'hg',
1125 ),
1126 ('zsh_completion', ('share', 'zsh', 'site-functions'), '_hg'),
1127 ):
1128 dir = os.path.join(self.install_dir, *dir_path)
1129 self.mkpath(dir)
1130 self.copy_file(
1131 os.path.join('contrib', src), os.path.join(dir, dest)
1132 )
1133
1134
1104 1135 # virtualenv installs custom distutils/__init__.py and
1105 1136 # distutils/distutils.cfg files which essentially proxy back to the
1106 1137 # "real" distutils in the main Python install. The presence of this
@@ -1191,6 +1222,7 b' cmdclass = {'
1191 1222 'build_scripts': hgbuildscripts,
1192 1223 'build_hgextindex': buildhgextindex,
1193 1224 'install': hginstall,
1225 'install_completion': hginstallcompletion,
1194 1226 'install_lib': hginstalllib,
1195 1227 'install_scripts': hginstallscripts,
1196 1228 'build_hgexe': buildhgexe,
@@ -39,8 +39,8 b' Spot-check some randomly selected files:'
39 39 ./Library/Python/2.7/site-packages/mercurial/pure/bdiff.pyo 100644 0/0
40 40 $ grep zsh/site-functions/_hg boms.txt | cut -d ' ' -f 1,2,3
41 41 ./usr/local/share/zsh/site-functions/_hg 100644 0/0
42 $ grep hg-completion.bash boms.txt | cut -d ' ' -f 1,2,3
43 ./usr/local/hg/contrib/hg-completion.bash 100644 0/0
42 $ grep bash-completion/completions/hg boms.txt | cut -d ' ' -f 1,2,3
43 ./usr/local/share/bash-completion-completions/hg 100644 0/0
44 44 $ egrep 'man[15]' boms.txt | cut -d ' ' -f 1,2,3
45 45 ./usr/local/share/man/man1 40755 0/0
46 46 ./usr/local/share/man/man1/chg.1 100644 0/0
General Comments 0
You need to be logged in to leave comments. Login now