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

include /usr/share/dpkg/pkg-info.mk

export DH_VERBOSE=1
export DH_OPTIONS=-v
export DEB_BUILD_OPTIONS=1

# Prevent setuptools/distribute from accessing the internet.
export http_proxy = http://127.0.9.1:9

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

build: build-stamp

build-stamp:
	dh_testdir

clean:
	dh_clean

override_dh_install:
	dh_prep
	dh_installdirs /usr/sbin /usr/share/pyshared /usr/share/man/man8
	dh_installman --language=C man/*
	dh_installdocs --exclude=html
	cd $(CURDIR)/debian/iptables-converter/usr/sbin && \
	cp $(CURDIR)/iptables_converter.py iptables-converter && \
	cp $(CURDIR)/ip6tables_converter.py ip6tables-converter && \
	cd $(CURDIR)
	dh_lintian

override_dh_installdocs:
	python setup.py build_sphinx
	dh_installdocs --package=iptables-converter-doc build/sphinx/html

override_dh_auto_clean:
	rm -rf build
	rm -rf *.egg-info

