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
|
#!/usr/bin/make -f
# needed as we have more than one binary package
export PYBUILD_DESTDIR=debian/ocrmypdf
# determine upstream version to be used in other env vars
export DEB_UPSTREAM_VERSION = \
$(shell dpkg-parsechangelog -SVersion | cut -d- -f1)
# setuptools-scm's heuristics fail to determine the package version
# which causes the build to fail, so just override it
export SETUPTOOLS_SCM_PRETEND_VERSION = ${DEB_UPSTREAM_VERSION}
%:
dh $@ --with python3,sphinxdoc --buildsystem=pybuild
override_dh_installchangelogs:
dh_installchangelogs RELEASE_NOTES.rst
# upstream's doc build assumes that ocrmypdf is already installed, and
# tries to find its version with pkg_resources. Here we make our own
# copy and patch in the version string, and build the docs based on
# that. Better than a quilt patch which would have to be updated
# every upstream release
override_dh_auto_build:
mkdir -p debian/.debhelper
cp -R ocrmypdf debian/.debhelper
sed -i debian/.debhelper/ocrmypdf/__init__.py -e \
"s|^VERSION =.*|VERSION = \"$(DEB_UPSTREAM_VERSION)\"|"
PYTHONPATH=debian/.debhelper sphinx-build docs html
dh_auto_build -O--buildsystem=pybuild
# don't install installation instructions
override_dh_installdocs:
dh_installdocs -Xinstallation.html
override_dh_sphinxdoc:
dh_sphinxdoc -Xinstallation.html
# the pybuild build system does not yet support running py.test tests
# with pytest-runner (pytest-runner is necessary to run the test
# suite in advance of ocrmypdf being installed)
override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
python3 setup.py test
endif
# requires ocrmypdf already installed!
.PHONY: gen-man-page
gen-man-page:
help2man ocrmypdf --no-info \
-n "add an OCR text layer to PDF files" \
> debian/ocrmypdf.1
|