#!/usr/bin/make -f

export CARGO_HOME = $(CURDIR)/debian/cargo_home
export CARGO_NET_OFFLINE = true

%:
	dh $@ --buildsystem=pybuild

# Build against the Debian-packaged Rust crates in /usr/share/cargo/registry
# (configured via debian/cargo_home/config.toml). The upstream Cargo.lock pins
# crates.io versions that differ from Debian's, so drop it and let cargo relock
# against the mirror.
override_dh_auto_build:
	mv Cargo.lock Cargo.lock.saved
	dh_auto_build

override_dh_auto_clean:
	if test -f Cargo.lock.saved; then mv Cargo.lock.saved Cargo.lock; fi
	dh_auto_clean
