1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 PYTHON_COMPAT=( python2_7 )
8 PYTHON_REQ_USE="threads"
10 inherit bash-completion-r1 elisp-common eutils distutils-r1 mercurial flag-o-matic
12 DESCRIPTION="Scalable distributed SCM"
13 HOMEPAGE="http://mercurial.selenic.com/"
14 EHG_REPO_URI="http://selenic.com/repo/hg"
20 IUSE="bugzilla emacs gpg test tk zsh-completion"
22 RDEPEND="bugzilla? ( dev-python/mysql-python[${PYTHON_USEDEP}] )
23 gpg? ( app-crypt/gnupg )
25 zsh-completion? ( app-shells/zsh )
26 app-misc/ca-certificates"
27 DEPEND="emacs? ( virtual/emacs )
28 test? ( app-arch/unzip
29 dev-python/pygments[${PYTHON_USEDEP}] )
30 dev-python/docutils[${PYTHON_USEDEP}]"
32 SITEFILE="70${PN}-gentoo.el"
34 python_prepare_all() {
35 # fix up logic that won't work in Gentoo Prefix (also won't outside in
36 # certain cases), bug #362891
37 sed -i -e 's:xcodebuild:nocodebuild:' setup.py || die
39 distutils-r1_python_prepare_all
42 python_configure_all() {
43 strip-flags -ftracer -ftree-vectorize
44 # Note: make it impl-conditional if py3 is supported
45 append-flags -fno-strict-aliasing
47 "${PYTHON}" setup.py build_mo || die
50 python_compile_all() {
51 rm -r contrib/{win32,macosx} || die
55 elisp-compile mercurial.el || die "elisp-compile failed!"
59 python_install_all() {
60 distutils-r1_python_install_all
62 newbashcomp contrib/bash_completion hg
64 if use zsh-completion ; then
65 insinto /usr/share/zsh/site-functions
66 newins contrib/zsh_completion _hg
69 rm -f doc/*.?.txt || die
70 dodoc CONTRIBUTORS doc/*.txt
71 cp hgweb*.cgi "${ED}"/usr/share/doc/${PF}/ || die
75 python_foreach_impl python_doscript contrib/hg-ssh
78 elisp-install ${PN} contrib/mercurial.el* || die "elisp-install failed!"
79 elisp-site-file-install "${FILESDIR}"/${SITEFILE}
82 local RM_CONTRIB=(hgk hg-ssh bash_completion zsh_completion wix buildrpm plan9
84 for f in ${RM_CONTRIB[@]}; do
85 rm -rf contrib/$f || die
89 docompress -x /usr/share/doc/${PF}/contrib
92 cat > "${T}/80mercurial" <<-EOF
93 HG="${EPREFIX}/usr/bin/hg"
95 doenvd "${T}/80mercurial"
97 insinto /etc/mercurial/hgrc.d
98 doins "${FILESDIR}/cacerts.rc"
103 rm -rf *svn* || die # Subversion tests fail with 1.5
104 rm -f test-archive* || die # Fails due to verbose tar output changes
105 rm -f test-convert-baz* || die # GNU Arch baz
106 rm -f test-convert-cvs* || die # CVS
107 rm -f test-convert-darcs* || die # Darcs
108 rm -f test-convert-git* || die # git
109 rm -f test-convert-mtn* || die # monotone
110 rm -f test-convert-tla* || die # GNU Arch tla
111 rm -f test-doctest* || die # doctest always fails with python 2.5.x
112 rm -f test-largefiles* || die # tends to time out
113 if [[ ${EUID} -eq 0 ]]; then
114 einfo "Removing tests which require user privileges to succeed"
115 rm -f test-command-template* || die # Test is broken when run as root
116 rm -f test-convert* || die # Test is broken when run as root
117 rm -f test-lock-badness* || die # Test is broken when run as root
118 rm -f test-permissions* || die # Test is broken when run as root
119 rm -f test-pull-permission* || die # Test is broken when run as root
120 rm -f test-clone-failure* || die
121 rm -f test-journal-exists* || die
122 rm -f test-repair-strip* || die
126 distutils-r1_src_test
132 rm -rf "${TMPDIR}"/test
133 distutils_install_for_testing
135 "${PYTHON}" run-tests.py --verbose \
136 --tmpdir="${TMPDIR}"/test \
137 --with-hg="${TEST_DIR}"/scripts/hg \
138 || die "Tests fail with ${EPYTHON}"
142 use emacs && elisp-site-regen
144 elog "If you want to convert repositories from other tools using convert"
145 elog "extension please install correct tool:"
147 elog " dev-vcs/darcs"
149 elog " dev-vcs/monotone"
150 elog " dev-vcs/subversion"
154 use emacs && elisp-site-regen