annotate contrib/debian/rules @ 32383:f928d53b687c stable

dispatch: setup color before pager for correct console information on windows Before this patch, "hg CMD --pager on" on Windows shows output unintentionally decorated with ANSI color escape sequences, if color mode is "auto". This issue occurs in steps below. 1. dispatch() invokes ui.pager() at detection of "--pager on" 2. stdout of hg process is redirected into stdin of pager process 3. "ui.formatted" = True, because isatty(stdout) is so before (2) 4. color module is loaded for colorization 5. color.w32effects = None, because GetConsoleScreenBufferInfo() fails on stdout redirected at (2) 6. "ansi" color mode is chosen, because of "not w32effects" 7. output is colorized in "ansi" mode because of "ui.formatted" = True Even if "ansi" color mode is chosen, ordinarily redirected stdout makes ui.formatted() return False, and colorization is avoided. But in this issue case, "ui.formatted" = True at (3) forces output to be colorized. For correct console information on win32, it is needed to ensure that color module is loaded before redirection of stdout for pagination. BTW, if any of enabled extensions has "colortable" attribute, this issue is avoided even before this patch, because color module is imported as a part of loading such extension, and extension loading occurs before setting up pager. For example, mq and keyword have "colortable".
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Tue, 23 May 2017 03:29:23 +0900
parents 0c42b6bb2329
children 9ecc622ca23f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26148
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
1 #!/usr/bin/make -f
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
2 # Uncomment this to turn on verbose mode.
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
3 # export DH_VERBOSE=1
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
4
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
5 CPUS=$(shell cat /proc/cpuinfo | grep -E ^processor | wc -l)
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
6
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
7 %:
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
8 dh $@ --with python2
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
9
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
10 override_dh_auto_test:
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
11 http_proxy='' dh_auto_test -- TESTFLAGS="-j$(CPUS)"
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
12
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
13 override_dh_python2:
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
14 dh_python2
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
15 find debian/mercurial/usr/share -type d -empty -delete
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
16
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
17 override_dh_install:
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
18 python$(PYVERS) setup.py install --root $(CURDIR)/debian/mercurial --install-layout=deb
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
19 # remove arch-independent python stuff
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
20 find $(CURDIR)/debian/mercurial/usr/lib \
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
21 ! -name '*.so' ! -type d -delete , \
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
22 -type d -empty -delete
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
23 python$(PYVERS) setup.py install --root $(CURDIR)/debian/mercurial-common --install-layout=deb
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
24 make install-doc PREFIX=$(CURDIR)/debian/mercurial-common/usr
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
25 # remove arch-dependent python stuff
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
26 find $(CURDIR)/debian/mercurial-common/usr/lib \
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
27 -name '*.so' ! -type d -delete , \
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
28 -type d -empty -delete
26296
9cecbe837c94 debian: install hg-ssh to /usr/bin just like downstream
Augie Fackler <augie@google.com>
parents: 26148
diff changeset
29 cp contrib/hg-ssh $(CURDIR)/debian/mercurial-common/usr/bin
26299
79e1064f7c5e debian: install hgk as part of mercurial-common (issue4829)
Augie Fackler <augie@google.com>
parents: 26298
diff changeset
30 mkdir -p $(CURDIR)/debian/mercurial-common/usr/share/mercurial
79e1064f7c5e debian: install hgk as part of mercurial-common (issue4829)
Augie Fackler <augie@google.com>
parents: 26298
diff changeset
31 cp contrib/hgk $(CURDIR)/debian/mercurial-common/usr/share/mercurial
26298
346afebd8fa9 debian: install config files as part of mercurial-common
Augie Fackler <augie@google.com>
parents: 26296
diff changeset
32 mkdir -p $(CURDIR)/debian/mercurial-common/etc/mercurial/hgrc.d/
346afebd8fa9 debian: install config files as part of mercurial-common
Augie Fackler <augie@google.com>
parents: 26296
diff changeset
33 cp contrib/debian/*.rc $(CURDIR)/debian/mercurial-common/etc/mercurial/hgrc.d/
26300
f946c1260035 debian: include bash completions in mercurial-common
Augie Fackler <augie@google.com>
parents: 26299
diff changeset
34 mkdir -p $(CURDIR)/debian/mercurial-common/usr/share/bash-completion/completions
26731
0c42b6bb2329 debian: install bash completion as hg and not mercurial (issue4900)
Augie Fackler <augie@google.com>
parents: 26300
diff changeset
35 cp contrib/bash_completion $(CURDIR)/debian/mercurial-common/usr/share/bash-completion/completions/hg
26148
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
36 rm $(CURDIR)/debian/mercurial-common/usr/bin/hg