From 88df41ceca1fe665596ff35ab79d0a4984093c51 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@debian.org>
Date: Sat, 14 May 2016 20:08:47 +0200
Subject: [PATCH] Switch build system to dh and pybuild
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

Sadly we can't enable tests…
---
 debian/rules | 78 ++++++----------------------------------------------
 1 file changed, 9 insertions(+), 69 deletions(-)

diff --git a/debian/rules b/debian/rules
index 7dc87c0..74c924d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,9 +1,4 @@
 #!/usr/bin/make -f
-# Sample debian/rules that uses debhelper.
-# GNU copyright 1997 to 1999 by Joey Hess.
-#
-# Modified to make a template file for a multi-binary package with separated
-# build-arch and build-indep targets  by Bill Allombert 2001
 
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
@@ -11,77 +6,22 @@
 # This has to be exported to make some magic below work.
 export DH_OPTIONS
 
-PYVERS := $(shell pyversions -vr)
-PY3VERS := $(shell py3versions -vr)
-
-PKGROOT=$(CURDIR)/debian/python-pyxattr
-DBGROOT=$(CURDIR)/debian/python-pyxattr-dbg
-PKG3ROOT=$(CURDIR)/debian/python3-pyxattr
-DBG3ROOT=$(CURDIR)/debian/python3-pyxattr-dbg
+export PYBUILD_NAME = pyxattr
 
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-pie
 DPKG_EXPORT_BUILDFLAGS = 1
 include /usr/share/dpkg/buildflags.mk
 
-build: build-arch build-indep
-	touch $@
-
-build-arch: $(PYVERS:%=build-python%) $(PY3VERS:%=build-python%)
-	$(MAKE) doc
-	touch $@
-
-build-python%:
-	python$* setup.py build
-	python$*-dbg setup.py build
-	touch $@
-
-build-indep:
-	touch $@
+%:
+	dh $@ --with python2,python3,sphinxdoc --buildsystem=pybuild
 
-clean:
-	dh_testdir
-	dh_testroot
-	rm -f build-indep build-arch
-	$(MAKE) clean
-	rm -f $(PYVERS:%=build-python%)
-	rm -f $(PY3VERS:%=build-python%)
-	rm -rf pxattr.egg-info
-	dh_clean
+override_dh_auto_build:
+	dh_auto_build
+	PYTHONPATH=. http_proxy='127.0.0.1:9' make doc
 
-install: build $(PYVERS:%=install-python%) $(PY3VERS:%=install-python%)
-	find $(DBGROOT) ! -type d ! -name '*_d.so' | xargs rm -f
-	find $(DBGROOT) -depth -empty -print0 | xargs -r0 rmdir
-
-install-python2%:
-	python2$* setup.py install --root $(PKGROOT) --install-layout=deb
-	python2$*-dbg setup.py install --root $(DBGROOT) --install-layout=deb
-
-install-python3%:
-	python3$* setup.py install --root $(PKG3ROOT) --install-layout=deb
-	python3$*-dbg setup.py install --root $(DBG3ROOT) --install-layout=deb
-
-# Build architecture-dependent files here.
-binary-arch: build install
-	dh_testdir
-	dh_testroot
-	dh_installchangelogs
-	dh_installdocs
-	dh_sphinxdoc
+override_dh_strip:
 	dh_strip -ppython-pyxattr --dbgsym-migration='python-pyxattr-dbg (<< 0.5.6-1~)'
 	dh_strip -ppython3-pyxattr --dbgsym-migration='python3-pyxattr-dbg (<< 0.5.6-1~)'
-	dh_compress -X.js
-	dh_fixperms
-	dh_python2
-	dh_python3
-	dh_installdeb
-	dh_shlibdeps
-	dh_gencontrol
-	dh_md5sums
-	dh_builddeb
-
-# Build architecture independant packages here.
-binary-indep: build install
-# Nothing to do
 
-binary: binary-arch binary-indep
-.PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure
+override_dh_auto_test:
+	echo "Tests need an xattr-enabled filesystem, not running by default"
-- 
2.39.5