#!/usr/bin/make -f

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

export OSLO_PACKAGE_VERSION=0.18.0

PYTHONS := $(shell pyversions -vr)
PYTHON3S :=  $(shell py3versions -vr)

override_dh_auto_clean:
	dh_auto_clean
	rm -rf .testrepository

override_dh_sphinxdoc:
ifeq (,$(findstring nodocs, $(DEB_BUILD_OPTIONS)))
	PYTHONPATH=$(CURDIR) sphinx-build $(SPHINXOPTS) -b html doc/source $(CURDIR)/debian/python-pylxd-doc/usr/share/doc/python-pylxd-doc/html
	dh_sphinxdoc -O--buildsystem=pybuild
endif

override_dh_auto_test:
	nosetests pylxd
	nosetests3 pylxd


BRANCH = master
DATE=$(shell date +%Y%m%d%H%M)
get-orig-snapshot:
	rm -Rf pylxd-upstream
	git clone https://github.com/lxc/pylxd pylxd-upstream
	cd pylxd-upstream && \
		export COMMIT=`git rev-parse --short HEAD` && \
		export UPSTREAM_VERSION=`grep version setup.cfg | cut -d ' ' -f 3` && \
		 git archive --format tgz --prefix=python-pylxd-$$UPSTREAM_VERSION~git$(DATE)/ \
			-o ../../python-pylxd_$$UPSTREAM_VERSION~git$(DATE).$$COMMIT.orig.tar.gz $(BRANCH)
	rm -Rf pylxd-upstream
