#! /usr/bin/make -f
export DH_VERBOSE=1

include /usr/share/dpkg/pkg-info.mk

prebuilt_version = $(shell cat debian/prebuilt/version)
ifneq ($(DEB_VERSION_UPSTREAM:+dfsg=), $(prebuilt_version))
    $(error Please run ./debian/prebuilt/update.sh to update CSS for the new version.)
endif

# intentionally break networking, as using it is against policy and nodeenv/npm may try to download modules
export http_proxy=http://127.0.0.1:9/
export https_proxy=http://127.0.0.1:9/

export PYBUILD_BEFORE_TEST=cp -r src/pydata_sphinx_theme {build_dir}
export PYBUILD_TEST_ARGS=-v
export PYBUILD_NAME=pydata-sphinx-theme

%:
	dh $@ --buildsystem=pybuild

execute_before_dh_auto_build:
	pybabel compile -d $(CURDIR)/src/pydata_sphinx_theme/locale -D sphinx
	ln -s /usr/share/node_modules .
	webpack
	cp -a debian/prebuilt/styles src/pydata_sphinx_theme/theme/pydata_sphinx_theme/static/
