From 2a70941934a0f7f4b818c2f276880516cd1768e3 Mon Sep 17 00:00:00 2001 From: Ben Finney Date: Sat, 13 Feb 2016 21:58:09 +1100 Subject: [PATCH] Patch the source to move code examples out of the Python package. --- debian/changelog | 3 ++- debian/control | 1 + debian/patches/001.add-examples-to-manifest.patch | 29 +++++++++++++++++++++++ debian/patches/series | 1 + debian/rules | 23 ++++++++++++++++-- debian/xkcdpass.examples | 4 ++-- 6 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 debian/patches/001.add-examples-to-manifest.patch create mode 100644 debian/patches/series diff --git a/debian/changelog b/debian/changelog index 1f74868..6f3e779 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,8 +10,9 @@ xkcdpass (1.4.3-1) UNRELEASED; urgency=medium * Refine regex pattern for upstream tarball URLs. * debian/clean: * Remove directories created by Setuptools. - * debian/control, debian/rules: + * debian/control, debian/rules, debian/patches/*: * Migrate to Pybuild for building Python-based code. + * Patch the source to move code examples out of the Python package. * debian/*.examples: * Package new Python examples. diff --git a/debian/control b/debian/control index e639547..49ea1ee 100644 --- a/debian/control +++ b/debian/control @@ -5,6 +5,7 @@ Priority: optional Standards-Version: 3.9.6 Build-Depends: debhelper (>= 9~), + quilt, bash-completion, dh-python, python3-docutils, diff --git a/debian/patches/001.add-examples-to-manifest.patch b/debian/patches/001.add-examples-to-manifest.patch new file mode 100644 index 0000000..481d35f --- /dev/null +++ b/debian/patches/001.add-examples-to-manifest.patch @@ -0,0 +1,29 @@ +Description: Add the code examples to the Distutils manifest. + . + This ensures the code examples, which are not part of any Python + package, will be part of the source distribution (“sdist”). +Author: Ben Finney +Last-Update: 2016-02-13 + +diff --git a/MANIFEST.in b/MANIFEST.in +index 157cf3b9..eb9a9d6b 100644 +--- a/MANIFEST.in ++++ b/MANIFEST.in +@@ -1,4 +1,5 @@ + include xkcdpass/static/* + include tests/* ++include examples/* + include LICENSE.BSD + include xkcdpass.1 + + + +Local variables: +coding: utf-8 +mode: diff +time-stamp-format: "%:y-%02m-%02d" +time-stamp-start: "^Last-Update:[ ]+" +time-stamp-end: "$" +time-stamp-line-limit: 20 +End: +vim: fileencoding=utf-8 filetype=diff : diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..1aff5a4 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +001.add-examples-to-manifest.patch diff --git a/debian/rules b/debian/rules index f3af24c..0372fea 100755 --- a/debian/rules +++ b/debian/rules @@ -19,19 +19,24 @@ manpage_paths = $(addprefix ${DOCUMENTATION_DIR}/,${manpage_names}) manpages = $(addsuffix ${MANPAGE_SUFFIX},${manpage_paths}) GENERATED_FILES += ${DOCUMENTATION_DIR}/*${MANPAGE_SUFFIX} -export PYBUILD_NAME = xkcdpass +MAIN_PYTHON_PACKAGE = xkcdpass +export PYBUILD_NAME = ${MAIN_PYTHON_PACKAGE} # Send HTTP traffic to the “discard” service during packaging actions. export http_proxy = http://127.0.1.1:9/ export https_proxy = ${http_proxy} +examples_dir = examples +example_modules += example_import.py +example_modules += example_json.py + RST_SUFFIX = .txt RST2MAN = rst2man %: - dh $@ --with bash-completion,python3 --buildsystem=pybuild + dh $@ --with quilt,bash-completion,python3 --buildsystem=pybuild build: ${manpages} @@ -46,6 +51,20 @@ override_dh_auto_clean: dh_auto_clean $(RM) -r ${GENERATED_FILES} +.PHONY: override_dh_quilt_patch +override_dh_quilt_patch: + dh_quilt_patch + mkdir "${examples_dir}"/ + mv $(addprefix ${MAIN_PYTHON_PACKAGE}/,${example_modules}) "${examples_dir}"/ + +.PHONY: override_dh_quilt_unpatch +override_dh_quilt_unpatch: + if [ -d "${examples_dir}"/ ] ; then \ + mv $(addprefix ${examples_dir}/,${example_modules}) "${MAIN_PYTHON_PACKAGE}"/ ; \ + rmdir "${examples_dir}"/ ; \ + fi + dh_quilt_unpatch + .PHONY: get-packaged-orig-source get-packaged-orig-source: diff --git a/debian/xkcdpass.examples b/debian/xkcdpass.examples index 3563357..dfd2537 100644 --- a/debian/xkcdpass.examples +++ b/debian/xkcdpass.examples @@ -1,2 +1,2 @@ -xkcdpass/example_import.py -xkcdpass/example_json.py +examples/example_import.py +examples/example_json.py -- 2.11.4.GIT