| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 
 | #!/usr/bin/make -f
include /usr/share/dpkg/pkg-info.mk
export PYBUILD_NAME=ase
%:
	dh $@ --with python3,sphinxdoc --buildsystem=pybuild
override_dh_auto_test:
	PYBUILD_SYSTEM=custom \
		PYBUILD_TEST_ARGS="cd ase/test; {interpreter} -m ase test" \
		PATH=$(CURDIR)/bin:$$PATH \
		LC_ALL=C.UTF-8 \
		TERM=linux \
		dh_auto_test
override_dh_auto_install:
	dh_auto_install
	# Move /usr/bin/ase from python3-ase to ase, drop all other scripts
	mkdir -p $(CURDIR)/debian/ase/usr/bin/
	mv $(CURDIR)/debian/python3-ase/usr/bin/ase $(CURDIR)/debian/ase/usr/bin/
	rm -f $(CURDIR)/debian/python3-ase/usr/bin/*
	# Fix privacy breach
	find $(CURDIR)/debian/python*-ase/usr/lib/python*/dist-packages/ase/db/templates -name '*.html' -exec \
		sed -i -e "s/<script.*jquery-[0-9].*\.js.*<\/script>/<script src=\"{{ url_for('static', filename='jquery.min.js') }}\"><\/script>/g" '{}' \;
	find $(CURDIR)/debian/python*-ase/usr/lib/python*/dist-packages/ase/db/templates -name '*.html' -exec \
		sed -i -e "s/<script.*jquery-ui\..*js.*<\/script>/<script src=\"{{ url_for('static', filename='jquery-ui.min.js') }}\"><\/script>/g" '{}' \;
	find $(CURDIR)/debian/python*-ase/usr/lib/python*/dist-packages/ase/db/templates -name '*.html' -exec \
		sed -i -e "s/<script.*bootstrap\..*js.*<\/script>/<script src=\"{{ url_for('static', filename='bootstrap.min.js') }}\"><\/script>/g" '{}' \;
	find $(CURDIR)/debian/python*-ase/usr/lib/python*/dist-packages/ase/db/templates -name '*.html' -exec \
		sed -i -e "s/<link.*bootstrap\..*css.*>/<link rel="stylesheet" href=\"{{ url_for('static', filename='bootstrap.min.css') }}\">/g" '{}' \;
	find $(CURDIR)/debian/python*-ase/usr/lib/python*/dist-packages/ase/db/templates -name '*.html' -exec \
		sed -i -e "s/<link.*bootstrap-theme\..*css.*>/<link rel="stylesheet" href=\"{{ url_for('static', filename='bootstrap-theme.min.css') }}\">/g" '{}' \;
	find $(CURDIR)/debian/python*-ase/usr/lib/python*/dist-packages/ase/db/templates -name '*.html' -exec \
		sed -i -e "s/<link.*jquery-ui\..*css.*>/<link rel="stylesheet" href=\"{{ url_for('static', filename='jquery-ui.min.css') }}\">/g" '{}' \;
	find $(CURDIR)/debian/python*-ase/usr/lib/python*/dist-packages/ase/db/templates -name '*.html' -exec \
		sed -i -e "s/<link.*font-awesome\..*css.*>/<link rel="stylesheet" href=\"{{ url_for('static', filename='font-awesome.min.css') }}\">/g" '{}' \;
override_dh_sphinxdoc:
ifeq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS)))
	PYTHONPATH=./doc/ python3 -m sphinx -b html doc debian/python-ase-doc/usr/share/doc/python-ase-doc/html
	dh_sphinxdoc
	find $(CURDIR)/debian/python-ase-doc -name '*.html' -exec \
		sed -i -e "s/https:.*mathjax.*\.js/file:\/\/\/usr\/share\/javascript\/mathjax\/MathJax.js/g" '{}' \;
endif
override_dh_python3:
	dh_python3
	# Remove .pytest_cache
	rm -rf $(CURDIR)/debian/python3-ase/usr/lib/python3/dist-packages/ase/test/.pytest_cache
override_dh_installman:
	PYTHONPATH=$(CURDIR) \
		help2man --version-string $(DEB_VERSION_UPSTREAM) -N -n "ASE command line tool" \
		bin/ase -o $(CURDIR)/debian/ase.1
	sed -i '/^{/s/,/, /g' $(CURDIR)/debian/ase.1
	dh_installman
 |