File: rules

package info (click to toggle)
hy 0.18.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 1,480 kB
  • sloc: python: 5,089; makefile: 217; sh: 26
file content (53 lines) | stat: -rwxr-xr-x 1,726 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
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
#!/usr/bin/make -f

export DH_VERBOSE := 1

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

export PYBUILD_NAME := hy

# "test_bin.py" and "test_hy2py.py" look for "hy" and "hy2py" in PATH (which come from "console_scripts" in "setup.py"), so can only run post-install
export PYBUILD_TEST_ARGS := -k '-test_bin -test_hy2py'

# "language.hy" tests use "README.md" from the original source for IO testing
export PYBUILD_BEFORE_TEST := cp {dir}/README.md {build_dir}/
export PYBUILD_AFTER_TEST := rm {build_dir}/README.md

# make sure Hy knows what version it is (and doesn't try to ask "git")
# https://github.com/hylang/hy/pull/1821
# https://github.com/hylang/hy/blob/0.18.0/get_version.py#L8-L9
export HY_VERSION := $(DEB_VERSION_UPSTREAM)

%:
	dh $@ --with python3 --buildsystem pybuild

BUILD_DATE := $(shell LC_ALL=C date -u '+%B %d, %Y' --date '@$(SOURCE_DATE_EPOCH)')
override_dh_auto_build:
	dh_auto_build
	make -C docs \
		SPHINXOPTS='-D today="$(BUILD_DATE)"' \
		man
	# TODO html docs (and install them in hy-doc or something)

override_dh_auto_install:
	dh_auto_install
# make sure all python3-hy binaries have a "3" suffix
# (skip binaries that already have a "3" suffix)
	for bin in debian/python3-hy/usr/bin/*; do \
		[ "$${bin%3}" = "$${bin}" ] || continue; \
		if [ -e "$${bin}3" ]; then \
			rm -v "$${bin}"; \
		else \
			mv "$${bin}" "$${bin}3"; \
		fi; \
	done
# clean up some nonsense "get_version.py" creates (see also https://github.com/hylang/hy/pull/1766)
# TODO figure out a cleaner way to exclude this via pybuild directly instead
	rm -rf debian/*/usr/get_version/

override_dh_auto_clean:
	dh_auto_clean
	# sphinx
	rm -rf docs/_build
	# egg-info! (not shipped at all in upstream tarballs)
	rm -rf hy.egg-info