diff -Nru python-kaptan-0.5.10/debian/changelog python-kaptan-0.5.12/debian/changelog --- python-kaptan-0.5.10/debian/changelog 2019-12-19 16:07:54.000000000 +0000 +++ python-kaptan-0.5.12/debian/changelog 2021-12-27 08:10:51.000000000 +0000 @@ -1,3 +1,33 @@ +python-kaptan (0.5.12-1) unstable; urgency=medium + + * QA upload. + + [ Debian Janitor ] + * Trim trailing whitespace. + * Set debhelper-compat version in Build-Depends. + * Set upstream metadata fields: Bug-Database, Bug-Submit, Repository, + Repository-Browse. + + [ Håvard Flaget Aasen ] + * New upstream release. + Release is compatible with Python3.10. Closes: #1002196 + * Run wrap-and-sort -at + * Add python3-pytest as build-dep. + * Bump debhelper to 13. + * Update Standards-Version to 4.6.0. + * d/watch: Bump to version 4. + * d/copyright: + - Update years. + - Fix upstream-name and source, both mentioned the wrong package. + - Add upstream-contact. + * d/rules: Remove unnecessary comments and python2 specific settings. + * .egg-info files should not be executable. + * Document Rules-Requires-Root. + * Ignore .egg-info files, build twice in a row. + * Add upstream testsuite as autopkgtest. + + -- Håvard Flaget Aasen Mon, 27 Dec 2021 09:10:51 +0100 + python-kaptan (0.5.10-3) unstable; urgency=medium * Remove python2 package diff -Nru python-kaptan-0.5.10/debian/compat python-kaptan-0.5.12/debian/compat --- python-kaptan-0.5.10/debian/compat 2019-12-19 16:07:54.000000000 +0000 +++ python-kaptan-0.5.12/debian/compat 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -9 diff -Nru python-kaptan-0.5.10/debian/control python-kaptan-0.5.12/debian/control --- python-kaptan-0.5.10/debian/control 2019-12-19 16:07:54.000000000 +0000 +++ python-kaptan-0.5.12/debian/control 2021-12-27 08:10:51.000000000 +0000 @@ -2,15 +2,22 @@ Maintainer: Debian QA Group Section: python Priority: optional -Build-Depends: dh-python, python3-setuptools, python3-all, python3-yaml, debhelper (>= 9) -Standards-Version: 4.1.3 +Build-Depends: debhelper-compat (= 13), + dh-python, + python3-all, + python3-pytest, + python3-setuptools, + python3-yaml, +Standards-Version: 4.6.0 +Rules-Requires-Root: no Homepage: https://github.com/emre/kaptan Vcs-Git: https://salsa.debian.org/debian/python-kaptan.git Vcs-Browser: https://salsa.debian.org/debian/python-kaptan Package: python3-kaptan Architecture: all -Depends: ${misc:Depends}, ${python3:Depends} +Depends: ${misc:Depends}, + ${python3:Depends}, Description: Python 3 configuration manager in various formats Configuration manager that allows users to transparently access configuration data stored in various formats (INI, JSON, YAML, dict, diff -Nru python-kaptan-0.5.10/debian/copyright python-kaptan-0.5.12/debian/copyright --- python-kaptan-0.5.10/debian/copyright 2019-12-19 16:07:54.000000000 +0000 +++ python-kaptan-0.5.12/debian/copyright 2021-12-27 08:10:51.000000000 +0000 @@ -1,9 +1,10 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: kaplan -Source: https://pypi.python.org/pypi/kaplan +Upstream-Name: kaptan +Upstream-Contact: Emre Yilmaz +Source: https://pypi.python.org/project/kaptan Files: * -Copyright: 2013-2017 Emre Yılmaz, Tony Narlock, Berker Peksag +Copyright: 2013-2019 Emre Yılmaz, Tony Narlock, Berker Peksag License: BSD-3-clause Files: debian/* diff -Nru python-kaptan-0.5.10/debian/rules python-kaptan-0.5.12/debian/rules --- python-kaptan-0.5.10/debian/rules 2019-12-19 16:07:54.000000000 +0000 +++ python-kaptan-0.5.12/debian/rules 2021-12-27 08:10:51.000000000 +0000 @@ -1,9 +1,9 @@ #!/usr/bin/make -f -# This file was automatically generated by stdeb 0.8.5 at -# Sun, 01 Jan 2017 16:03:12 +0300 export PYBUILD_NAME=kaptan -export PYBUILD_AFTER_INSTALL_python2=rm -rf '{destdir}/usr/bin' + %: dh $@ --with python3 --buildsystem=pybuild +execute_before_dh_auto_build: + chmod -x $(CURDIR)/kaptan.egg-info/* diff -Nru python-kaptan-0.5.10/debian/source/options python-kaptan-0.5.12/debian/source/options --- python-kaptan-0.5.10/debian/source/options 1970-01-01 00:00:00.000000000 +0000 +++ python-kaptan-0.5.12/debian/source/options 2021-12-27 08:10:51.000000000 +0000 @@ -0,0 +1 @@ +extend-diff-ignore = "^[^/]*[.]egg-info/" diff -Nru python-kaptan-0.5.10/debian/tests/control python-kaptan-0.5.12/debian/tests/control --- python-kaptan-0.5.10/debian/tests/control 1970-01-01 00:00:00.000000000 +0000 +++ python-kaptan-0.5.12/debian/tests/control 2021-12-27 08:10:51.000000000 +0000 @@ -0,0 +1,4 @@ +Tests: upstream +Depends: python3-all, + python3-kaptan, + python3-pytest, diff -Nru python-kaptan-0.5.10/debian/tests/upstream python-kaptan-0.5.12/debian/tests/upstream --- python-kaptan-0.5.10/debian/tests/upstream 1970-01-01 00:00:00.000000000 +0000 +++ python-kaptan-0.5.12/debian/tests/upstream 2021-12-27 08:10:51.000000000 +0000 @@ -0,0 +1,11 @@ +#!/bin/sh + +set -efu + +cp -vr tests "${AUTOPKGTEST_TMP}" +cd "${AUTOPKGTEST_TMP}" + +for py in $(py3versions -s); do + echo "[*] testing $py:" + $py -m pytest +done diff -Nru python-kaptan-0.5.10/debian/upstream/metadata python-kaptan-0.5.12/debian/upstream/metadata --- python-kaptan-0.5.10/debian/upstream/metadata 1970-01-01 00:00:00.000000000 +0000 +++ python-kaptan-0.5.12/debian/upstream/metadata 2021-12-27 08:10:51.000000000 +0000 @@ -0,0 +1,5 @@ +--- +Bug-Database: https://github.com/emre/kaptan/issues +Bug-Submit: https://github.com/emre/kaptan/issues/new +Repository: https://github.com/emre/kaptan.git +Repository-Browse: https://github.com/emre/kaptan diff -Nru python-kaptan-0.5.10/debian/watch python-kaptan-0.5.12/debian/watch --- python-kaptan-0.5.10/debian/watch 2019-12-19 16:07:54.000000000 +0000 +++ python-kaptan-0.5.12/debian/watch 2021-12-27 08:10:51.000000000 +0000 @@ -1,3 +1,3 @@ -version=3 +version=4 opts=uversionmangle=s/(rc|a|b|c)/~$1/ \ -https://pypi.debian.net/kaptan/kaptan-(.+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))) \ No newline at end of file +https://pypi.debian.net/kaptan/kaptan-(.+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))) diff -Nru python-kaptan-0.5.10/kaptan/__about__.py python-kaptan-0.5.12/kaptan/__about__.py --- python-kaptan-0.5.10/kaptan/__about__.py 2018-08-04 06:09:08.000000000 +0000 +++ python-kaptan-0.5.12/kaptan/__about__.py 2019-04-23 03:09:30.000000000 +0000 @@ -1,9 +1,9 @@ __title__ = 'kaptan' __package_name__ = 'kaptan' -__version__ = '0.5.10' +__version__ = '0.5.12' __description__ = 'Configuration manager' __email__ = 'mail@emreyilmaz.me' __url__ = 'https://github.com/emre/kaptan' __author__ = 'Emre Yilmaz' __license__ = 'BSD' -__copyright__ = 'Copyright 2013-2015 Emre Yilmaz' +__copyright__ = 'Copyright 2013-2019 Emre Yilmaz' diff -Nru python-kaptan-0.5.10/kaptan/_compat.py python-kaptan-0.5.12/kaptan/_compat.py --- python-kaptan-0.5.10/kaptan/_compat.py 1970-01-01 00:00:00.000000000 +0000 +++ python-kaptan-0.5.12/kaptan/_compat.py 2019-04-23 02:47:39.000000000 +0000 @@ -0,0 +1,11 @@ +# -*- coding: utf8 -*- +# flake8: NOQA: F40 +import sys + +PY2 = sys.version_info[0] == 2 + + +if PY2: + import collections as collections_abc +else: + import collections.abc as collections_abc diff -Nru python-kaptan-0.5.10/kaptan/__init__.py python-kaptan-0.5.12/kaptan/__init__.py --- python-kaptan-0.5.10/kaptan/__init__.py 2018-08-04 06:09:08.000000000 +0000 +++ python-kaptan-0.5.12/kaptan/__init__.py 2019-04-23 02:47:39.000000000 +0000 @@ -13,8 +13,8 @@ import argparse import os -from collections import Mapping, Sequence +from ._compat import collections_abc from .handlers.dict_handler import DictHandler from .handlers.pyfile_handler import PyFileHandler from .handlers.ini_handler import IniHandler @@ -95,9 +95,9 @@ current_data = self.configuration_data for chunk in key.split('.'): - if isinstance(current_data, Mapping): + if isinstance(current_data, collections_abc.Mapping): current_data = current_data[chunk] - elif isinstance(current_data, Sequence): + elif isinstance(current_data, collections_abc.Sequence): chunk = int(chunk) current_data = current_data[chunk] @@ -162,7 +162,6 @@ def main(): from sys import stdin - from collections import OrderedDict parser = get_parser() args, ukargs = parser.parse_known_args() @@ -181,7 +180,7 @@ s += [None] yield tuple(s) - config_handlers = OrderedDict(list(get_handlers())) + config_handlers = collections_abc.OrderedDict(list(get_handlers())) for config_file, handler in config_handlers.items(): is_stdin = config_file == '-' diff -Nru python-kaptan-0.5.10/kaptan.egg-info/PKG-INFO python-kaptan-0.5.12/kaptan.egg-info/PKG-INFO --- python-kaptan-0.5.10/kaptan.egg-info/PKG-INFO 2018-08-04 06:09:08.000000000 +0000 +++ python-kaptan-0.5.12/kaptan.egg-info/PKG-INFO 2019-04-23 03:10:29.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: kaptan -Version: 0.5.10 +Version: 0.5.12 Summary: Configuration manager Home-page: https://github.com/emre/kaptan Author: Emre Yilmaz diff -Nru python-kaptan-0.5.10/kaptan.egg-info/requires.txt python-kaptan-0.5.12/kaptan.egg-info/requires.txt --- python-kaptan-0.5.10/kaptan.egg-info/requires.txt 2018-08-04 06:09:08.000000000 +0000 +++ python-kaptan-0.5.12/kaptan.egg-info/requires.txt 2019-04-23 03:10:29.000000000 +0000 @@ -1 +1 @@ -PyYAML<4,>=3.13 +PyYAML<6,>=3.13 diff -Nru python-kaptan-0.5.10/kaptan.egg-info/SOURCES.txt python-kaptan-0.5.12/kaptan.egg-info/SOURCES.txt --- python-kaptan-0.5.10/kaptan.egg-info/SOURCES.txt 2018-08-04 06:09:08.000000000 +0000 +++ python-kaptan-0.5.12/kaptan.egg-info/SOURCES.txt 2019-04-23 03:10:29.000000000 +0000 @@ -6,6 +6,7 @@ kaptan/__about__.py kaptan/__init__.py kaptan/__main__.py +kaptan/_compat.py kaptan.egg-info/PKG-INFO kaptan.egg-info/SOURCES.txt kaptan.egg-info/dependency_links.txt @@ -21,4 +22,5 @@ requirements/base.txt requirements/dev.txt requirements/doc.txt -requirements/test.txt \ No newline at end of file +requirements/test.txt +tests/test_kaptan.py \ No newline at end of file diff -Nru python-kaptan-0.5.10/MANIFEST.in python-kaptan-0.5.12/MANIFEST.in --- python-kaptan-0.5.10/MANIFEST.in 2018-08-04 06:09:08.000000000 +0000 +++ python-kaptan-0.5.12/MANIFEST.in 2019-04-23 02:54:06.000000000 +0000 @@ -4,3 +4,4 @@ recursive-include kaptan * recursive-exclude kaptan *.pyc recursive-exclude kaptan *.pyo +recursive-include tests *.py diff -Nru python-kaptan-0.5.10/PKG-INFO python-kaptan-0.5.12/PKG-INFO --- python-kaptan-0.5.10/PKG-INFO 2018-08-04 06:09:08.000000000 +0000 +++ python-kaptan-0.5.12/PKG-INFO 2019-04-23 03:10:29.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: kaptan -Version: 0.5.10 +Version: 0.5.12 Summary: Configuration manager Home-page: https://github.com/emre/kaptan Author: Emre Yilmaz diff -Nru python-kaptan-0.5.10/requirements/base.txt python-kaptan-0.5.12/requirements/base.txt --- python-kaptan-0.5.10/requirements/base.txt 2018-08-04 06:09:08.000000000 +0000 +++ python-kaptan-0.5.12/requirements/base.txt 2019-04-23 03:09:29.000000000 +0000 @@ -1 +1 @@ -PyYAML>=3.13,<4 +PyYAML>=3.13,<6 diff -Nru python-kaptan-0.5.10/requirements/dev.txt python-kaptan-0.5.12/requirements/dev.txt --- python-kaptan-0.5.10/requirements/dev.txt 2018-08-04 06:09:08.000000000 +0000 +++ python-kaptan-0.5.12/requirements/dev.txt 2019-04-23 02:47:39.000000000 +0000 @@ -1,2 +1,2 @@ -isort==4.3.4 -flake8==3.5.0 +isort==4.3.15 +flake8==3.7.5 diff -Nru python-kaptan-0.5.10/requirements/doc.txt python-kaptan-0.5.12/requirements/doc.txt --- python-kaptan-0.5.10/requirements/doc.txt 2018-08-04 06:09:08.000000000 +0000 +++ python-kaptan-0.5.12/requirements/doc.txt 2019-04-23 02:57:35.000000000 +0000 @@ -1,3 +1,3 @@ -sphinx==1.7.5 -sphinx-rtd-theme==0.4.0 -sphinx-argparse==0.2.2 \ No newline at end of file +sphinx==2.0.1 +sphinx-rtd-theme==0.4.3 +sphinx-argparse==0.2.5 \ No newline at end of file diff -Nru python-kaptan-0.5.10/requirements/test.txt python-kaptan-0.5.12/requirements/test.txt --- python-kaptan-0.5.10/requirements/test.txt 2018-08-04 06:09:08.000000000 +0000 +++ python-kaptan-0.5.12/requirements/test.txt 2019-04-23 02:47:39.000000000 +0000 @@ -1 +1 @@ -pytest==3.6.3 +pytest==4.3.1 diff -Nru python-kaptan-0.5.10/tests/test_kaptan.py python-kaptan-0.5.12/tests/test_kaptan.py --- python-kaptan-0.5.10/tests/test_kaptan.py 1970-01-01 00:00:00.000000000 +0000 +++ python-kaptan-0.5.12/tests/test_kaptan.py 2019-04-23 02:47:39.000000000 +0000 @@ -0,0 +1,293 @@ +# -*- coding: utf8 -*- +""" +kaptan +~~~~~~ + +:copyright: (c) 2013 by the authors and contributors (See AUTHORS file). +:license: BSD, see LICENSE for more details. +""" + +from __future__ import print_function, unicode_literals + +import json +import os +import os.path +import sys +import tempfile + +import pytest + +import kaptan + +try: + import yaml +except ImportError: + yaml = None + + +# python 2/3 compat +try: + unicode = unicode +except NameError: + # py changes unicode => str + unicode = str + +PY2 = sys.version_info[0] == 2 + + +sentinel = object() + + +@pytest.fixture +def testconfig(): + return { + 'debug': False, + } + + +def test_configuration_data(testconfig): + config = kaptan.Kaptan() + config.import_config(testconfig) + + assert 'debug' in config.configuration_data + + +def test_main_get(): + config = kaptan.Kaptan() + config.import_config({ + 'show_comments': True, + 'entry_count': 10, + }) + + assert config.get("entry_count", 25) == 10 + assert config.get("entry_count") == 10 + assert config.get("show_comments", None) + assert config.get("show_comments", False) + + +def test_nested_configuration(): + config = kaptan.Kaptan() + config.import_config({ + 'pagination': { + 'per_page': 20, + 'limit': 5, + } + }) + + assert config.get("pagination.limit") == 5 + + +def test_lists_on_configuration(): + config = kaptan.Kaptan() + config.import_config({ + 'servers': ['redis1', 'redis2', 'redis3'], + }) + + assert config.get('servers.0') == 'redis1' + + +def test_upsert(testconfig): + config = kaptan.Kaptan() + config.import_config(testconfig) + + assert not config.get('debug') + + config.upsert('debug', True) + assert config.get('debug') + + +def test_default_dict_handler(testconfig): + config = kaptan.Kaptan() + config.import_config(testconfig) + + assert not config.configuration_data['debug'] + + +def test_json_handler(testconfig): + config = kaptan.Kaptan(handler='json') + config.import_config(json.dumps(testconfig)) + + assert not config.get('debug') + + +def test_json_file_handler(tmpdir): + json_file = tmpdir.join('config.json') + json_file.write("""{"development": { +"DATABASE_URI": "mysql://root:123456@localhost/posts" +}, +"production": { +"DATABASE_URI": "mysql://poor_user:poor_password@localhost/poor_posts" +} +} +""") + config = kaptan.Kaptan(handler='json') + config.import_config(str(json_file)) + assert config.get( + 'production.DATABASE_URI' + ) == 'mysql://poor_user:poor_password@localhost/poor_posts' + + +@pytest.mark.skipif(yaml is None or not PY2, reason='needs yaml') +def test_yaml_safedump(testconfig): + testdict = { + unicode("development"): { + "DATABASE_URI": "mysql://root:123456@localhost/posts" + }, + "production": { + "DATABASE_URI": "mysql://poor_user:poor_password@localhost/poor_posts" # NOQA + } + } + + config = kaptan.Kaptan() + config.import_config(testdict) + + yamlconfig = kaptan.Kaptan() + yamlconfig.import_config(config.get()) + + assert '!!python/unicode' not in yamlconfig.export('yaml') + assert '!!python/unicode' not in yamlconfig.export('yaml', safe=True) + assert '!!python/unicode' in yamlconfig.export('yaml', safe=False) + + +@pytest.mark.skipif(yaml is None, reason='needs yaml') +def test_yaml_handler(testconfig): + config = kaptan.Kaptan(handler='yaml') + config.import_config(yaml.safe_dump(testconfig)) + assert not config.get("debug") + + +@pytest.mark.skipif(yaml is None, reason='needs yaml') +def test_yaml_file_handler(tmpdir, testconfig): + yaml_file = tmpdir.join('config.yaml') + + yaml_file.write(""" +development: + DATABASE_URI: mysql://root:123456@localhost/posts + +production: + DATABASE_URI: mysql://poor_user:poor_password@localhost/poor_posts +""") + config = kaptan.Kaptan(handler='yaml') + config.import_config(str(yaml_file)) + assert config.get('production.DATABASE_URI') == \ + 'mysql://poor_user:poor_password@localhost/poor_posts' + + +@pytest.mark.skipif(yaml is None, reason='needs yaml') +def test_yml_file_handler(tmpdir): + yml_file = tmpdir.join('config.yml') + yml_file.write(""" +development: + DATABASE_URI: mysql://root:123456@localhost/posts + +production: + DATABASE_URI: mysql://poor_user:poor_password@localhost/poor_posts +""") + config = kaptan.Kaptan() + config.import_config(str(yml_file)) + assert config.get('production.DATABASE_URI') == \ + 'mysql://poor_user:poor_password@localhost/poor_posts' + + +def test_ini_handler(testconfig): + value = """[development] +DATABASE_URI = mysql://root:123456@localhost/posts + +[production] +DATABASE_URI = mysql://poor_user:poor_password@localhost/poor_posts +""" + + config = kaptan.Kaptan(handler='ini') + config.import_config(value) + + assert config.get( + 'production.database_uri' + ) == 'mysql://poor_user:poor_password@localhost/poor_posts' + + +def test_ini_file_handler(tmpdir, testconfig): + ini_file = tmpdir.join('config.ini') + ini_file.write("""[development] +DATABASE_URI = mysql://root:123456@localhost/posts + +[production] +DATABASE_URI = mysql://poor_user:poor_password@localhost/poor_posts +""") + config = kaptan.Kaptan(handler='ini') + config.import_config(str(ini_file)) + assert config.get( + 'production.database_uri' + ) == 'mysql://poor_user:poor_password@localhost/poor_posts' + + +def test_py_file_handler(testconfig, tmpdir, monkeypatch): + py_file = tmpdir.join('config.py') + py_file.write("""DATABASE = 'mysql://root:123456@localhost/girlz' +DEBUG = False +PAGINATION = { +'per_page': 10, +'limit': 20, +} +""") + monkeypatch.syspath_prepend(str(tmpdir)) + normalize_name = str(py_file).rpartition('.')[0] + config = kaptan.Kaptan(handler='file') + config.import_config(normalize_name) + assert config.get("PAGINATION.limit") == 20 + + +def test_py_file_away_handler(tmpdir, testconfig): + py_file = tmpdir.join('config2.py') + py_file.write("""DATABASE = 'mysql://root:123456@localhost/girlz' +DEBUG = False +PAGINATION = { +'per_page': 10, +'limit': 20, +} +""") + config = kaptan.Kaptan() + config.import_config(str(py_file)) + assert config.get("PAGINATION.limit") == 20 + + +def test_py_file_away_noexist_raises(tmpdir, testconfig): + py_file = tmpdir.join('config3.py') + + config = kaptan.Kaptan() + with pytest.raises(IOError): + config.import_config(str(py_file)) + + +def test_invalid_key(testconfig): + config = kaptan.Kaptan() + config.import_config(testconfig) + + with pytest.raises(KeyError): + config.get('invalidkey') + with pytest.raises(KeyError): + config.get('invaliddict.invalidkey') + + +def test_invalid_key_with_default(testconfig): + config = kaptan.Kaptan() + config.import_config(testconfig) + + assert config.get('invalid_key', 'default_value') == 'default_value' + assert config.get('invalid_key.bar.baz', + 'default_value') == 'default_value' + + +def test_default_value_none(testconfig): + config = kaptan.Kaptan() + config.import_config(testconfig) + + assert config.get("invalid_key", None) is None + assert config.get("invalid_key.bar.baz", None) is None + + +def test_get_all_config(testconfig): + config = kaptan.Kaptan() + config.import_config(testconfig) + + assert isinstance(config.get(), dict) + assert isinstance(config.get(''), dict)