#!/usr/bin/make -f

export DH_VERBOSE=1

export PYBUILD_NAME=nacl
export PYBUILD_TEST_PYTEST=1
export PYBUILD_TEST_ARGS={dir}/tests/

export PYTHONDONTWRITEBYTECODE=1

# Make sure PyNaCl uses the system libsodium instead of trying to use the
# vendored copy
export SODIUM_INSTALL=system


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


override_dh_clean:
	dh_clean
	# Remove the vendored libsodium just to make sure we don't build
	# against it
	rm -rf src/libsodium


override_dh_auto_clean:
	dh_auto_clean
	rm -rf src/nacl/_lib/__pycache__


override_dh_sphinxdoc:
ifeq (,$(findstring nodocs, $(DEB_BUILD_OPTIONS)))
	PYTHONPATH=debian/python-nacl/usr/lib/python2.7/dist-packages http_proxy='127.0.0.1:9' sphinx-build -N -bhtml docs debian/python-nacl-doc/usr/share/doc/python-nacl-doc/html
	dh_sphinxdoc
endif


override_dh_python3:
	dh_python3
	rm -rf debian/python3-nacl/usr/lib/python3.?
