[PATCH 3 of 6] packaging: upgrade Debian packaging to build with Python 3
Denis Laxalde
denis at laxalde.org
Mon Oct 21 06:00:55 EDT 2019
# HG changeset patch
# User Denis Laxalde <denis at laxalde.org>
# Date 1571648394 -7200
# Mon Oct 21 10:59:54 2019 +0200
# Node ID 09f95d7a20c6d2e0bf6218e2a5bc9cd2b803c8ec
# Parent 70764c9ddba397fa6cc2c92a28a1a65c5bdddaea
packaging: upgrade Debian packaging to build with Python 3
Also drop the explicit "Depends: python" as debhelper will add it.
diff --git a/contrib/packaging/debian/control b/contrib/packaging/debian/control
--- a/contrib/packaging/debian/control
+++ b/contrib/packaging/debian/control
@@ -7,20 +7,19 @@ Build-Depends:
dh-python,
less,
netbase,
- python-all,
- python-all-dev,
- python-docutils,
+ python3-all,
+ python3-all-dev,
+ python3-docutils,
unzip,
zip
Standards-Version: 3.9.4
-X-Python-Version: >= 2.7
+X-Python3-Version: >= 3.5
Package: mercurial
Depends:
- python,
${shlibs:Depends},
${misc:Depends},
- ${python:Depends},
+ ${python3:Depends},
mercurial-common (= ${source:Version})
Architecture: any
Description: fast, easy to use, distributed revision control tool.
@@ -41,7 +40,7 @@ Package: mercurial-common
Architecture: all
Depends:
${misc:Depends},
- ${python:Depends},
+ ${python3:Depends},
Recommends: mercurial (= ${source:Version}), ca-certificates
Suggests: wish
Breaks: mercurial (<< ${source:Version})
diff --git a/contrib/packaging/debian/rules b/contrib/packaging/debian/rules
--- a/contrib/packaging/debian/rules
+++ b/contrib/packaging/debian/rules
@@ -4,18 +4,21 @@
CPUS=$(shell cat /proc/cpuinfo | grep -E ^processor | wc -l)
+export HGPYTHON3=1
+export PYTHON=python3
+
%:
- dh $@ --with python2
+ dh $@ --with python3
override_dh_auto_test:
http_proxy='' dh_auto_test -- TESTFLAGS="-j$(CPUS)"
-override_dh_python2:
- dh_python2
+override_dh_python3:
+ dh_python3
find debian/mercurial/usr/share -type d -empty -delete
override_dh_install:
- python$(PYVERS) setup.py install --root "$(CURDIR)"/debian/mercurial --install-layout=deb
+ python3 setup.py install --root "$(CURDIR)"/debian/mercurial --install-layout=deb
# chg
make -C contrib/chg \
DESTDIR="$(CURDIR)"/debian/mercurial \
@@ -25,7 +28,7 @@ override_dh_install:
find "$(CURDIR)"/debian/mercurial/usr/lib \
! -name '*.so' ! -type d -delete , \
-type d -empty -delete
- python$(PYVERS) setup.py install --root "$(CURDIR)/debian/mercurial-common" --install-layout=deb
+ python3 setup.py install --root "$(CURDIR)/debian/mercurial-common" --install-layout=deb
make install-doc PREFIX="$(CURDIR)"/debian/mercurial-common/usr
# remove arch-dependent python stuff
find "$(CURDIR)"/debian/mercurial-common/usr/lib \
diff --git a/tests/test-debian-packages.t b/tests/test-debian-packages.t
--- a/tests/test-debian-packages.t
+++ b/tests/test-debian-packages.t
@@ -17,10 +17,10 @@ Ensure debuild doesn't run the testsuite
mercurial_*.deb (glob)
main deb should have .so but no .py
$ dpkg --contents mercurial_*.deb | egrep '(localrepo|parsers)'
- * ./usr/lib/python2.7/dist-packages/mercurial/cext/parsers*.so (glob)
+ * ./usr/lib/python3/dist-packages/mercurial/cext/parsers*.so (glob)
mercurial-common should have py but no .so or pyc
$ dpkg --contents mercurial-common_*.deb | egrep '(localrepo|parsers.*so)'
- * ./usr/lib/python2.7/dist-packages/mercurial/localrepo.py (glob)
+ * ./usr/lib/python3/dist-packages/mercurial/localrepo.py (glob)
zsh completions should be in the common package
$ dpkg --contents mercurial-common_*.deb | egrep 'zsh.*[^/]$'
* ./usr/share/zsh/vendor-completions/_hg (glob)
More information about the Mercurial-devel
mailing list