diff options
Diffstat (limited to 'debian')
| -rw-r--r-- | debian/README.source | 45 | ||||
| -rw-r--r-- | debian/changelog | 7 | ||||
| -rw-r--r-- | debian/compat | 1 | ||||
| -rw-r--r-- | debian/control | 45 | ||||
| -rw-r--r-- | debian/copyright | 50 | ||||
| -rw-r--r-- | debian/gbp.conf | 21 | ||||
| -rw-r--r-- | debian/patches/migrate-from-times-to-arrow.patch | 52 | ||||
| -rw-r--r-- | debian/patches/series | 1 | ||||
| -rwxr-xr-x | debian/rules | 59 | ||||
| -rw-r--r-- | debian/source/format | 1 | ||||
| -rw-r--r-- | debian/tests/control | 20 | ||||
| -rwxr-xr-x | debian/tests/smoke-python2 | 39 | ||||
| -rwxr-xr-x | debian/tests/smoke-python3 | 39 | ||||
| -rw-r--r-- | debian/tests/smoke_test.py | 129 | ||||
| -rw-r--r-- | debian/watch | 19 |
15 files changed, 528 insertions, 0 deletions
diff --git a/debian/README.source b/debian/README.source new file mode 100644 index 0000000..7bf3e5e --- /dev/null +++ b/debian/README.source @@ -0,0 +1,45 @@ +========================================== +Debian source package for ‘python-jsonext’ +========================================== + +Build source package from VCS +============================= + +The source for the Debian packaging is managed in the ‘master’ branch +of the Git repository. + +To build the source package from the Git VCS: + +* Get the upstream source:: + + $ debian/rules get-packaged-orig-source + + Ensure the upstream source is placed where Git-BuildPackage will + find it for building the Debian source package. + +* Finalise the latest release in the Debian changelog:: + + $ debchange --release "" + + This is needed temporarily to build the source package with Debian + packaging tools. + + While developing the package, do not commit to the VCS any Debian + changelog that has any content in the release trailer for the latest + entry. + + Until that release is ready to finalise, it has not been uploaded to + Debian and so does not have a correct distribution, uploader, or + release timestamp. The header and trailer for the entry should + remain open during development to reflect this. + +* Build the source package with Git-BuildPackage:: + + $ gbp buildpackage + + Git-BuildPackage is configured (via the ‘debian/gbp.conf’ file) to + build the source package by overlaying the Debian packaging files + onto the upstream source. + + + -- Ben Finney <bignose@debian.org>, Sat, 26 Aug 2017 13:45:03 +1000 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..b4f4507 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,7 @@ +python-jsonext (0.4.1-1) unstable; urgency=medium + + * The “علي محمد باقر النمر (Ali Mohammed Baqir al-Nimr)” release. + * Initial release. + Closes: bug#873285. + + -- Ben Finney <bignose@debian.org> Sat, 26 Aug 2017 21:11:04 +1000 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +10 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..5fec2c8 --- /dev/null +++ b/debian/control @@ -0,0 +1,45 @@ +Source: python-jsonext +Maintainer: Ben Finney <bignose@debian.org> +Section: python +Priority: optional +Standards-Version: 4.0.1 +Build-Depends: + python3-pytest-runner, + python3-arrow, + python3-six, + python3-setuptools, + python3-all, + python-pytest-runner, + python-arrow, + python-six, + python-setuptools, + python-all (>= 2.7~), + dh-python, + debhelper (>= 10~) +Homepage: https://pypi.org/project/jsonext/ +VCS-Git: https://anonscm.debian.org/git/users/bignose/debian/pkg-python-jsonext.git +VCS-Browser: https://anonscm.debian.org/git/users/bignose/debian/pkg-python-jsonext.git +X-Python-Version: >= 2.7 +X-Python3-Version: >= 3.3 + +Package: python3-jsonext +Architecture: all +Depends: + ${python3:Depends}, + ${misc:Depends} +Description: serialisation to/from JSON for extra types — Python 3 + ‘jsonext’ makes easy JSON serialisation of Python objects outside of + the standard Python built-in-types. + . + This package installs the library for Python 3. + +Package: python-jsonext +Architecture: all +Depends: + ${python:Depends}, + ${misc:Depends} +Description: serialisation to/from JSON for extra types — Python 2 + ‘jsonext’ makes easy JSON serialisation of Python objects outside of + the standard Python built-in-types. + . + This package installs the library for Python 2. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..d40b7eb --- /dev/null +++ b/debian/copyright @@ -0,0 +1,50 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: jsonext +Upstream-Contact: Marc Brinkmann <git@marcbrinkmann.de> +Source: https://pypi.org/project/jsonext/ + +Files: * +Copyright: + © 2014–2015 Marc Brinkmann <git@marcbrinkmann.de> +License: Expat + +Files: debian/* +Copyright: + © 2009–2017 Ben Finney <bignose@debian.org> +License: GPL-3+ +License-Grant: + This is free software; you may copy, modify and/or distribute this work + under the terms of the GNU General Public License, version 3 or later. + No warranty expressed or implied. + + +License: Expat + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + +License: GPL-3+ + On Debian systems, the complete text of the GNU General Public License + version 3 can be found in ‘/usr/share/common-licenses/GPL-3’. + + +# Local variables: +# coding: utf-8 +# mode: debian-copyright +# fill-column: 78 +# End: +# vim: fileencoding=utf-8 textwidth=78 : diff --git a/debian/gbp.conf b/debian/gbp.conf new file mode 100644 index 0000000..c96c7ac --- /dev/null +++ b/debian/gbp.conf @@ -0,0 +1,21 @@ +# debian/gbp.conf +# Git-buildpackage configuration for this Debian source package. +# Manpage: ‘gbp.conf(5)’. + +[DEFAULT] + +# Overlay the exported source onto original upstream source? +overlay = true + +# Store the pristine upstream source in this VCS repository? +pristine-tar = false + +# Create the upstream source from this VCS repository? +create-orig = false + + +# Local variables: +# coding: utf-8 +# mode: conf +# End: +# vim: fileencoding=utf-8 filetype=conf noexpandtabs : diff --git a/debian/patches/migrate-from-times-to-arrow.patch b/debian/patches/migrate-from-times-to-arrow.patch new file mode 100644 index 0000000..39641f7 --- /dev/null +++ b/debian/patches/migrate-from-times-to-arrow.patch @@ -0,0 +1,52 @@ +Description: Use arrow instead of times module. +Author: Marc Brinkmann <git@marcbrinkmann.de> +Last-Update: 2015-10-26 22:16:53 +1100 +Comment: + Git commit hash 043a9004902479729220e164c75e0512e371f992. + . + The ‘times’ library is not packaged for Debian; the ‘arrow’ + library is. This change is already incorporated upstream. + +--- old/jsonext/mixins.py ++++ new/jsonext/mixins.py +@@ -1,5 +1,5 @@ + import datetime +-import times ++import arrow + + + class JSONDateTimeMixin(object): +@@ -22,9 +22,10 @@ class JSONDateTimeMixin(object): + >>> jsonext.dumps(d) + '"2013-11-17"' + """ ++ + def default(self, o): + if isinstance(o, datetime.datetime): +- return times.format(o, 'Zulu') ++ return arrow.get(o).to('utc').isoformat() + if isinstance(o, datetime.date): + return o.isoformat() + return super(JSONDateTimeMixin, self).default(o) +--- old/setup.py ++++ new/setup.py +@@ -22,5 +22,4 @@ setup( + url='http://github.com/mbr/jsonext', + license='MIT', + packages=find_packages(exclude=['tests']), +- install_requires=['times'], +-) ++ install_requires=['arrow'], ) + + + + +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..55e4ec5 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +migrate-from-times-to-arrow.patch diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..a3378ae --- /dev/null +++ b/debian/rules @@ -0,0 +1,59 @@ +#! /usr/bin/make -f + +# debian/rules +# Part of Debian ‘python-jsonext’ package. +# +# Copyright © 2009–2017 Ben Finney <bignose@debian.org> +# This is free software; you may copy, modify and/or distribute this work +# under the terms of the GNU General Public License, version 3 or later. +# No warranty expressed or implied. + +# Send HTTP traffic to the “discard” service during packaging actions. +export http_proxy = http://127.0.1.1:9/ +export https_proxy = ${http_proxy} + +export PYBUILD_NAME = jsonext + + +%: + dh $@ --with python3,python2 --buildsystem=pybuild + + +.PHONY: get-packaged-orig-source +get-packaged-orig-source: + $(uscan-download-source) --download-current-version + +# Policy §4.9 strongly recommends the ‘get-orig-source’ target: +# “This target is optional, but providing it if possible is a good idea.” +# +# This target is an anomaly: per Policy §4.9, it fetches the *latest* +# upstream source, regardless of this package's version. To fetch the +# upstream source corresponding to this package's *declared* version +# in ‘debian/changelog’, use ‘get-packaged-orig-source’ instead. +.PHONY: get-orig-source +get-orig-source: + $(uscan-download-source) + +get-orig-source get-packaged-orig-source: http_proxy = +get-orig-source get-packaged-orig-source: makefile_dir = $(abspath $(dir $(firstword ${MAKEFILE_LIST}))) +get-orig-source get-packaged-orig-source: package_dir = $(abspath $(dir ${makefile_dir})) + +define uscan-download-source + uscan --noconf --verbose \ + --force-download \ + --rename \ + --destdir=$(CURDIR) \ + --check-dirname-level=0 ${package_dir} +endef # uscan-download-source + + +override_dh_auto_clean: + dh_auto_clean + $(RM) -r ${GENERATED_FILES} + + +# Local variables: +# mode: makefile +# coding: utf-8 +# End: +# vim: filetype=make fileencoding=utf-8 : diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..7cdae03 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,20 @@ +# debian/tests/control +# Control file for Debian ‘autopkgtests’. +# Documentation: ‘/usr/share/doc/autopkgtest/README.package-tests.rst.gz’. + +Tests: smoke-python2 +Depends: + python-pkg-resources, + python-jsonext + +Tests: smoke-python3 +Depends: + python3-pkg-resources, + python3-jsonext + + +# Local variables: +# coding: utf-8 +# mode: conf +# End: +# vim: fileencoding=utf-8 filetype=conf : diff --git a/debian/tests/smoke-python2 b/debian/tests/smoke-python2 new file mode 100755 index 0000000..72493bc --- /dev/null +++ b/debian/tests/smoke-python2 @@ -0,0 +1,39 @@ +#! /bin/bash +# +# debian/tests/smoke-python2 +# Part of Debian ‘python-jsonext’ package. +# +# Copyright © 2016–2017 Ben Finney <bignose@debian.org> +# This is free software; you may copy, modify and/or distribute this work +# under the terms of the GNU General Public License, version 3 or later. +# No warranty expressed or implied. +# +# Smoke test for package in Python 2 environments. + +set -o errexit +set -o errtrace +set -o nounset + +DISTRIBUTION_NAME=jsonext +MODULE_NAMES=( + jsonext + ) + +test_opts="--distribution=$DISTRIBUTION_NAME" +for mod in ${MODULE_NAMES[@]} ; do + # Accumulate the module names. + test_opts="$test_opts --module=$mod" +done + +for py in $(pyversions -i) ; do + printf "Python command: %s\n" $py + $py debian/tests/smoke_test.py $test_opts + printf "\n" +done + + +# Local variables: +# coding: utf-8 +# mode: shell-script +# End: +# vim: fileencoding=utf-8 filetype=sh : diff --git a/debian/tests/smoke-python3 b/debian/tests/smoke-python3 new file mode 100755 index 0000000..28929cc --- /dev/null +++ b/debian/tests/smoke-python3 @@ -0,0 +1,39 @@ +#! /bin/bash +# +# debian/tests/smoke-python3 +# Part of Debian ‘python-jsonext’ package. +# +# Copyright © 2016–2017 Ben Finney <bignose@debian.org> +# This is free software; you may copy, modify and/or distribute this work +# under the terms of the GNU General Public License, version 3 or later. +# No warranty expressed or implied. +# +# Smoke test for package in Python 3 environments. + +set -o errexit +set -o errtrace +set -o nounset + +DISTRIBUTION_NAME=jsonext +MODULE_NAMES=( + jsonext + ) + +test_opts="--distribution=$DISTRIBUTION_NAME" +for mod in ${MODULE_NAMES[@]} ; do + # Accumulate the module names. + test_opts="$test_opts --module=$mod" +done + +for py in $(py3versions -i) ; do + printf "Python command: %s\n" $py + $py debian/tests/smoke_test.py $test_opts + printf "\n" +done + + +# Local variables: +# coding: utf-8 +# mode: shell-script +# End: +# vim: fileencoding=utf-8 filetype=sh : diff --git a/debian/tests/smoke_test.py b/debian/tests/smoke_test.py new file mode 100644 index 0000000..a3e1e82 --- /dev/null +++ b/debian/tests/smoke_test.py @@ -0,0 +1,129 @@ +# -*- coding: utf-8 -*- +# +# debian/tests/smoke_test.py +# +# Copyright © 2016–2017 Ben Finney <bignose@debian.org> +# This is free software; you may copy, modify and/or distribute this work +# under the terms of the GNU General Public License, version 3 or later. +# No warranty expressed or implied. + +""" Post-install Python smoke test for use in Debian autopkgtest. + + Written for both Python 2 and Python 3, to test all installed + versions of a package. + + Smoke test the distribution:: + --distribution=DISTRIBUTION + + Smoke test one or more modules:: + --module=MODULE_FOO --module=MODULE_BAR --module=MODULE_BAZ + """ + +import sys +import argparse +import importlib +import pkg_resources + + +def emit_implementation(): + """ Emit the details of the current Python implementation. + + :return: ``None``. + """ + sys.stdout.write( + "Interpreter: {command}\n{version}\n".format( + command=sys.executable, version=sys.version)) + + +def emit_distribution(name): + """ Get the distribution `name` and emit its representation. + + :param name: Name of the distribution to retrieve. + :return: ``None``. + """ + distribution = pkg_resources.get_distribution(name) + sys.stdout.write( + "Distribution ‘{name}’:\n\t{distribution!r}\n".format( + name=name, distribution=distribution)) + + +def emit_module(name): + """ Import the module `name` and emit the module representation. + + :param name: Full name of the module to import. + :return: ``None``. + """ + module = importlib.import_module(name) + sys.stdout.write( + "Package ‘{name}’:\n\t{module!r}\n".format( + name=name, module=module)) + + +def suite(args): + """ Run the full suite of tests. + + :param args: Namespace of arguments parsed from `ArgumentParser`. + :return: ``None``. + """ + emit_implementation() + + if args.distribution_name: + emit_distribution(args.distribution_name) + + for module_name in args.module_names: + emit_module(module_name) + + +class SmokeTestArgumentParser(argparse.ArgumentParser): + """ Command-line argument parser for this program. """ + + def __init__(self, *args, **kwargs): + super(SmokeTestArgumentParser, self).__init__(*args, **kwargs) + + self.add_argument( + '--distribution', + dest='distribution_name', type=str, + metavar="DISTRIBUTION", help=( + "Test the Python distribution named DISTRIBUTION.")) + self.add_argument( + '--module', + dest='module_names', type=str, nargs='+', + metavar="MODULE", help=( + "Test the Python module named MODULE.")) + + +def main(argv=None): + """ Mainline code for this module. + + :param argv: Sequence of all command line arguments. + (Default: `sys.argv`) + :return: The exit status (integer) for exit from the process. + """ + exit_status = 0 + + if argv is None: + argv = sys.argv + + try: + program_name = argv[0] + parser = SmokeTestArgumentParser(prog=program_name) + args = parser.parse_args(argv[1:]) + + suite(args) + + except SystemExit as exc: + exit_status = exc.code + + return exit_status + + +if __name__ == "__main__": + exit_status = main(sys.argv) + sys.exit(exit_status) + + +# Local variables: +# coding: utf-8 +# mode: python +# End: +# vim: fileencoding=utf-8 filetype=python : diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..7ee3ac8 --- /dev/null +++ b/debian/watch @@ -0,0 +1,19 @@ +# debian/watch +# Debian UScan configuration for ‘python-jsonext’ package. +# Manual page: ‘uscan(1)’. + +# Version of UScan configuration format. +version = 4 + +# Source tarball from Python Package Index. +opts = "uversionmangle=s/(\d)((?:a|b|c|rc)\d*)$/$1~$2/" \ + http://pypi.debian.net/jsonext/ \ + /jsonext/jsonext-@ANY_VERSION@@ARCHIVE_EXT@ \ + debian uupdate + + +# Local variables: +# coding: utf-8 +# mode: conf +# End: +# vim: fileencoding=utf-8 filetype=conf : |
