File: rules

package info (click to toggle)
pytest-snapshot 0.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 236 kB
  • sloc: python: 1,005; sh: 17; makefile: 16
file content (28 lines) | stat: -rwxr-xr-x 907 bytes parent folder | download
1
2
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
#!/usr/bin/make -f
# -*- makefile -*-

#export DH_VERBOSE=1

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

MAJOR = $(shell echo $(DEB_VERSION_UPSTREAM) | cut -f1 -d ".")
MINOR = $(shell echo $(DEB_VERSION_UPSTREAM) | cut -f2 -d ".")
MICRO = $(shell echo $(DEB_VERSION_UPSTREAM) | cut -f3 -d ".")

export PYBUILD_NAME=pytest_snapshot

%:
	dh $@ --buildsystem=pybuild

override_dh_auto_clean:
	dh_auto_clean
	rm -f $(PYBUILD_NAME)/_version.py
	rm -rf .mypy_cache .pytest_cache

override_dh_auto_build:
	# Upstream is using setuptools_scm to write the version data, we ned to
	# work around that and write the data manually.
	@echo "Using upstream version '$(DEB_VERSION_UPSTREAM)' to prepare version data for $(PYBUILD_NAME)/_version.py"
	@echo "version = '$(MAJOR).$(MINOR).$(MICRO)'" > $(PYBUILD_NAME)/_version.py
	@echo "version_tuple = ($(MAJOR), $(MINOR), $(MICRO))" >> $(PYBUILD_NAME)/_version.py
	dh_auto_build