#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright 2017-2018 Jonas Smedegaard <dr@jones.dk>
# Description: Main Debian packaging script for Astroid
#
# This program is free software;
# you can redistribute it and/or modify it
# under the terms of the GNU General Public License
# as published by the Free Software Foundation;
# either version 3, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY;
# without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.
# If not, see <http://www.gnu.org/licenses/>.

# resolve if release is experimental
include /usr/share/dpkg/pkg-info.mk
EXP_RELEASE = $(filter experimental% UNRELEASED,$(DEB_DISTRIBUTION))

%:
	dh $@ --parallel

# use virtual X11 and UTF-8 in testsuite
# create fake $HOME to please gnupg2
# ignore testuite failure when targeting experimental
override_dh_auto_test:
	mkdir debian/tmphome
	HOME=debian/tmphome LC_ALL=C.UTF-8 xvfb-run -a \
		dh_auto_test --no-parallel $(if $(EXP_RELEASE), || true)
	rm -rf debian/tmphome

# avoid (seemingly) superfluous files
override_dh_auto_install:
	dh_auto_install
	rm debian/astroid/usr/share/astroid/ui/icons/LICENSE
	rm debian/astroid/usr/share/gir-1.0/Astroid-0.2.gir
	rm debian/astroid/usr/lib/girepository-1.0/Astroid-0.2.typelib
