#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
export PYBUILD_NAME=linux-procfs

override_dh_auto_build:
	dh_auto_build
	a2x -d manpage -f manpage pflags.8.asciidoc
	
	# renaming pflags to avoid conflict between python and python3 versions
	cp -p pflags.8 pflags2.8
	cp -p pflags.8 pflags3.8
	cp -p pflags pflags2
	cp -p pflags pflags3
	sed -i -e 's/python3/python/' pflags2

override_dh_auto_install:
	dh_auto_install

	# Removing original binaries as now we have renamed versions
	# to avoid conflicts between python2 and python3
	# We'll put the original back with update-alternatives in postinst
	rm -f debian/python-linux-procfs/usr/bin/pflags
	rm -f debian/python3-linux-procfs/usr/bin/pflags

clean:
	dh_auto_clean --buildsystem pybuild # Cleans pybuild stuff
	dh_clean                            # Cleans asciidoc/pflags stuff
	rm -rf python_linux_procfs.egg-info # Cleans egg-info dir which
	                                    #   used underscores

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