#!/usr/bin/make -f
%:
	dh $@


override_dh_installdocs:
	make -C docs html
	rm docs/_build/html/._index.html
	rm docs/_build/html/_sources/._index.txt
	dh_installdocs
	rm debian/python-django-auth-ldap/usr/share/doc/python-django-auth-ldap/html/_static/jquery.js
	ln -s ../../../../javascript/jquery/jquery.js debian/python-django-auth-ldap/usr/share/doc/python-django-auth-ldap/html/_static/jquery.js

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	django-admin startproject testproject
	echo 'DATABASE_ENGINE = "sqlite3"' > testproject/settings.py
	echo 'DATABASE_NAME = "testproject/test.db3"' >> testproject/settings.py
	echo 'INSTALLED_APPS = ["django_auth_ldap","django.contrib.auth","django.contrib.contenttypes","django.contrib.admin","django.contrib.sites","django.contrib.sessions"]' >> testproject/settings.py
	echo 'SITE_ID = 1' >> testproject/settings.py
	echo 'ROOT_URLCONF = "testproject.urls"' >> testproject/settings.py
	for python in $(shell pyversions -r); do \
	  rm -f testproject/test.db3 ; \
	  PYTHONPATH=".:src" $$python testproject/manage.py syncdb --settings=testproject.settings --noinput ;\
	  PYTHONPATH=".:src" $$python testproject/manage.py test --settings=testproject.settings ; \
	done
	rm -rf testproject
endif

