#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
export PYBUILD_NAME=glances

%:
	dh $@ --with python3,sphinxdoc --buildsystem=pybuild

# Split package and documentation
override_dh_sphinxdoc:
	sphinx-build -b html -d debian/tmp/doctrees docs \
		debian/glances-doc/usr/share/doc/glances/html
	dh_sphinxdoc

# Split package and documentation
override_dh_auto_install:
	dh_auto_install --destdir $(CURDIR)/debian/glances
	# Remove embedded code copies
	rm -rf $(CURDIR)/debian/glances/usr/lib/python3/dist-packages/glances/outputs/static/public/images/glances.png
	rm -rf $(CURDIR)/debian/glances/usr/lib/python3/dist-packages/glances/outputs/static/images/glances.png

# Overriding test to prevent FTBS (cf. #733168) http://bugs.debian.org/733168
# disable tests as they require /etc/mtab and fail in chroots
override_dh_auto_test:

# Fix lintian warning (duplicates files Copying, News; and remove authors, glances.conf)
override_dh_installdocs:
	set -e && for docs in COPYING AUTHORS NEWS glances.conf; do \
                rm -f $(CURDIR)/debian/glances/usr/share/doc/glances/$$docs ; \
        done
	dh_installdocs

override_dh_installchangelogs:
	dh_installchangelogs NEWS

override_dh_clean:
	rm -rf ./Glances.egg-info
	dh_clean
