#!/usr/bin/make -f

#export DH_VERBOSE=1

export PYBUILD_NAME=pygments
export PYBUILD_TEST_ARGS=-v -k 'not test_chooses_correct_lexer_for_example_files and not test_guess_lexer_singularity and not test_guess_lexer_forth and not test_guess_lexer_modula2 and not test_guess_lexer_unicon and not test_guess_lexer_ezhil and not test_guess_lexer_gdscript and not test_guess_lexer_gap and not test_guess_lexer_easytrieve and not test_guess_lexer_jcl and not test_guess_lexer_rexx'

%:
	dh $@ --buildsystem=pybuild

execute_after_dh_auto_clean:
	rm -rf build Pygments.egg-info doc/_build
	find . -name "*\.pyc" -delete

execute_after_dh_auto_build:
ifeq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS)))
	PYTHONPATH=$(CURDIR):$(CURDIR)/doc make -C doc html
else
	mkdir -p doc/_build/html/
endif

execute_after_dh_auto_install:
	install -m 644 external/pygments.bashcomp debian/python3-pygments/usr/share/bash-completion/completions/pygmentize
	test -d debian/python-pygments-doc/usr/share/bash-completion && rm -rf debian/python-pygments-doc/usr/share/bash-completion

override_dh_installchangelogs:
	dh_installchangelogs -i CHANGES

override_dh_compress:
	dh_compress -i -X.py -X.inv
