Merge lp:~ricardokirkner/configglue/from-future-remove-configparser into lp:configglue

Proposed by Ricardo Kirkner
Status: Merged
Approved by: Ricardo Kirkner
Approved revision: 116
Merged at revision: 108
Proposed branch: lp:~ricardokirkner/configglue/from-future-remove-configparser
Merge into: lp:configglue
Diff against target: 1232 lines (+349/-295)
47 files modified
LICENSE (+1/-1)
LICENSE.PSF (+22/-0)
configglue/__init__.py (+1/-1)
configglue/_compat.py (+129/-7)
configglue/app/__init__.py (+1/-1)
configglue/app/base.py (+1/-1)
configglue/app/plugin.py (+1/-1)
configglue/contrib/__init__.py (+1/-1)
configglue/contrib/schema/__init__.py (+1/-1)
configglue/contrib/schema/devserver.py (+15/-0)
configglue/contrib/schema/django_jenkins.py (+15/-0)
configglue/contrib/schema/django_openid_auth.py (+15/-0)
configglue/contrib/schema/nexus.py (+15/-0)
configglue/contrib/schema/preflight.py (+15/-0)
configglue/contrib/schema/pystatsd.py (+15/-0)
configglue/contrib/schema/raven.py (+15/-0)
configglue/contrib/schema/saml2idp.py (+15/-0)
configglue/glue.py (+2/-5)
configglue/inischema/__init__.py (+1/-1)
configglue/inischema/attributed.py (+3/-2)
configglue/inischema/glue.py (+1/-1)
configglue/inischema/parsers.py (+1/-1)
configglue/inischema/typed.py (+1/-1)
configglue/parser.py (+6/-9)
configglue/schema.py (+4/-6)
configglue/tests/__init__.py (+1/-1)
configglue/tests/app/test_base.py (+1/-1)
configglue/tests/app/test_plugin.py (+1/-1)
configglue/tests/inischema/__init__.py (+1/-1)
configglue/tests/inischema/test_attributed.py (+2/-2)
configglue/tests/inischema/test_glue.py (+1/-1)
configglue/tests/inischema/test_glue2glue.py (+1/-1)
configglue/tests/inischema/test_parsers.py (+1/-1)
configglue/tests/inischema/test_typed.py (+2/-2)
configglue/tests/test_contrib_schema.py (+15/-0)
configglue/tests/test_parser.py (+21/-20)
configglue/tests/test_schema.py (+2/-5)
configglue/tests/test_schemaconfig.py (+3/-5)
debian/changelog (+0/-122)
debian/compat (+0/-1)
debian/control (+0/-24)
debian/copyright (+0/-43)
debian/pycompat (+0/-1)
debian/rules (+0/-8)
debian/watch (+0/-2)
setup.py (+0/-3)
tox.ini (+0/-10)
To merge this branch: bzr merge lp:~ricardokirkner/configglue/from-future-remove-configparser
Reviewer Review Type Date Requested Status
dobey Approve
Barry Warsaw (community) Approve
Review via email: mp+173806@code.launchpad.net

Commit message

use compat module to define base for SchemaConfigParser that abstracts differences from Python 2.x and 3.x configparser modules

- compat module is PSF licensed.
- also removed debian folder to leave packaging up to distros

To post a comment you must log in.
Revision history for this message
dobey (dobey) wrote :

34 + # taken from Python 3.3's configparser module

The code this is referencing should probably be put in a separate file, and have its licensing/copyright legally clarified, as configglue is BSD, and not the Python license. I'm not sure if this is conflict legally either, as including Python licensed code inside a BSD licensed project may be problematic. Anyway, it needs clarification. The debian/copyright will also need updated.

review: Needs Fixing
Revision history for this message
Barry Warsaw (barry) wrote :

You need to remove the configparser dependencies in the tox.ini file.

Revision history for this message
Barry Warsaw (barry) wrote :
Download full text (4.8 KiB)

=== modified file 'configglue/_compat.py'
--- configglue/_compat.py 2013-05-27 00:56:38 +0000
+++ configglue/_compat.py 2013-07-09 20:10:35 +0000
> @@ -4,12 +4,109 @@
> PY2 = sys.version_info[0] == 2
>
> if not PY2:

I generally like to do positive conditionals, since negative conditionals are
more difficult to reason about. E.g. as currently written it takes longer to
realize that the if-stanza is for Python 3 and the else stanza is for Python
2.

=== modified file 'configglue/glue.py'
--- configglue/glue.py 2013-05-25 15:21:04 +0000
+++ configglue/glue.py 2013-07-09 20:10:35 +0000
> @@ -16,13 +16,10 @@
>
> import os
> import sys
> -from configparser import (
> - NoOptionError,
> - NoSectionError,
> -)

You could probably change this to:

from ._compat.configparser import (
    NoOptionError,
    NoSectionError,
    )

and then none of the except clauses would need to change.

> from optparse import OptionParser
> from collections import namedtuple
>
> +from ._compat import configparser
> from .parser import SchemaConfigParser
>
>
> @@ -68,7 +65,7 @@
> kwargs['help'] = option.help
> try:
> kwargs['default'] = parser.get(section.name, option.name)
> - except (NoSectionError, NoOptionError):
> + except (configparser.NoSectionError, configparser.NoOptionError):
> pass
> kwargs['action'] = option.action
> args = ['--' + long_name(option)]
> @@ -92,7 +89,7 @@
> op_value = getattr(options, opt_name(option))
> try:
> parser_value = parser.get(section.name, option.name)
> - except (NoSectionError, NoOptionError):
> + except (configparser.NoSectionError, configparser.NoOptionError):
> parser_value = None
> env_value = os.environ.get("CONFIGGLUE_{0}".format(
> long_name(option).upper()))

=== modified file 'configglue/parser.py'
--- configglue/parser.py 2013-07-08 20:10:06 +0000
+++ configglue/parser.py 2013-07-09 20:10:35 +0000
> @@ -21,16 +21,9 @@
> import os
> import re
>
> -from configparser import (
> - DEFAULTSECT,
> - SafeConfigParser as BaseConfigParser,
> - InterpolationMissingOptionError,
> - NoOptionError,
> - NoSectionError,
> -)

Similarly, this could probably be

from ._compat.configparser import (
    ...
    )

and less of the following code would need to change.

=== modified file 'configglue/schema.py'
--- configglue/schema.py 2013-05-26 19:07:46 +0000
+++ configglue/schema.py 2013-07-09 20:10:35 +0000
> @@ -16,14 +16,11 @@
> from __future__ import unicode_literals
>
> import json
> -from configparser import (
> - NoSectionError,
> - NoOptionError,
> -)

Similarly, here.

> from copy import deepcopy
> from inspect import getmembers
>
> -from configglue._compat import text_type, string_types
> +from ._compat import configparser, text_type, string_types
> +
>
>
> __all__ = [
> @@ -177,7 +174,7 @@
> """Return a Section by name"""
> section = self._sections.get(name)
> if section is None:
> - raise NoSectionError(name...

Read more...

Revision history for this message
Barry Warsaw (barry) :
review: Needs Fixing
109. By Ricardo Kirkner

remove configparser from dependencies

110. By Ricardo Kirkner

moved BasicInterpolation class to it's own module due to different licensing

111. By Ricardo Kirkner

updated copyright info

112. By Ricardo Kirkner

added encoding modeline

113. By Ricardo Kirkner

unified _compat and _compat_parser again

removed need to namespace configparser/ConfigParser imports

114. By Ricardo Kirkner

removed debian folder

leave that to real packagers

115. By Ricardo Kirkner

updated copyright dates

116. By Ricardo Kirkner

updated license for _compat.py module

Revision history for this message
Barry Warsaw (barry) wrote :

Thanks for the fixes. I can work with this.

review: Approve
Revision history for this message
dobey (dobey) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'LICENSE'
--- LICENSE 2010-07-31 00:58:37 +0000
+++ LICENSE 2013-07-11 19:08:28 +0000
@@ -1,4 +1,4 @@
1Copyright 2009, 2010 Canonical Ltd. All rights reserved.1Copyright 2009--2013 Canonical Ltd. All rights reserved.
22
3Redistribution and use in source and binary forms, with or without3Redistribution and use in source and binary forms, with or without
4modification, are permitted provided that the following conditions are4modification, are permitted provided that the following conditions are
55
=== added file 'LICENSE.PSF'
--- LICENSE.PSF 1970-01-01 00:00:00 +0000
+++ LICENSE.PSF 2013-07-11 19:08:28 +0000
@@ -0,0 +1,22 @@
1PSF LICENSE AGREEMENT FOR PYTHON 2.7.5
2
3This LICENSE AGREEMENT is between the Python Software Foundation (“PSF”), and the Individual or Organization (“Licensee”) accessing and otherwise using Python 2.7.5 software in source or binary form and its associated documentation.
4Subject to the terms and conditions of this License Agreement, PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python 2.7.5 alone or in any derivative version, provided, however, that PSF’s License Agreement and PSF’s notice of copyright, i.e., “Copyright © 2001-2013 Python Software Foundation; All Rights Reserved” are retained in Python 2.7.5 alone or in any derivative version prepared by Licensee.
5In the event Licensee prepares a derivative work that is based on or incorporates Python 2.7.5 or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of the changes made to Python 2.7.5.
6PSF is making Python 2.7.5 available to Licensee on an “AS IS” basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 2.7.5 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
7PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON 2.7.5 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 2.7.5, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
8This License Agreement will automatically terminate upon a material breach of its terms and conditions.
9Nothing in this License Agreement shall be deemed to create any relationship of agency, partnership, or joint venture between PSF and Licensee. This License Agreement does not grant permission to use PSF trademarks or trade name in a trademark sense to endorse or promote products or services of Licensee, or any third party.
10By copying, installing or otherwise using Python 2.7.5, Licensee agrees to be bound by the terms and conditions of this License Agreement.
11
12
13PSF LICENSE AGREEMENT FOR PYTHON 3.3.2
14
15This LICENSE AGREEMENT is between the Python Software Foundation (“PSF”), and the Individual or Organization (“Licensee”) accessing and otherwise using Python 3.3.2 software in source or binary form and its associated documentation.
16Subject to the terms and conditions of this License Agreement, PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python 3.3.2 alone or in any derivative version, provided, however, that PSF’s License Agreement and PSF’s notice of copyright, i.e., “Copyright © 2001-2013 Python Software Foundation; All Rights Reserved” are retained in Python 3.3.2 alone or in any derivative version prepared by Licensee.
17In the event Licensee prepares a derivative work that is based on or incorporates Python 3.3.2 or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of the changes made to Python 3.3.2.
18PSF is making Python 3.3.2 available to Licensee on an “AS IS” basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 3.3.2 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
19PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON 3.3.2 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 3.3.2, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
20This License Agreement will automatically terminate upon a material breach of its terms and conditions.
21Nothing in this License Agreement shall be deemed to create any relationship of agency, partnership, or joint venture between PSF and Licensee. This License Agreement does not grant permission to use PSF trademarks or trade name in a trademark sense to endorse or promote products or services of Licensee, or any third party.
22By copying, installing or otherwise using Python 3.3.2, Licensee agrees to be bound by the terms and conditions of this License Agreement.
023
=== modified file 'configglue/__init__.py'
--- configglue/__init__.py 2013-07-08 20:57:17 +0000
+++ configglue/__init__.py 2013-07-11 19:08:28 +0000
@@ -4,7 +4,7 @@
4#4#
5# A library for simple, DRY configuration of applications5# A library for simple, DRY configuration of applications
6#6#
7# (C) 2009--2011 by Canonical Ltd.7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#10#
1111
=== modified file 'configglue/_compat.py'
--- configglue/_compat.py 2013-05-27 00:56:38 +0000
+++ configglue/_compat.py 2013-07-11 19:08:28 +0000
@@ -1,15 +1,137 @@
1# -*- coding: utf-8 -*-
2###############################################################################
3#
4# configglue -- glue for your apps' configuration
5#
6# A library for simple, DRY configuration of applications
7#
8# (C) 2013 by Canonical Ltd.
9# by John R. Lenton <john.lenton@canonical.com>
10# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
11# (C) Python Software Foundation (“PSF”)
12#
13# Released under the PSF License Agreement (see the file LICENSE.PSF)
14#
15# For bug reports, support, and new releases: http://launchpad.net/configglue
16#
17###############################################################################
18import re
1import sys19import sys
220
321
4PY2 = sys.version_info[0] == 222PY2 = sys.version_info[0] == 2
523
6if not PY2:24if PY2:
25 import __builtin__ as builtins
26 import ConfigParser as configparser
27 from ConfigParser import (
28 DEFAULTSECT,
29 InterpolationDepthError,
30 InterpolationMissingOptionError,
31 InterpolationSyntaxError,
32 NoOptionError,
33 NoSectionError,
34 RawConfigParser,
35 )
36
37 class BasicInterpolation(object):
38 """Interpolation as implemented in the classic ConfigParser.
39
40 The option values can contain format strings which refer to other
41 values in the same section, or values in the special default section.
42
43 For example:
44
45 something: %(dir)s/whatever
46
47 would resolve the "%(dir)s" to the value of dir. All reference
48 expansions are done late, on demand. If a user needs to use a
49 bare % in a configuration file, she can escape it by writing %%.
50 Other % usage is considered a user error and
51 raises `InterpolationSyntaxError'."""
52
53 _KEYCRE = re.compile(r"%\(([^)]+)\)s")
54
55 def before_get(self, parser, section, option, value, defaults):
56 L = []
57 self._interpolate_some(parser, option, L, value, section,
58 defaults, 1)
59 return ''.join(L)
60
61 def before_set(self, parser, section, option, value):
62 tmp_value = value.replace('%%', '') # escaped percent signs
63 tmp_value = self._KEYCRE.sub('', tmp_value) # valid syntax
64 if '%' in tmp_value:
65 raise ValueError("invalid interpolation syntax in %r at "
66 "position %d" % (value, tmp_value.find('%')))
67 return value
68
69 def _interpolate_some(self, parser, option, accum, rest, section, map,
70 depth):
71 if depth > configparser.MAX_INTERPOLATION_DEPTH:
72 raise configparser.InterpolationDepthError(option, section,
73 rest)
74 while rest:
75 p = rest.find("%")
76 if p < 0:
77 accum.append(rest)
78 return
79 if p > 0:
80 accum.append(rest[:p])
81 rest = rest[p:]
82 # p is no longer used
83 c = rest[1:2]
84 if c == "%":
85 accum.append("%")
86 rest = rest[2:]
87 elif c == "(":
88 m = self._KEYCRE.match(rest)
89 if m is None:
90 raise configparser.InterpolationSyntaxError(option,
91 section,
92 "bad interpolation variable reference %r" % rest)
93 var = parser.optionxform(m.group(1))
94 rest = rest[m.end():]
95 try:
96 v = map[var]
97 except KeyError:
98 raise configparser.InterpolationMissingOptionError(
99 option, section, rest, var)
100 if "%" in v:
101 self._interpolate_some(parser, option, accum, v,
102 section, map, depth + 1)
103 else:
104 accum.append(v)
105 else:
106 raise configparser.InterpolationSyntaxError(
107 option, section,
108 "'%%' must be followed by '%%' or '(', "
109 "found: %r" % (rest,))
110
111 class BaseConfigParser(configparser.SafeConfigParser):
112 def __init__(self, *args, **kwargs):
113 configparser.SafeConfigParser.__init__(self, *args, **kwargs)
114
115 self._interpolation = BasicInterpolation()
116
117 text_type = unicode
118 string_types = (str, unicode)
119 iteritems = lambda d: d.iteritems()
120
121else:
122 import builtins
123 import configparser
124 from configparser import (
125 DEFAULTSECT,
126 InterpolationDepthError,
127 InterpolationMissingOptionError,
128 InterpolationSyntaxError,
129 NoOptionError,
130 NoSectionError,
131 RawConfigParser,
132 )
133
134 BaseConfigParser = configparser.SafeConfigParser
7 text_type = str135 text_type = str
8 string_types = (str,)136 string_types = (str,)
9 import builtins
10 iteritems = lambda d: iter(d.items())137 iteritems = lambda d: iter(d.items())
11else:
12 text_type = unicode
13 string_types = (str, unicode)
14 import __builtin__ as builtins
15 iteritems = lambda d: d.iteritems()
16138
=== modified file 'configglue/app/__init__.py'
--- configglue/app/__init__.py 2011-07-17 22:32:16 +0000
+++ configglue/app/__init__.py 2013-07-11 19:08:28 +0000
@@ -4,7 +4,7 @@
4#4#
5# A library for simple, DRY configuration of applications5# A library for simple, DRY configuration of applications
6#6#
7# (C) 2009--2011 by Canonical Ltd.7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#10#
1111
=== modified file 'configglue/app/base.py'
--- configglue/app/base.py 2011-07-23 20:26:54 +0000
+++ configglue/app/base.py 2013-07-11 19:08:28 +0000
@@ -4,7 +4,7 @@
4#4#
5# A library for simple, DRY configuration of applications5# A library for simple, DRY configuration of applications
6#6#
7# (C) 2009--2011 by Canonical Ltd.7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#10#
1111
=== modified file 'configglue/app/plugin.py'
--- configglue/app/plugin.py 2011-07-17 22:32:16 +0000
+++ configglue/app/plugin.py 2013-07-11 19:08:28 +0000
@@ -4,7 +4,7 @@
4#4#
5# A library for simple, DRY configuration of applications5# A library for simple, DRY configuration of applications
6#6#
7# (C) 2009--2011 by Canonical Ltd.7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#10#
1111
=== modified file 'configglue/contrib/__init__.py'
--- configglue/contrib/__init__.py 2012-04-24 15:58:44 +0000
+++ configglue/contrib/__init__.py 2013-07-11 19:08:28 +0000
@@ -4,7 +4,7 @@
4#4#
5# A library for simple, DRY configuration of applications5# A library for simple, DRY configuration of applications
6#6#
7# (C) 2009--2012 by Canonical Ltd.7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#10#
1111
=== modified file 'configglue/contrib/schema/__init__.py'
--- configglue/contrib/schema/__init__.py 2012-05-04 19:22:39 +0000
+++ configglue/contrib/schema/__init__.py 2013-07-11 19:08:28 +0000
@@ -4,7 +4,7 @@
4#4#
5# A library for simple, DRY configuration of applications5# A library for simple, DRY configuration of applications
6#6#
7# (C) 2009--2012 by Canonical Ltd.7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#10#
1111
=== modified file 'configglue/contrib/schema/devserver.py'
--- configglue/contrib/schema/devserver.py 2012-04-24 15:58:44 +0000
+++ configglue/contrib/schema/devserver.py 2013-07-11 19:08:28 +0000
@@ -1,3 +1,18 @@
1###############################################################################
2#
3# configglue -- glue for your apps' configuration
4#
5# A library for simple, DRY configuration of applications
6#
7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#
11# Released under the BSD License (see the file LICENSE)
12#
13# For bug reports, support, and new releases: http://launchpad.net/configglue
14#
15###############################################################################
1from configglue.schema import (16from configglue.schema import (
2 BoolOption,17 BoolOption,
3 IntOption,18 IntOption,
419
=== modified file 'configglue/contrib/schema/django_jenkins.py'
--- configglue/contrib/schema/django_jenkins.py 2012-04-24 15:58:44 +0000
+++ configglue/contrib/schema/django_jenkins.py 2013-07-11 19:08:28 +0000
@@ -1,3 +1,18 @@
1###############################################################################
2#
3# configglue -- glue for your apps' configuration
4#
5# A library for simple, DRY configuration of applications
6#
7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#
11# Released under the BSD License (see the file LICENSE)
12#
13# For bug reports, support, and new releases: http://launchpad.net/configglue
14#
15###############################################################################
1from configglue.schema import (16from configglue.schema import (
2 ListOption,17 ListOption,
3 Schema,18 Schema,
419
=== modified file 'configglue/contrib/schema/django_openid_auth.py'
--- configglue/contrib/schema/django_openid_auth.py 2013-05-30 19:41:51 +0000
+++ configglue/contrib/schema/django_openid_auth.py 2013-07-11 19:08:28 +0000
@@ -1,3 +1,18 @@
1###############################################################################
2#
3# configglue -- glue for your apps' configuration
4#
5# A library for simple, DRY configuration of applications
6#
7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#
11# Released under the BSD License (see the file LICENSE)
12#
13# For bug reports, support, and new releases: http://launchpad.net/configglue
14#
15###############################################################################
1from configglue.schema import (16from configglue.schema import (
2 BoolOption,17 BoolOption,
3 DictOption,18 DictOption,
419
=== modified file 'configglue/contrib/schema/nexus.py'
--- configglue/contrib/schema/nexus.py 2012-04-24 15:58:44 +0000
+++ configglue/contrib/schema/nexus.py 2013-07-11 19:08:28 +0000
@@ -1,3 +1,18 @@
1###############################################################################
2#
3# configglue -- glue for your apps' configuration
4#
5# A library for simple, DRY configuration of applications
6#
7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#
11# Released under the BSD License (see the file LICENSE)
12#
13# For bug reports, support, and new releases: http://launchpad.net/configglue
14#
15###############################################################################
1from configglue.schema import BoolOption, Schema, Section, StringOption16from configglue.schema import BoolOption, Schema, Section, StringOption
217
318
419
=== modified file 'configglue/contrib/schema/preflight.py'
--- configglue/contrib/schema/preflight.py 2012-04-24 15:58:44 +0000
+++ configglue/contrib/schema/preflight.py 2013-07-11 19:08:28 +0000
@@ -1,3 +1,18 @@
1###############################################################################
2#
3# configglue -- glue for your apps' configuration
4#
5# A library for simple, DRY configuration of applications
6#
7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#
11# Released under the BSD License (see the file LICENSE)
12#
13# For bug reports, support, and new releases: http://launchpad.net/configglue
14#
15###############################################################################
1from configglue.schema import Section, Schema, StringOption16from configglue.schema import Section, Schema, StringOption
217
318
419
=== modified file 'configglue/contrib/schema/pystatsd.py'
--- configglue/contrib/schema/pystatsd.py 2012-05-10 12:45:19 +0000
+++ configglue/contrib/schema/pystatsd.py 2013-07-11 19:08:28 +0000
@@ -1,3 +1,18 @@
1###############################################################################
2#
3# configglue -- glue for your apps' configuration
4#
5# A library for simple, DRY configuration of applications
6#
7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#
11# Released under the BSD License (see the file LICENSE)
12#
13# For bug reports, support, and new releases: http://launchpad.net/configglue
14#
15###############################################################################
1from configglue.schema import IntOption, Schema, Section, StringOption16from configglue.schema import IntOption, Schema, Section, StringOption
217
318
419
=== modified file 'configglue/contrib/schema/raven.py'
--- configglue/contrib/schema/raven.py 2012-04-24 18:17:41 +0000
+++ configglue/contrib/schema/raven.py 2013-07-11 19:08:28 +0000
@@ -1,3 +1,18 @@
1###############################################################################
2#
3# configglue -- glue for your apps' configuration
4#
5# A library for simple, DRY configuration of applications
6#
7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#
11# Released under the BSD License (see the file LICENSE)
12#
13# For bug reports, support, and new releases: http://launchpad.net/configglue
14#
15###############################################################################
1from configglue.schema import (16from configglue.schema import (
2 BoolOption,17 BoolOption,
3 IntOption,18 IntOption,
419
=== modified file 'configglue/contrib/schema/saml2idp.py'
--- configglue/contrib/schema/saml2idp.py 2012-04-24 15:58:44 +0000
+++ configglue/contrib/schema/saml2idp.py 2013-07-11 19:08:28 +0000
@@ -1,3 +1,18 @@
1###############################################################################
2#
3# configglue -- glue for your apps' configuration
4#
5# A library for simple, DRY configuration of applications
6#
7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#
11# Released under the BSD License (see the file LICENSE)
12#
13# For bug reports, support, and new releases: http://launchpad.net/configglue
14#
15###############################################################################
1from configglue.schema import (16from configglue.schema import (
2 BoolOption,17 BoolOption,
3 ListOption,18 ListOption,
419
=== modified file 'configglue/glue.py'
--- configglue/glue.py 2013-05-25 15:21:04 +0000
+++ configglue/glue.py 2013-07-11 19:08:28 +0000
@@ -4,7 +4,7 @@
4#4#
5# A library for simple, DRY configuration of applications5# A library for simple, DRY configuration of applications
6#6#
7# (C) 2009--2011 by Canonical Ltd.7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#10#
@@ -16,13 +16,10 @@
1616
17import os17import os
18import sys18import sys
19from configparser import (
20 NoOptionError,
21 NoSectionError,
22)
23from optparse import OptionParser19from optparse import OptionParser
24from collections import namedtuple20from collections import namedtuple
2521
22from ._compat import NoSectionError, NoOptionError
26from .parser import SchemaConfigParser23from .parser import SchemaConfigParser
2724
2825
2926
=== modified file 'configglue/inischema/__init__.py'
--- configglue/inischema/__init__.py 2011-07-17 22:32:16 +0000
+++ configglue/inischema/__init__.py 2013-07-11 19:08:28 +0000
@@ -4,7 +4,7 @@
4#4#
5# A library for simple, DRY configuration of applications5# A library for simple, DRY configuration of applications
6#6#
7# (C) 2009--2011 by Canonical Ltd.7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#10#
1111
=== modified file 'configglue/inischema/attributed.py'
--- configglue/inischema/attributed.py 2013-05-26 15:07:30 +0000
+++ configglue/inischema/attributed.py 2013-07-11 19:08:28 +0000
@@ -4,7 +4,7 @@
4#4#
5# A library for simple, DRY configuration of applications5# A library for simple, DRY configuration of applications
6#6#
7# (C) 2009--2011 by Canonical Ltd.7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#10#
@@ -18,7 +18,8 @@
18AttributtedConfigParser lives here.18AttributtedConfigParser lives here.
19"""19"""
20import re20import re
21from configparser import RawConfigParser21
22from configglue._compat import RawConfigParser
2223
2324
24marker = object()25marker = object()
2526
=== modified file 'configglue/inischema/glue.py'
--- configglue/inischema/glue.py 2013-05-26 15:49:00 +0000
+++ configglue/inischema/glue.py 2013-07-11 19:08:28 +0000
@@ -4,7 +4,7 @@
4#4#
5# A library for simple, DRY configuration of applications5# A library for simple, DRY configuration of applications
6#6#
7# (C) 2009--2011 by Canonical Ltd.7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#10#
1111
=== modified file 'configglue/inischema/parsers.py'
--- configglue/inischema/parsers.py 2011-07-17 22:32:16 +0000
+++ configglue/inischema/parsers.py 2013-07-11 19:08:28 +0000
@@ -4,7 +4,7 @@
4#4#
5# A library for simple, DRY configuration of applications5# A library for simple, DRY configuration of applications
6#6#
7# (C) 2009--2011 by Canonical Ltd.7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#10#
1111
=== modified file 'configglue/inischema/typed.py'
--- configglue/inischema/typed.py 2013-05-26 15:48:10 +0000
+++ configglue/inischema/typed.py 2013-07-11 19:08:28 +0000
@@ -4,7 +4,7 @@
4#4#
5# A library for simple, DRY configuration of applications5# A library for simple, DRY configuration of applications
6#6#
7# (C) 2009--2011 by Canonical Ltd.7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#10#
1111
=== modified file 'configglue/parser.py'
--- configglue/parser.py 2013-07-08 20:10:06 +0000
+++ configglue/parser.py 2013-07-11 19:08:28 +0000
@@ -4,7 +4,7 @@
4#4#
5# A library for simple, DRY configuration of applications5# A library for simple, DRY configuration of applications
6#6#
7# (C) 2009--2011 by Canonical Ltd.7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#10#
@@ -21,16 +21,15 @@
21import os21import os
22import re22import re
2323
24from configparser import (24from functools import reduce
25
26from ._compat import BaseConfigParser, text_type, string_types
27from ._compat import (
25 DEFAULTSECT,28 DEFAULTSECT,
26 SafeConfigParser as BaseConfigParser,
27 InterpolationMissingOptionError,29 InterpolationMissingOptionError,
28 NoOptionError,30 NoOptionError,
29 NoSectionError,31 NoSectionError,
30)32)
31from functools import reduce
32
33from configglue._compat import text_type, string_types
3433
3534
36__all__ = [35__all__ = [
@@ -77,8 +76,6 @@
77 self._basedir = ''76 self._basedir = ''
78 self._dirty = collections.defaultdict(77 self._dirty = collections.defaultdict(
79 lambda: collections.defaultdict(dict))78 lambda: collections.defaultdict(dict))
80 # map to location in configparser
81 self._KEYCRE = self._interpolation._KEYCRE
8279
83 def is_valid(self, report=False):80 def is_valid(self, report=False):
84 """Return if the state of the parser is valid.81 """Return if the state of the parser is valid.
@@ -386,7 +383,7 @@
386 keys = [self._extract_interpolation_keys(x) for x in item]383 keys = [self._extract_interpolation_keys(x) for x in item]
387 keys = reduce(set.union, keys, set())384 keys = reduce(set.union, keys, set())
388 else:385 else:
389 keys = set(self._KEYCRE.findall(item))386 keys = set(self._interpolation._KEYCRE.findall(item))
390 # remove invalid key387 # remove invalid key
391 if '' in keys:388 if '' in keys:
392 keys.remove('')389 keys.remove('')
393390
=== modified file 'configglue/schema.py'
--- configglue/schema.py 2013-05-26 19:07:46 +0000
+++ configglue/schema.py 2013-07-11 19:08:28 +0000
@@ -4,7 +4,7 @@
4#4#
5# A library for simple, DRY configuration of applications5# A library for simple, DRY configuration of applications
6#6#
7# (C) 2009--2011 by Canonical Ltd.7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#10#
@@ -16,14 +16,12 @@
16from __future__ import unicode_literals16from __future__ import unicode_literals
1717
18import json18import json
19from configparser import (
20 NoSectionError,
21 NoOptionError,
22)
23from copy import deepcopy19from copy import deepcopy
24from inspect import getmembers20from inspect import getmembers
2521
26from configglue._compat import text_type, string_types22from ._compat import text_type, string_types
23from ._compat import NoSectionError, NoOptionError
24
2725
2826
29__all__ = [27__all__ = [
3028
=== modified file 'configglue/tests/__init__.py'
--- configglue/tests/__init__.py 2011-07-17 22:32:16 +0000
+++ configglue/tests/__init__.py 2013-07-11 19:08:28 +0000
@@ -4,7 +4,7 @@
4#4#
5# A library for simple, DRY configuration of applications5# A library for simple, DRY configuration of applications
6#6#
7# (C) 2009--2011 by Canonical Ltd.7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#10#
1111
=== modified file 'configglue/tests/app/test_base.py'
--- configglue/tests/app/test_base.py 2013-05-26 16:20:41 +0000
+++ configglue/tests/app/test_base.py 2013-07-11 19:08:28 +0000
@@ -4,7 +4,7 @@
4#4#
5# A library for simple, DRY configuration of applications5# A library for simple, DRY configuration of applications
6#6#
7# (C) 2009--2011 by Canonical Ltd.7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#10#
1111
=== modified file 'configglue/tests/app/test_plugin.py'
--- configglue/tests/app/test_plugin.py 2011-07-17 22:32:16 +0000
+++ configglue/tests/app/test_plugin.py 2013-07-11 19:08:28 +0000
@@ -4,7 +4,7 @@
4#4#
5# A library for simple, DRY configuration of applications5# A library for simple, DRY configuration of applications
6#6#
7# (C) 2009--2011 by Canonical Ltd.7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#10#
1111
=== modified file 'configglue/tests/inischema/__init__.py'
--- configglue/tests/inischema/__init__.py 2011-07-17 22:32:16 +0000
+++ configglue/tests/inischema/__init__.py 2013-07-11 19:08:28 +0000
@@ -4,7 +4,7 @@
4#4#
5# A library for simple, DRY configuration of applications5# A library for simple, DRY configuration of applications
6#6#
7# (C) 2009--2011 by Canonical Ltd.7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#10#
1111
=== modified file 'configglue/tests/inischema/test_attributed.py'
--- configglue/tests/inischema/test_attributed.py 2013-05-26 16:15:48 +0000
+++ configglue/tests/inischema/test_attributed.py 2013-07-11 19:08:28 +0000
@@ -4,7 +4,7 @@
4#4#
5# A library for simple, DRY configuration of applications5# A library for simple, DRY configuration of applications
6#6#
7# (C) 2009--2011 by Canonical Ltd.7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#10#
@@ -19,9 +19,9 @@
19# runner's output, so pylint: disable-msg=C011119# runner's output, so pylint: disable-msg=C0111
2020
21import unittest21import unittest
22from configparser import RawConfigParser
23from io import StringIO22from io import StringIO
2423
24from configglue._compat import RawConfigParser
25from configglue.inischema.attributed import AttributedConfigParser25from configglue.inischema.attributed import AttributedConfigParser
2626
2727
2828
=== modified file 'configglue/tests/inischema/test_glue.py'
--- configglue/tests/inischema/test_glue.py 2013-05-26 19:07:46 +0000
+++ configglue/tests/inischema/test_glue.py 2013-07-11 19:08:28 +0000
@@ -4,7 +4,7 @@
4#4#
5# A library for simple, DRY configuration of applications5# A library for simple, DRY configuration of applications
6#6#
7# (C) 2009--2011 by Canonical Ltd.7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#10#
1111
=== modified file 'configglue/tests/inischema/test_glue2glue.py'
--- configglue/tests/inischema/test_glue2glue.py 2013-05-26 16:15:48 +0000
+++ configglue/tests/inischema/test_glue2glue.py 2013-07-11 19:08:28 +0000
@@ -5,7 +5,7 @@
5#5#
6# A library for simple, DRY configuration of applications6# A library for simple, DRY configuration of applications
7#7#
8# (C) 2009--2011 by Canonical Ltd.8# (C) 2009--2013 by Canonical Ltd.
9# by John R. Lenton <john.lenton@canonical.com>9# by John R. Lenton <john.lenton@canonical.com>
10# and Ricardo Kirkner <ricardo.kirkner@canonical.com>10# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
11#11#
1212
=== modified file 'configglue/tests/inischema/test_parsers.py'
--- configglue/tests/inischema/test_parsers.py 2011-07-17 22:32:16 +0000
+++ configglue/tests/inischema/test_parsers.py 2013-07-11 19:08:28 +0000
@@ -4,7 +4,7 @@
4#4#
5# A library for simple, DRY configuration of applications5# A library for simple, DRY configuration of applications
6#6#
7# (C) 2009--2011 by Canonical Ltd.7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#10#
1111
=== modified file 'configglue/tests/inischema/test_typed.py'
--- configglue/tests/inischema/test_typed.py 2013-05-26 16:15:48 +0000
+++ configglue/tests/inischema/test_typed.py 2013-07-11 19:08:28 +0000
@@ -5,7 +5,7 @@
5#5#
6# A library for simple, DRY configuration of applications6# A library for simple, DRY configuration of applications
7#7#
8# (C) 2009--2011 by Canonical Ltd.8# (C) 2009--2013 by Canonical Ltd.
9# by John R. Lenton <john.lenton@canonical.com>9# by John R. Lenton <john.lenton@canonical.com>
10# and Ricardo Kirkner <ricardo.kirkner@canonical.com>10# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
11#11#
@@ -21,8 +21,8 @@
2121
22import unittest22import unittest
23from io import StringIO23from io import StringIO
24from configparser import RawConfigParser
2524
25from configglue._compat import RawConfigParser
26from configglue.inischema.typed import TypedConfigParser26from configglue.inischema.typed import TypedConfigParser
2727
2828
2929
=== modified file 'configglue/tests/test_contrib_schema.py'
--- configglue/tests/test_contrib_schema.py 2013-05-30 19:48:15 +0000
+++ configglue/tests/test_contrib_schema.py 2013-07-11 19:08:28 +0000
@@ -1,3 +1,18 @@
1###############################################################################
2#
3# configglue -- glue for your apps' configuration
4#
5# A library for simple, DRY configuration of applications
6#
7# (C) 2009--2013 by Canonical Ltd.
8# by John R. Lenton <john.lenton@canonical.com>
9# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
10#
11# Released under the BSD License (see the file LICENSE)
12#
13# For bug reports, support, and new releases: http://launchpad.net/configglue
14#
15###############################################################################
1from unittest import TestCase16from unittest import TestCase
217
3from configglue.schema import ListOption, StringOption18from configglue.schema import ListOption, StringOption
419
=== modified file 'configglue/tests/test_parser.py'
--- configglue/tests/test_parser.py 2013-07-08 20:10:06 +0000
+++ configglue/tests/test_parser.py 2013-07-11 19:08:28 +0000
@@ -5,7 +5,7 @@
5#5#
6# A library for simple, DRY configuration of applications6# A library for simple, DRY configuration of applications
7#7#
8# (C) 2009--2011 by Canonical Ltd.8# (C) 2009--2013 by Canonical Ltd.
9# by John R. Lenton <john.lenton@canonical.com>9# by John R. Lenton <john.lenton@canonical.com>
10# and Ricardo Kirkner <ricardo.kirkner@canonical.com>10# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
11#11#
@@ -22,13 +22,6 @@
22import tempfile22import tempfile
23import textwrap23import textwrap
24import unittest24import unittest
25from configparser import (
26 DEFAULTSECT,
27 InterpolationDepthError,
28 InterpolationMissingOptionError,
29 InterpolationSyntaxError,
30 NoSectionError,
31)
32from io import BytesIO25from io import BytesIO
3326
34from mock import (27from mock import (
@@ -38,9 +31,16 @@
38)31)
3932
40from configglue._compat import iteritems33from configglue._compat import iteritems
34from configglue._compat import (
35 DEFAULTSECT,
36 InterpolationDepthError,
37 InterpolationMissingOptionError,
38 InterpolationSyntaxError,
39 NoOptionError,
40 NoSectionError,
41)
41from configglue.parser import (42from configglue.parser import (
42 CONFIG_FILE_ENCODING,43 CONFIG_FILE_ENCODING,
43 NoOptionError,
44 SchemaConfigParser,44 SchemaConfigParser,
45 SchemaValidationError,45 SchemaValidationError,
46)46)
@@ -248,8 +248,8 @@
248 rawval = '%(bar)'248 rawval = '%(bar)'
249 vars = {'foo': '%(bar)s', 'bar': 'pepe'}249 vars = {'foo': '%(bar)s', 'bar': 'pepe'}
250 parser = SchemaConfigParser(MySchema())250 parser = SchemaConfigParser(MySchema())
251 self.assertRaises(InterpolationSyntaxError, parser._interpolate,251 self.assertRaises(InterpolationSyntaxError,
252 section, option, rawval, vars)252 parser._interpolate, section, option, rawval, vars)
253253
254 def test_interpolate_across_sections(self):254 def test_interpolate_across_sections(self):
255 """Test interpolation across sections."""255 """Test interpolation across sections."""
@@ -278,8 +278,8 @@
278 config = BytesIO(b"[foo]\nbar=%(wham)s\n[baz]\nwham=42")278 config = BytesIO(b"[foo]\nbar=%(wham)s\n[baz]\nwham=42")
279 parser = SchemaConfigParser(MySchema())279 parser = SchemaConfigParser(MySchema())
280 parser.readfp(config)280 parser.readfp(config)
281 self.assertRaises(InterpolationMissingOptionError, parser.get,281 self.assertRaises(InterpolationMissingOptionError,
282 'foo', 'bar')282 parser.get, 'foo', 'bar')
283283
284 @patch('configglue.parser.os')284 @patch('configglue.parser.os')
285 def test_interpolate_environment_basic_syntax(self, mock_os):285 def test_interpolate_environment_basic_syntax(self, mock_os):
@@ -592,7 +592,8 @@
592 self.assertEqual(set(items), set([('foo', 'bar')]))592 self.assertEqual(set(items), set([('foo', 'bar')]))
593593
594 def test_items_no_section(self):594 def test_items_no_section(self):
595 self.assertRaises(NoSectionError, self.parser.items, '__main__')595 self.assertRaises(NoSectionError, self.parser.items,
596 '__main__')
596597
597 def test_items_raw(self):598 def test_items_raw(self):
598 config = BytesIO(b'[__main__]\nfoo=%(baz)s')599 config = BytesIO(b'[__main__]\nfoo=%(baz)s')
@@ -624,8 +625,8 @@
624 def test_items_interpolate_error(self):625 def test_items_interpolate_error(self):
625 config = BytesIO(b'[__main__]\nfoo=%(bar)s')626 config = BytesIO(b'[__main__]\nfoo=%(bar)s')
626 self.parser.readfp(config)627 self.parser.readfp(config)
627 self.assertRaises(InterpolationMissingOptionError, self.parser.items,628 self.assertRaises(InterpolationMissingOptionError,
628 '__main__')629 self.parser.items, '__main__')
629630
630 def test_values_empty_parser(self):631 def test_values_empty_parser(self):
631 values = self.parser.values()632 values = self.parser.values()
@@ -820,12 +821,12 @@
820 self.assertEqual(default, expected)821 self.assertEqual(default, expected)
821822
822 def test_get_default_no_option(self):823 def test_get_default_no_option(self):
823 self.assertRaises(NoOptionError, self.parser._get_default,824 self.assertRaises(NoOptionError,
824 '__main__', 'bar')825 self.parser._get_default, '__main__', 'bar')
825826
826 def test_get_default_no_section(self):827 def test_get_default_no_section(self):
827 self.assertRaises(NoSectionError, self.parser._get_default,828 self.assertRaises(NoSectionError,
828 'foo', 'bar')829 self.parser._get_default, 'foo', 'bar')
829830
830 def test_multi_file_dict_config(self):831 def test_multi_file_dict_config(self):
831 """Test parsing a dict option spanning multiple files."""832 """Test parsing a dict option spanning multiple files."""
832833
=== modified file 'configglue/tests/test_schema.py'
--- configglue/tests/test_schema.py 2013-05-31 15:26:42 +0000
+++ configglue/tests/test_schema.py 2013-07-11 19:08:28 +0000
@@ -5,7 +5,7 @@
5#5#
6# A library for simple, DRY configuration of applications6# A library for simple, DRY configuration of applications
7#7#
8# (C) 2009--2011 by Canonical Ltd.8# (C) 2009--2013 by Canonical Ltd.
9# by John R. Lenton <john.lenton@canonical.com>9# by John R. Lenton <john.lenton@canonical.com>
10# and Ricardo Kirkner <ricardo.kirkner@canonical.com>10# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
11#11#
@@ -18,13 +18,10 @@
1818
19import textwrap19import textwrap
20import unittest20import unittest
21from configparser import (
22 NoOptionError,
23 NoSectionError,
24)
25from io import BytesIO21from io import BytesIO
2622
27from configglue._compat import text_type23from configglue._compat import text_type
24from configglue._compat import NoOptionError, NoSectionError
28from configglue.parser import (25from configglue.parser import (
29 SchemaConfigParser,26 SchemaConfigParser,
30 SchemaValidationError,27 SchemaValidationError,
3128
=== modified file 'configglue/tests/test_schemaconfig.py'
--- configglue/tests/test_schemaconfig.py 2013-05-26 19:07:46 +0000
+++ configglue/tests/test_schemaconfig.py 2013-07-11 19:08:28 +0000
@@ -5,7 +5,7 @@
5#5#
6# A library for simple, DRY configuration of applications6# A library for simple, DRY configuration of applications
7#7#
8# (C) 2009--2011 by Canonical Ltd.8# (C) 2009--2013 by Canonical Ltd.
9# by John R. Lenton <john.lenton@canonical.com>9# by John R. Lenton <john.lenton@canonical.com>
10# and Ricardo Kirkner <ricardo.kirkner@canonical.com>10# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
11#11#
@@ -31,14 +31,12 @@
31)31)
3232
33from configglue._compat import PY233from configglue._compat import PY2
34from configglue._compat import NoSectionError
34from configglue.glue import (35from configglue.glue import (
35 configglue,36 configglue,
36 schemaconfigglue,37 schemaconfigglue,
37)38)
38from configglue.parser import (39from configglue.parser import SchemaConfigParser
39 NoSectionError,
40 SchemaConfigParser,
41)
42from configglue.schema import (40from configglue.schema import (
43 DictOption,41 DictOption,
44 IntOption,42 IntOption,
4543
=== removed directory 'debian'
=== removed file 'debian/changelog'
--- debian/changelog 2012-05-10 12:46:50 +0000
+++ debian/changelog 1970-01-01 00:00:00 +0000
@@ -1,122 +0,0 @@
1python-configglue (1.0.3-0ubuntu2) precise; urgency=low
2
3 * fixed missing renames
4
5 -- Ricardo Kirkner <ricardo.kirkner@canonical.com> Thu, 10 May 2012 12:46:25 +0000
6
7python-configglue (1.0.3-0ubuntu1) precise; urgency=low
8
9 * Provide contributed schemas for applications not providing their own schema
10
11 -- Ricardo Kirkner <ricardo.kirkner@canonical.com> Thu, 10 May 2012 12:27:19 +0000
12
13python-configglue (1.0.1-0ubuntu1) oneiric; urgency=low
14
15 [Ricardo Kirkner]
16 * updated version for release
17 * support python %(name)s string formatting syntax
18 * some final improvements to the docs
19 * updated docs for the 1.0 release
20 * add support to ListOption to parse json
21 * some small improvements
22 * allow DictOption to be specified in the config using json
23 * log a WARNING when a file could not be read
24 * Better error handling and reporting during configuration validation
25 * simplified option precedence
26 * allow to override App's default option parser
27 * improved equality checks on Option subclasses
28 * added --validate option to App base class to enable config validation
29 * handle different mock versions for backwards compatibility
30 * include testing dependencies as build dependencies
31 * run tests during package build
32 * fixed bug due to incorrect handling of option override precedence when an option is marked as fatal.
33 * Preparing for the 1.0 release.
34 * removed deprecated classes and deprecation warnings
35 * Move configglue.pyschema into configglue to simplify the namespace.
36 * removed dependency on python-xdgapp
37 * added .tox folder to ignore list
38
39 -- Ricardo Kirkner <ricardo.kirkner@canonical.com> Thu, 05 Jan 2012 13:43:07 -0300
40
41python-configglue (0.11.1-0ubuntu1) natty; urgency=low
42
43 [Ricardo Kirkner]
44 * Bug (LP: #733977) support custom names for schema options in optparse
45 * updated documentation
46 * added docs building to the set of tests run by tox
47 * fix bug with parsing extra sections for DictOption and ListOption
48
49 -- Ricardo Kirkner <ricardo.kirkner@canonical.com> Sat, 09 Jul 2011 18:01:46 -0300
50
51python-configglue (0.11-0ubuntu1) natty; urgency=low
52
53 [Ricardo Kirkner]
54 * applied pep8 and pyflakes cleanups
55 * various smaller bug fixes
56 * moved tests into the configglue namespace
57 * added support for running the tests via tox
58 * added support for environment variables
59 * added basic class for simplifying creating configglue-enabled applications
60 * simplified section and option class names
61 * Bug (LP: #757955) fatal kwarg on option does not allow --help on cli for non existing config files
62 * Bug (LP: #793060) TypeError: option values must be strings
63 * Bug (LP: #753395) Update to schema definition syntax
64
65 -- Ricardo Kirkner <ricardo.kirkner@canonical.com> Thu, 23 Jun 2011 20:44:24 -0300
66
67python-configglue (0.10-0ubuntu1) maverick; urgency=low
68
69 [Ricardo Kirkner]
70 * Override ConfigParser.write in SchemaConfigParser, to support writing non-ascii data.
71 * documentation + backwards-compatibility
72 * fixes proper schema inheritance using declarative syntax
73 * all ConfigOption classes have a name attribute
74 * Use SafeConfigParser instead of ConfigParser as this will get deprecated
75 * added debian packaging info directly into the source tree
76 * added test for regression of bug #659178
77
78 -- Ricardo Kirkner <ricardo.kirkner@canonical.com> Mon, 02 May 2011 16:44:35 -0300
79
80python-configglue (0.9.1-0ubuntu1) maverick; urgency=low
81
82 [Ricardo Kirkner]
83 * New upstream release.
84 - simplified setup code to get version
85 - refactored code to remove circular dependencies
86 - Simplified configglue api for a common use case.
87 - Added quickstart guide for getting started
88
89 -- Ricardo Kirkner <ricardo.kirkner@canonical.com> Sun, 20 Feb 2011 19:06:22 -0300
90
91python-configglue (0.9pre1-0ubuntu1) maverick; urgency=low
92
93 [Rick McBride]
94 * New upstream release. Closes (LP: #616477)
95 - fixed broken tests
96 - moved existing code around
97 - initial import of configglue.pyschema (from schemaconfig)
98 - merged changes from Ricardo Kirkner
99 - unified the © headers
100 - worked around circular import that happens when importing pyschema first
101 - schema inheritance fix
102 -added optional arguement to ini2schema for ubuntuone-client
103
104 [Elliot Murphy]
105 * debian/control: bumped standards-version to 3.9.1
106
107 -- Rick McBride <rick.mcbride@canonical.com> Wed, 11 Aug 2010 16:43:35 -0400
108
109python-configglue (0.2dev-0ubuntu2) karmic; urgency=low
110
111 * debian/control:
112 + XS-Python-Version changed to >= 2.5 because of absolute imports
113 (LP: #391451)
114
115 -- Andrew Mitchell <ajmitch@ubuntu.com> Wed, 24 Jun 2009 14:35:22 +1200
116
117python-configglue (0.2dev-0ubuntu1) karmic; urgency=low
118
119 * Initial package Closes (LP: #384830)
120
121 -- Rick McBride <rick.mcbride@canonical.com> Mon, 15 Jun 2009 14:33:00 -0400
122
1230
=== removed file 'debian/compat'
--- debian/compat 2011-02-20 21:53:16 +0000
+++ debian/compat 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
17
20
=== removed file 'debian/control'
--- debian/control 2011-07-23 18:35:20 +0000
+++ debian/control 1970-01-01 00:00:00 +0000
@@ -1,24 +0,0 @@
1Source: python-configglue
2Section: python
3Priority: optional
4Maintainer: Ubuntu MOTU Team <ubuntu-motu@lists.ubuntu.com>
5XSBC-Original-Maintainer: Ricardo Kirkner <ricardo.kirkner@canonical.com>
6Build-Depends: cdbs,
7 debhelper (>= 7.0.14),
8 python,
9 python-setuptools,
10 python-support,
11# needed for building in order to run the tests
12 python-mock,
13 python-xdg
14Standards-Version: 3.9.1
15
16Package: python-configglue
17Architecture: all
18XB-Python-Version: ${python:Versions}
19Depends: ${misc:Depends}, ${python:Depends},
20 python-xdg
21Description: Glues together optparse.OptionParser and ConfigParser.ConfigParser
22 Configglue is a library that glues together python's optparse.OptionParser
23 and ConfigParser.ConfigParser, so that the same options can be exported to a
24 configuration file and a commandline interface.
250
=== removed file 'debian/copyright'
--- debian/copyright 2011-06-23 23:58:43 +0000
+++ debian/copyright 1970-01-01 00:00:00 +0000
@@ -1,43 +0,0 @@
1This package was debianized by Rick McBride <rick.mcbride@canonical.com> on
2Fri, 20 Mar 2009 14:26:00 -0400.
3
4Copyright:
5
6 Copyright (C) 2009-2011 Canonical
7
8License:
9
10 Upstream Author: John R. Lenton <john lenton at canonical com>
11 Ricardo Kirkner <ricardo kirkner at canonical com>
12 Project Homepage: https://launchpad.net/configglue
13 Released under the BSD License
14
15 Copyright (C) 2009-2011, Canonical
16 All rights reserved.
17
18 Redistribution and use in source and binary forms, with or without
19 modification, are permitted provided that the following conditions are met:
20
21 * Redistributions of source code must retain the above copyright notice,
22 this list of conditions and the following disclaimer.
23 * Redistributions in binary form must reproduce the above copyright
24 notice, this list of conditions and the following disclaimer in the
25 documentation and/or other materials provided with the distribution.
26 * Neither the name Canonical nor the names of its contributors may be
27 used to endorse or promote products derived from this software without
28 specific prior written permission.
29
30 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
31 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
34 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
35 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
36 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
37 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
38 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
39 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
40 POSSIBILITY OF SUCH DAMAGE
41
42 The Debian packaging is (C) 2009-2011, Canonical and is licensed under the
43 BSD license, see above.
440
=== removed file 'debian/pycompat'
--- debian/pycompat 2011-02-20 21:53:16 +0000
+++ debian/pycompat 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
12
20
=== removed file 'debian/rules'
--- debian/rules 2011-07-23 12:15:10 +0000
+++ debian/rules 1970-01-01 00:00:00 +0000
@@ -1,8 +0,0 @@
1#!/usr/bin/make -f
2
3include /usr/share/cdbs/1/rules/debhelper.mk
4DEB_PYTHON_SYSTEM = pysupport
5include /usr/share/cdbs/1/class/python-distutils.mk
6
7build/python-configglue::
8 python setup.py test
90
=== removed file 'debian/watch'
--- debian/watch 2011-02-20 21:53:16 +0000
+++ debian/watch 1970-01-01 00:00:00 +0000
@@ -1,2 +0,0 @@
1version=3
2http://pypi.python.org/packages/source/c/configglue/configglue-(.+)\.tar\.gz
30
=== modified file 'setup.py'
--- setup.py 2013-05-27 00:42:51 +0000
+++ setup.py 2013-07-11 19:08:28 +0000
@@ -21,12 +21,9 @@
21)21)
2222
23import configglue23import configglue
24from configglue._compat import PY2
2524
2625
27install_requires = ['pyxdg']26install_requires = ['pyxdg']
28if PY2:
29 install_requires.extend(['configparser'])
3027
3128
32setup(name='configglue',29setup(name='configglue',
3330
=== modified file 'tox.ini'
--- tox.ini 2013-05-27 00:42:51 +0000
+++ tox.ini 2013-07-11 19:08:28 +0000
@@ -8,16 +8,6 @@
8commands =8commands =
9 python setup.py test9 python setup.py test
1010
11[testenv:py26]
12deps =
13 {[testenv]deps}
14 configparser
15
16[testenv:py27]
17deps =
18 {[testenv]deps}
19 configparser
20
21[testenv:docs]11[testenv:docs]
22changedir = doc12changedir = doc
23deps =13deps =

Subscribers

People subscribed via source and target branches