#!/usr/bin/make -f
# -*- makefile -*-

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

export PYBUILD_NAME=spyder
export PYBUILD_DESTDIR_python3=debian/python3-$(PYBUILD_NAME)
export PYBUILD_INSTALL_ARGS=--install-data=usr
export PYBUILD_AFTER_INSTALL=python3 setup.py install_scripts --skip-build --install-dir={destdir}/usr/bin \
	; rm -f {destdir}/usr/bin/spyder_win_post_install.py

%:
	dh $@ --buildsystem=pybuild

execute_before_dh_clean:
	rm -f debian/spyder{,3}.1

execute_after_dh_auto_install:
	dh_movefiles --package=spyder --sourcedir=$(PYBUILD_DESTDIR_python3) usr/bin usr/share

execute_after_dh_python3:
	rm -f $(PYBUILD_DESTDIR_python3)/usr/lib/python3/dist-packages/spyder/plugins/ipythonconsole/scripts/conda-activate.bat
	chmod a+x $(PYBUILD_DESTDIR_python3)/usr/lib/python3/dist-packages/spyder/plugins/ipythonconsole/scripts/conda-activate.sh
	chmod a+x $(PYBUILD_DESTDIR_python3)/usr/lib/python3/dist-packages/spyder/utils/check-git.sh
	find $(PYBUILD_DESTDIR_python3) -type d -empty -delete

execute_before_dh_installman:
	rst2man debian/manpage.rst > debian/spyder3.1

# There are no tests installed in the PyPI version of spyder
override_dh_auto_test:
