File: rules

package info (click to toggle)
python-m2r 0.2.1-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 340 kB
  • sloc: python: 1,431; makefile: 287; sh: 1
file content (37 lines) | stat: -rwxr-xr-x 1,139 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
#!/usr/bin/make -f

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

STEM = m2r
DESTDIR = debian/tmp
DOCDIR = debian/python-$(STEM)-doc/usr/share/doc/python-$(STEM)-doc/html

CMD = $(STEM)
_ENV = $(strip \
 PATH="$(DESTDIR)/usr/bin:$(PATH)" \
 PYTHONPATH="$(DESTDIR)/usr/lib/$(shell py3versions -d)/dist-packages")

# generate manpage with help2man from --help option of python script
_mkman = $(_ENV) \
 help2man $(if $3,--name "$(strip $3)") --no-info --version-string $(DEB_VERSION_UPSTREAM) --output $2 $1 \
 || { $(_ENV) $1 --help; false; }

%:
	dh $@ --with python3,sphinxdoc --buildsystem=pybuild --exclude=.nojekyll

execute_after_dh_auto_build:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	sphinx-build -b html docs debian/doc/html
endif

override_dh_sphinxdoc:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	dh_sphinxdoc --exclude=MathJax.js
endif

# * generate manpage
execute_after_dh_auto_install:
	$(call _mkman, $(CMD), debian/$(CMD).1, \
		command-line tool to convert from markdown containing reStructuredText (rst) to reStructuredText)
#	find $(destdir)/usr/lib -name '*.pyc' -delete
#	find $(destdir)/usr/lib -type d -empty -delete