File: rules

package info (click to toggle)
hy 1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,592 kB
  • sloc: python: 7,221; makefile: 38; sh: 27
file content (65 lines) | stat: -rwxr-xr-x 2,235 bytes parent folder | download | duplicates (2)
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
54
55
56
57
58
59
60
61
62
63
64
65
#!/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 'not test_bin and not 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 $@ --buildsystem pybuild

BUILD_DATE := $(shell LC_ALL=C date -u '+%B %d, %Y' --date '@$(SOURCE_DATE_EPOCH)')

# JMZ: disabled for now, since upstream's source-releases don't have a docs/ folder
execute_after_dh_auto_build:
	cp debian/hy.1 hy3.1
ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
	test ! -d docs || \
	sphinx-build docs docs/_build/manual
	-cp docs/_build/man/hy.1 hy3.1
	# TODO html docs (and install them in hy-doc or something)
endif

override_dh_auto_test:
	test ! -d tests || dh_auto_test

execute_after_dh_auto_install:
# make sure all python3-hy binaries have a "3" suffix
# (skip binaries that already have a "3" suffix)
	rm -rf debian/hy/usr/bin/
	mkdir -p debian/hy/usr/bin/
	for bin in debian/python3-hy/usr/bin/*; do \
		[ "$${bin%3}" = "$${bin}" ] || continue; \
		mv "$${bin}" "debian/hy/usr/bin/$${bin##*/}3"; \
	done
	rm -rf debian/python3-hy/usr/bin/

# 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/

DEB_COPYRIGHT_CHECK_IGNORE_REGEX = \
        debian/.*|docs/_static/cuddles.*\.png

# licensecheck v1
.PHONY: licensecheck
licensecheck:
	LANG=C.UTF-8 licensecheck \
		-i "^($(DEB_COPYRIGHT_CHECK_IGNORE_REGEX))$$" \
		--check '.*' --recursive --deb-machine --lines 0 * \
		> debian/copyright_newhints
	cmp debian/copyright_hints debian/copyright_newhints \
		&& rm debian/copyright_newhints