#!/usr/bin/make -f

export PYBUILD_DESTDIR_python3=debian/python3-sympy/

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

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

override_dh_auto_build: export http_proxy=127.0.0.1:9
override_dh_auto_build: export https_proxy=127.0.0.1:9
override_dh_auto_build:
	dh_auto_build
	faketime "`dpkg-parsechangelog -S date`" \
		sh -c '(cd doc/; make html)'

DOCDIR = debian/python-sympy-doc/usr/share/doc/python-sympy-doc
override_dh_auto_install:
	dh_auto_install
	mv debian/python3-sympy/usr/bin/isympy debian/isympy-common/usr/bin/
	mv debian/python3-sympy/usr/share/man/man1/* \
		debian/isympy-common/usr/share/man/man1/
	rm -rf debian/python*-sympy/usr/bin/
	rm -rf debian/python*-sympy/usr/share/man/
	# Get rid of embedded mpmath.  Unfortunately, we
	# can't remove all files with quilt (empty files, for example).
	rm -rf debian/python*-sympy/usr/lib/python*/dist-packages/sympy/mpmath/
	# create the file version.json for the package python-sympy-doc
	install -d $(DOCDIR)
	v=$$(dpkg-parsechangelog --show-field Version| sed 's/-.*//'); \
	  echo "{\"latest\": \"$$v\", \"dev\": \"$$v\"}" > \
	    $(DOCDIR)/version.json
	# modify the file /usr/share/doc/python-sympy-doc/html/index.html
	# to declare furo.js as a script of type 'module'
	# !!! this task is UNFINISHED so far !!!
	# I should first fix the problem with sphinx build's failure !

override_dh_auto_clean:
	dh_auto_clean
	(cd doc/; make clean)
	rm -rf sympy.egg-info

override_dh_auto_test:
