packaging: upgrade Debian packaging to build with Python 3 stable
authorDenis Laxalde <denis@laxalde.org>
Mon, 21 Oct 2019 10:59:54 +0200
branchstable
changeset 43310 7574ccd87200
parent 43309 b4b1131187c4
child 43311 88928063addb
packaging: upgrade Debian packaging to build with Python 3 Also drop the explicit "Depends: python" as debhelper will add it.
contrib/packaging/debian/control
contrib/packaging/debian/rules
tests/test-debian-packages.t
--- a/contrib/packaging/debian/control	Mon Oct 21 11:26:41 2019 +0200
+++ b/contrib/packaging/debian/control	Mon Oct 21 10:59:54 2019 +0200
@@ -7,20 +7,19 @@
  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 @@
 Architecture: all
 Depends:
  ${misc:Depends},
- ${python:Depends},
+ ${python3:Depends},
 Recommends: mercurial (= ${source:Version}), ca-certificates
 Suggests: wish
 Breaks: mercurial (<< ${source:Version})
--- a/contrib/packaging/debian/rules	Mon Oct 21 11:26:41 2019 +0200
+++ b/contrib/packaging/debian/rules	Mon Oct 21 10:59:54 2019 +0200
@@ -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 @@
 	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 \
--- a/tests/test-debian-packages.t	Mon Oct 21 11:26:41 2019 +0200
+++ b/tests/test-debian-packages.t	Mon Oct 21 10:59:54 2019 +0200
@@ -17,10 +17,10 @@
   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)