#! /usr/bin/make -f

export PYBUILD_NAME=py7zr

# Manually set upstream version number for setuptools-scm
export SETUPTOOLS_SCM_PRETEND_VERSION = $(shell dpkg-parsechangelog --show-field Version | sed --regexp-extended --expression='s/^1\.1\.2(-1)?\+really//; s/\+dfsg-.{1,100}$$//' )

# test_compress_* require tests/data/lib, which we removed due to missing copyright
# test_concurrent_futures tries to access internet
# test_bcj_* uses binary files removed dues to missing copyright
# test_cli, test_archive_already_exist, test_volume_creation_wrong_volume_unit uses importlib_metadata which requires an egg-info dir, which we cant build (bdist_egg) because setuptools_scm cant detect a version
# test_compress_files_deref_loop uses symlink loop to provide test target file that sometimes break test system
export PYBUILD_TEST_ARGS=-k " \
      not test_compress_arm64 \
  and not test_compress_ppc \
  and not test_compress_ia64 \
  and not test_compress_sparc \
  and not test_compress_armt \
  and not test_concurrent_futures \
  and not test_bcj_encode \
  and not test_bcj_decode \
  and not test_cli_no_subcommand \
  and not test_cli_info \
  and not test_archive_already_exist \
  and not test_volume_creation_wrong_volume_unit \
  and not test_compress_files_deref_loop \
"

%:
	dh $@ --buildsystem=pybuild --with=sphinxdoc

execute_before_dh_auto_build-indep:
	echo "upstream-version: $(SETUPTOOLS_SCM_PRETEND_VERSION)"

execute_after_dh_auto_build-indep:
	$(MAKE) --directory=docs html

override_dh_installchangelogs:
	dh_installchangelogs --keep
