Merge lp:~ricardokirkner/configglue/from-future-remove-configparser into lp:configglue
- from-future-remove-configparser
- Merge into trunk
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 |
Related bugs: |
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
Description of the change
Barry Warsaw (barry) wrote : | # |
You need to remove the configparser dependencies in the tox.ini file.
Barry Warsaw (barry) wrote : | # |
=== modified file 'configglue/
--- configglue/
+++ configglue/
> @@ -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/
--- 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.
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.
> - except (NoSectionError, NoOptionError):
> + except (configparser.
> pass
> kwargs['action'] = option.action
> args = ['--' + long_name(option)]
> @@ -92,7 +89,7 @@
> op_value = getattr(options, opt_name(option))
> try:
> parser_value = parser.
> - except (NoSectionError, NoOptionError):
> + except (configparser.
> parser_value = None
> env_value = os.environ.
> long_name(
=== modified file 'configglue/
--- configglue/
+++ configglue/
> @@ -21,16 +21,9 @@
> import os
> import re
>
> -from configparser import (
> - DEFAULTSECT,
> - SafeConfigParser as BaseConfigParser,
> - InterpolationMi
> - NoOptionError,
> - NoSectionError,
> -)
Similarly, this could probably be
from ._compat.
...
)
and less of the following code would need to change.
=== modified file 'configglue/
--- configglue/
+++ configglue/
> @@ -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.
> if section is None:
> - raise NoSectionError(
Barry Warsaw (barry) : | # |
- 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
Barry Warsaw (barry) wrote : | # |
Thanks for the fixes. I can work with this.
dobey (dobey) : | # |
Preview Diff
1 | === modified file 'LICENSE' |
2 | --- LICENSE 2010-07-31 00:58:37 +0000 |
3 | +++ LICENSE 2013-07-11 19:08:28 +0000 |
4 | @@ -1,4 +1,4 @@ |
5 | -Copyright 2009, 2010 Canonical Ltd. All rights reserved. |
6 | +Copyright 2009--2013 Canonical Ltd. All rights reserved. |
7 | |
8 | Redistribution and use in source and binary forms, with or without |
9 | modification, are permitted provided that the following conditions are |
10 | |
11 | === added file 'LICENSE.PSF' |
12 | --- LICENSE.PSF 1970-01-01 00:00:00 +0000 |
13 | +++ LICENSE.PSF 2013-07-11 19:08:28 +0000 |
14 | @@ -0,0 +1,22 @@ |
15 | +PSF LICENSE AGREEMENT FOR PYTHON 2.7.5 |
16 | + |
17 | +This 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. |
18 | +Subject 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. |
19 | +In 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. |
20 | +PSF 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. |
21 | +PSF 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. |
22 | +This License Agreement will automatically terminate upon a material breach of its terms and conditions. |
23 | +Nothing 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. |
24 | +By copying, installing or otherwise using Python 2.7.5, Licensee agrees to be bound by the terms and conditions of this License Agreement. |
25 | + |
26 | + |
27 | +PSF LICENSE AGREEMENT FOR PYTHON 3.3.2 |
28 | + |
29 | +This 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. |
30 | +Subject 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. |
31 | +In 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. |
32 | +PSF 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. |
33 | +PSF 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. |
34 | +This License Agreement will automatically terminate upon a material breach of its terms and conditions. |
35 | +Nothing 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. |
36 | +By copying, installing or otherwise using Python 3.3.2, Licensee agrees to be bound by the terms and conditions of this License Agreement. |
37 | |
38 | === modified file 'configglue/__init__.py' |
39 | --- configglue/__init__.py 2013-07-08 20:57:17 +0000 |
40 | +++ configglue/__init__.py 2013-07-11 19:08:28 +0000 |
41 | @@ -4,7 +4,7 @@ |
42 | # |
43 | # A library for simple, DRY configuration of applications |
44 | # |
45 | -# (C) 2009--2011 by Canonical Ltd. |
46 | +# (C) 2009--2013 by Canonical Ltd. |
47 | # by John R. Lenton <john.lenton@canonical.com> |
48 | # and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
49 | # |
50 | |
51 | === modified file 'configglue/_compat.py' |
52 | --- configglue/_compat.py 2013-05-27 00:56:38 +0000 |
53 | +++ configglue/_compat.py 2013-07-11 19:08:28 +0000 |
54 | @@ -1,15 +1,137 @@ |
55 | +# -*- coding: utf-8 -*- |
56 | +############################################################################### |
57 | +# |
58 | +# configglue -- glue for your apps' configuration |
59 | +# |
60 | +# A library for simple, DRY configuration of applications |
61 | +# |
62 | +# (C) 2013 by Canonical Ltd. |
63 | +# by John R. Lenton <john.lenton@canonical.com> |
64 | +# and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
65 | +# (C) Python Software Foundation (“PSF”) |
66 | +# |
67 | +# Released under the PSF License Agreement (see the file LICENSE.PSF) |
68 | +# |
69 | +# For bug reports, support, and new releases: http://launchpad.net/configglue |
70 | +# |
71 | +############################################################################### |
72 | +import re |
73 | import sys |
74 | |
75 | |
76 | PY2 = sys.version_info[0] == 2 |
77 | |
78 | -if not PY2: |
79 | +if PY2: |
80 | + import __builtin__ as builtins |
81 | + import ConfigParser as configparser |
82 | + from ConfigParser import ( |
83 | + DEFAULTSECT, |
84 | + InterpolationDepthError, |
85 | + InterpolationMissingOptionError, |
86 | + InterpolationSyntaxError, |
87 | + NoOptionError, |
88 | + NoSectionError, |
89 | + RawConfigParser, |
90 | + ) |
91 | + |
92 | + class BasicInterpolation(object): |
93 | + """Interpolation as implemented in the classic ConfigParser. |
94 | + |
95 | + The option values can contain format strings which refer to other |
96 | + values in the same section, or values in the special default section. |
97 | + |
98 | + For example: |
99 | + |
100 | + something: %(dir)s/whatever |
101 | + |
102 | + would resolve the "%(dir)s" to the value of dir. All reference |
103 | + expansions are done late, on demand. If a user needs to use a |
104 | + bare % in a configuration file, she can escape it by writing %%. |
105 | + Other % usage is considered a user error and |
106 | + raises `InterpolationSyntaxError'.""" |
107 | + |
108 | + _KEYCRE = re.compile(r"%\(([^)]+)\)s") |
109 | + |
110 | + def before_get(self, parser, section, option, value, defaults): |
111 | + L = [] |
112 | + self._interpolate_some(parser, option, L, value, section, |
113 | + defaults, 1) |
114 | + return ''.join(L) |
115 | + |
116 | + def before_set(self, parser, section, option, value): |
117 | + tmp_value = value.replace('%%', '') # escaped percent signs |
118 | + tmp_value = self._KEYCRE.sub('', tmp_value) # valid syntax |
119 | + if '%' in tmp_value: |
120 | + raise ValueError("invalid interpolation syntax in %r at " |
121 | + "position %d" % (value, tmp_value.find('%'))) |
122 | + return value |
123 | + |
124 | + def _interpolate_some(self, parser, option, accum, rest, section, map, |
125 | + depth): |
126 | + if depth > configparser.MAX_INTERPOLATION_DEPTH: |
127 | + raise configparser.InterpolationDepthError(option, section, |
128 | + rest) |
129 | + while rest: |
130 | + p = rest.find("%") |
131 | + if p < 0: |
132 | + accum.append(rest) |
133 | + return |
134 | + if p > 0: |
135 | + accum.append(rest[:p]) |
136 | + rest = rest[p:] |
137 | + # p is no longer used |
138 | + c = rest[1:2] |
139 | + if c == "%": |
140 | + accum.append("%") |
141 | + rest = rest[2:] |
142 | + elif c == "(": |
143 | + m = self._KEYCRE.match(rest) |
144 | + if m is None: |
145 | + raise configparser.InterpolationSyntaxError(option, |
146 | + section, |
147 | + "bad interpolation variable reference %r" % rest) |
148 | + var = parser.optionxform(m.group(1)) |
149 | + rest = rest[m.end():] |
150 | + try: |
151 | + v = map[var] |
152 | + except KeyError: |
153 | + raise configparser.InterpolationMissingOptionError( |
154 | + option, section, rest, var) |
155 | + if "%" in v: |
156 | + self._interpolate_some(parser, option, accum, v, |
157 | + section, map, depth + 1) |
158 | + else: |
159 | + accum.append(v) |
160 | + else: |
161 | + raise configparser.InterpolationSyntaxError( |
162 | + option, section, |
163 | + "'%%' must be followed by '%%' or '(', " |
164 | + "found: %r" % (rest,)) |
165 | + |
166 | + class BaseConfigParser(configparser.SafeConfigParser): |
167 | + def __init__(self, *args, **kwargs): |
168 | + configparser.SafeConfigParser.__init__(self, *args, **kwargs) |
169 | + |
170 | + self._interpolation = BasicInterpolation() |
171 | + |
172 | + text_type = unicode |
173 | + string_types = (str, unicode) |
174 | + iteritems = lambda d: d.iteritems() |
175 | + |
176 | +else: |
177 | + import builtins |
178 | + import configparser |
179 | + from configparser import ( |
180 | + DEFAULTSECT, |
181 | + InterpolationDepthError, |
182 | + InterpolationMissingOptionError, |
183 | + InterpolationSyntaxError, |
184 | + NoOptionError, |
185 | + NoSectionError, |
186 | + RawConfigParser, |
187 | + ) |
188 | + |
189 | + BaseConfigParser = configparser.SafeConfigParser |
190 | text_type = str |
191 | string_types = (str,) |
192 | - import builtins |
193 | iteritems = lambda d: iter(d.items()) |
194 | -else: |
195 | - text_type = unicode |
196 | - string_types = (str, unicode) |
197 | - import __builtin__ as builtins |
198 | - iteritems = lambda d: d.iteritems() |
199 | |
200 | === modified file 'configglue/app/__init__.py' |
201 | --- configglue/app/__init__.py 2011-07-17 22:32:16 +0000 |
202 | +++ configglue/app/__init__.py 2013-07-11 19:08:28 +0000 |
203 | @@ -4,7 +4,7 @@ |
204 | # |
205 | # A library for simple, DRY configuration of applications |
206 | # |
207 | -# (C) 2009--2011 by Canonical Ltd. |
208 | +# (C) 2009--2013 by Canonical Ltd. |
209 | # by John R. Lenton <john.lenton@canonical.com> |
210 | # and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
211 | # |
212 | |
213 | === modified file 'configglue/app/base.py' |
214 | --- configglue/app/base.py 2011-07-23 20:26:54 +0000 |
215 | +++ configglue/app/base.py 2013-07-11 19:08:28 +0000 |
216 | @@ -4,7 +4,7 @@ |
217 | # |
218 | # A library for simple, DRY configuration of applications |
219 | # |
220 | -# (C) 2009--2011 by Canonical Ltd. |
221 | +# (C) 2009--2013 by Canonical Ltd. |
222 | # by John R. Lenton <john.lenton@canonical.com> |
223 | # and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
224 | # |
225 | |
226 | === modified file 'configglue/app/plugin.py' |
227 | --- configglue/app/plugin.py 2011-07-17 22:32:16 +0000 |
228 | +++ configglue/app/plugin.py 2013-07-11 19:08:28 +0000 |
229 | @@ -4,7 +4,7 @@ |
230 | # |
231 | # A library for simple, DRY configuration of applications |
232 | # |
233 | -# (C) 2009--2011 by Canonical Ltd. |
234 | +# (C) 2009--2013 by Canonical Ltd. |
235 | # by John R. Lenton <john.lenton@canonical.com> |
236 | # and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
237 | # |
238 | |
239 | === modified file 'configglue/contrib/__init__.py' |
240 | --- configglue/contrib/__init__.py 2012-04-24 15:58:44 +0000 |
241 | +++ configglue/contrib/__init__.py 2013-07-11 19:08:28 +0000 |
242 | @@ -4,7 +4,7 @@ |
243 | # |
244 | # A library for simple, DRY configuration of applications |
245 | # |
246 | -# (C) 2009--2012 by Canonical Ltd. |
247 | +# (C) 2009--2013 by Canonical Ltd. |
248 | # by John R. Lenton <john.lenton@canonical.com> |
249 | # and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
250 | # |
251 | |
252 | === modified file 'configglue/contrib/schema/__init__.py' |
253 | --- configglue/contrib/schema/__init__.py 2012-05-04 19:22:39 +0000 |
254 | +++ configglue/contrib/schema/__init__.py 2013-07-11 19:08:28 +0000 |
255 | @@ -4,7 +4,7 @@ |
256 | # |
257 | # A library for simple, DRY configuration of applications |
258 | # |
259 | -# (C) 2009--2012 by Canonical Ltd. |
260 | +# (C) 2009--2013 by Canonical Ltd. |
261 | # by John R. Lenton <john.lenton@canonical.com> |
262 | # and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
263 | # |
264 | |
265 | === modified file 'configglue/contrib/schema/devserver.py' |
266 | --- configglue/contrib/schema/devserver.py 2012-04-24 15:58:44 +0000 |
267 | +++ configglue/contrib/schema/devserver.py 2013-07-11 19:08:28 +0000 |
268 | @@ -1,3 +1,18 @@ |
269 | +############################################################################### |
270 | +# |
271 | +# configglue -- glue for your apps' configuration |
272 | +# |
273 | +# A library for simple, DRY configuration of applications |
274 | +# |
275 | +# (C) 2009--2013 by Canonical Ltd. |
276 | +# by John R. Lenton <john.lenton@canonical.com> |
277 | +# and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
278 | +# |
279 | +# Released under the BSD License (see the file LICENSE) |
280 | +# |
281 | +# For bug reports, support, and new releases: http://launchpad.net/configglue |
282 | +# |
283 | +############################################################################### |
284 | from configglue.schema import ( |
285 | BoolOption, |
286 | IntOption, |
287 | |
288 | === modified file 'configglue/contrib/schema/django_jenkins.py' |
289 | --- configglue/contrib/schema/django_jenkins.py 2012-04-24 15:58:44 +0000 |
290 | +++ configglue/contrib/schema/django_jenkins.py 2013-07-11 19:08:28 +0000 |
291 | @@ -1,3 +1,18 @@ |
292 | +############################################################################### |
293 | +# |
294 | +# configglue -- glue for your apps' configuration |
295 | +# |
296 | +# A library for simple, DRY configuration of applications |
297 | +# |
298 | +# (C) 2009--2013 by Canonical Ltd. |
299 | +# by John R. Lenton <john.lenton@canonical.com> |
300 | +# and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
301 | +# |
302 | +# Released under the BSD License (see the file LICENSE) |
303 | +# |
304 | +# For bug reports, support, and new releases: http://launchpad.net/configglue |
305 | +# |
306 | +############################################################################### |
307 | from configglue.schema import ( |
308 | ListOption, |
309 | Schema, |
310 | |
311 | === modified file 'configglue/contrib/schema/django_openid_auth.py' |
312 | --- configglue/contrib/schema/django_openid_auth.py 2013-05-30 19:41:51 +0000 |
313 | +++ configglue/contrib/schema/django_openid_auth.py 2013-07-11 19:08:28 +0000 |
314 | @@ -1,3 +1,18 @@ |
315 | +############################################################################### |
316 | +# |
317 | +# configglue -- glue for your apps' configuration |
318 | +# |
319 | +# A library for simple, DRY configuration of applications |
320 | +# |
321 | +# (C) 2009--2013 by Canonical Ltd. |
322 | +# by John R. Lenton <john.lenton@canonical.com> |
323 | +# and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
324 | +# |
325 | +# Released under the BSD License (see the file LICENSE) |
326 | +# |
327 | +# For bug reports, support, and new releases: http://launchpad.net/configglue |
328 | +# |
329 | +############################################################################### |
330 | from configglue.schema import ( |
331 | BoolOption, |
332 | DictOption, |
333 | |
334 | === modified file 'configglue/contrib/schema/nexus.py' |
335 | --- configglue/contrib/schema/nexus.py 2012-04-24 15:58:44 +0000 |
336 | +++ configglue/contrib/schema/nexus.py 2013-07-11 19:08:28 +0000 |
337 | @@ -1,3 +1,18 @@ |
338 | +############################################################################### |
339 | +# |
340 | +# configglue -- glue for your apps' configuration |
341 | +# |
342 | +# A library for simple, DRY configuration of applications |
343 | +# |
344 | +# (C) 2009--2013 by Canonical Ltd. |
345 | +# by John R. Lenton <john.lenton@canonical.com> |
346 | +# and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
347 | +# |
348 | +# Released under the BSD License (see the file LICENSE) |
349 | +# |
350 | +# For bug reports, support, and new releases: http://launchpad.net/configglue |
351 | +# |
352 | +############################################################################### |
353 | from configglue.schema import BoolOption, Schema, Section, StringOption |
354 | |
355 | |
356 | |
357 | === modified file 'configglue/contrib/schema/preflight.py' |
358 | --- configglue/contrib/schema/preflight.py 2012-04-24 15:58:44 +0000 |
359 | +++ configglue/contrib/schema/preflight.py 2013-07-11 19:08:28 +0000 |
360 | @@ -1,3 +1,18 @@ |
361 | +############################################################################### |
362 | +# |
363 | +# configglue -- glue for your apps' configuration |
364 | +# |
365 | +# A library for simple, DRY configuration of applications |
366 | +# |
367 | +# (C) 2009--2013 by Canonical Ltd. |
368 | +# by John R. Lenton <john.lenton@canonical.com> |
369 | +# and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
370 | +# |
371 | +# Released under the BSD License (see the file LICENSE) |
372 | +# |
373 | +# For bug reports, support, and new releases: http://launchpad.net/configglue |
374 | +# |
375 | +############################################################################### |
376 | from configglue.schema import Section, Schema, StringOption |
377 | |
378 | |
379 | |
380 | === modified file 'configglue/contrib/schema/pystatsd.py' |
381 | --- configglue/contrib/schema/pystatsd.py 2012-05-10 12:45:19 +0000 |
382 | +++ configglue/contrib/schema/pystatsd.py 2013-07-11 19:08:28 +0000 |
383 | @@ -1,3 +1,18 @@ |
384 | +############################################################################### |
385 | +# |
386 | +# configglue -- glue for your apps' configuration |
387 | +# |
388 | +# A library for simple, DRY configuration of applications |
389 | +# |
390 | +# (C) 2009--2013 by Canonical Ltd. |
391 | +# by John R. Lenton <john.lenton@canonical.com> |
392 | +# and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
393 | +# |
394 | +# Released under the BSD License (see the file LICENSE) |
395 | +# |
396 | +# For bug reports, support, and new releases: http://launchpad.net/configglue |
397 | +# |
398 | +############################################################################### |
399 | from configglue.schema import IntOption, Schema, Section, StringOption |
400 | |
401 | |
402 | |
403 | === modified file 'configglue/contrib/schema/raven.py' |
404 | --- configglue/contrib/schema/raven.py 2012-04-24 18:17:41 +0000 |
405 | +++ configglue/contrib/schema/raven.py 2013-07-11 19:08:28 +0000 |
406 | @@ -1,3 +1,18 @@ |
407 | +############################################################################### |
408 | +# |
409 | +# configglue -- glue for your apps' configuration |
410 | +# |
411 | +# A library for simple, DRY configuration of applications |
412 | +# |
413 | +# (C) 2009--2013 by Canonical Ltd. |
414 | +# by John R. Lenton <john.lenton@canonical.com> |
415 | +# and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
416 | +# |
417 | +# Released under the BSD License (see the file LICENSE) |
418 | +# |
419 | +# For bug reports, support, and new releases: http://launchpad.net/configglue |
420 | +# |
421 | +############################################################################### |
422 | from configglue.schema import ( |
423 | BoolOption, |
424 | IntOption, |
425 | |
426 | === modified file 'configglue/contrib/schema/saml2idp.py' |
427 | --- configglue/contrib/schema/saml2idp.py 2012-04-24 15:58:44 +0000 |
428 | +++ configglue/contrib/schema/saml2idp.py 2013-07-11 19:08:28 +0000 |
429 | @@ -1,3 +1,18 @@ |
430 | +############################################################################### |
431 | +# |
432 | +# configglue -- glue for your apps' configuration |
433 | +# |
434 | +# A library for simple, DRY configuration of applications |
435 | +# |
436 | +# (C) 2009--2013 by Canonical Ltd. |
437 | +# by John R. Lenton <john.lenton@canonical.com> |
438 | +# and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
439 | +# |
440 | +# Released under the BSD License (see the file LICENSE) |
441 | +# |
442 | +# For bug reports, support, and new releases: http://launchpad.net/configglue |
443 | +# |
444 | +############################################################################### |
445 | from configglue.schema import ( |
446 | BoolOption, |
447 | ListOption, |
448 | |
449 | === modified file 'configglue/glue.py' |
450 | --- configglue/glue.py 2013-05-25 15:21:04 +0000 |
451 | +++ configglue/glue.py 2013-07-11 19:08:28 +0000 |
452 | @@ -4,7 +4,7 @@ |
453 | # |
454 | # A library for simple, DRY configuration of applications |
455 | # |
456 | -# (C) 2009--2011 by Canonical Ltd. |
457 | +# (C) 2009--2013 by Canonical Ltd. |
458 | # by John R. Lenton <john.lenton@canonical.com> |
459 | # and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
460 | # |
461 | @@ -16,13 +16,10 @@ |
462 | |
463 | import os |
464 | import sys |
465 | -from configparser import ( |
466 | - NoOptionError, |
467 | - NoSectionError, |
468 | -) |
469 | from optparse import OptionParser |
470 | from collections import namedtuple |
471 | |
472 | +from ._compat import NoSectionError, NoOptionError |
473 | from .parser import SchemaConfigParser |
474 | |
475 | |
476 | |
477 | === modified file 'configglue/inischema/__init__.py' |
478 | --- configglue/inischema/__init__.py 2011-07-17 22:32:16 +0000 |
479 | +++ configglue/inischema/__init__.py 2013-07-11 19:08:28 +0000 |
480 | @@ -4,7 +4,7 @@ |
481 | # |
482 | # A library for simple, DRY configuration of applications |
483 | # |
484 | -# (C) 2009--2011 by Canonical Ltd. |
485 | +# (C) 2009--2013 by Canonical Ltd. |
486 | # by John R. Lenton <john.lenton@canonical.com> |
487 | # and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
488 | # |
489 | |
490 | === modified file 'configglue/inischema/attributed.py' |
491 | --- configglue/inischema/attributed.py 2013-05-26 15:07:30 +0000 |
492 | +++ configglue/inischema/attributed.py 2013-07-11 19:08:28 +0000 |
493 | @@ -4,7 +4,7 @@ |
494 | # |
495 | # A library for simple, DRY configuration of applications |
496 | # |
497 | -# (C) 2009--2011 by Canonical Ltd. |
498 | +# (C) 2009--2013 by Canonical Ltd. |
499 | # by John R. Lenton <john.lenton@canonical.com> |
500 | # and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
501 | # |
502 | @@ -18,7 +18,8 @@ |
503 | AttributtedConfigParser lives here. |
504 | """ |
505 | import re |
506 | -from configparser import RawConfigParser |
507 | + |
508 | +from configglue._compat import RawConfigParser |
509 | |
510 | |
511 | marker = object() |
512 | |
513 | === modified file 'configglue/inischema/glue.py' |
514 | --- configglue/inischema/glue.py 2013-05-26 15:49:00 +0000 |
515 | +++ configglue/inischema/glue.py 2013-07-11 19:08:28 +0000 |
516 | @@ -4,7 +4,7 @@ |
517 | # |
518 | # A library for simple, DRY configuration of applications |
519 | # |
520 | -# (C) 2009--2011 by Canonical Ltd. |
521 | +# (C) 2009--2013 by Canonical Ltd. |
522 | # by John R. Lenton <john.lenton@canonical.com> |
523 | # and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
524 | # |
525 | |
526 | === modified file 'configglue/inischema/parsers.py' |
527 | --- configglue/inischema/parsers.py 2011-07-17 22:32:16 +0000 |
528 | +++ configglue/inischema/parsers.py 2013-07-11 19:08:28 +0000 |
529 | @@ -4,7 +4,7 @@ |
530 | # |
531 | # A library for simple, DRY configuration of applications |
532 | # |
533 | -# (C) 2009--2011 by Canonical Ltd. |
534 | +# (C) 2009--2013 by Canonical Ltd. |
535 | # by John R. Lenton <john.lenton@canonical.com> |
536 | # and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
537 | # |
538 | |
539 | === modified file 'configglue/inischema/typed.py' |
540 | --- configglue/inischema/typed.py 2013-05-26 15:48:10 +0000 |
541 | +++ configglue/inischema/typed.py 2013-07-11 19:08:28 +0000 |
542 | @@ -4,7 +4,7 @@ |
543 | # |
544 | # A library for simple, DRY configuration of applications |
545 | # |
546 | -# (C) 2009--2011 by Canonical Ltd. |
547 | +# (C) 2009--2013 by Canonical Ltd. |
548 | # by John R. Lenton <john.lenton@canonical.com> |
549 | # and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
550 | # |
551 | |
552 | === modified file 'configglue/parser.py' |
553 | --- configglue/parser.py 2013-07-08 20:10:06 +0000 |
554 | +++ configglue/parser.py 2013-07-11 19:08:28 +0000 |
555 | @@ -4,7 +4,7 @@ |
556 | # |
557 | # A library for simple, DRY configuration of applications |
558 | # |
559 | -# (C) 2009--2011 by Canonical Ltd. |
560 | +# (C) 2009--2013 by Canonical Ltd. |
561 | # by John R. Lenton <john.lenton@canonical.com> |
562 | # and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
563 | # |
564 | @@ -21,16 +21,15 @@ |
565 | import os |
566 | import re |
567 | |
568 | -from configparser import ( |
569 | +from functools import reduce |
570 | + |
571 | +from ._compat import BaseConfigParser, text_type, string_types |
572 | +from ._compat import ( |
573 | DEFAULTSECT, |
574 | - SafeConfigParser as BaseConfigParser, |
575 | InterpolationMissingOptionError, |
576 | NoOptionError, |
577 | NoSectionError, |
578 | ) |
579 | -from functools import reduce |
580 | - |
581 | -from configglue._compat import text_type, string_types |
582 | |
583 | |
584 | __all__ = [ |
585 | @@ -77,8 +76,6 @@ |
586 | self._basedir = '' |
587 | self._dirty = collections.defaultdict( |
588 | lambda: collections.defaultdict(dict)) |
589 | - # map to location in configparser |
590 | - self._KEYCRE = self._interpolation._KEYCRE |
591 | |
592 | def is_valid(self, report=False): |
593 | """Return if the state of the parser is valid. |
594 | @@ -386,7 +383,7 @@ |
595 | keys = [self._extract_interpolation_keys(x) for x in item] |
596 | keys = reduce(set.union, keys, set()) |
597 | else: |
598 | - keys = set(self._KEYCRE.findall(item)) |
599 | + keys = set(self._interpolation._KEYCRE.findall(item)) |
600 | # remove invalid key |
601 | if '' in keys: |
602 | keys.remove('') |
603 | |
604 | === modified file 'configglue/schema.py' |
605 | --- configglue/schema.py 2013-05-26 19:07:46 +0000 |
606 | +++ configglue/schema.py 2013-07-11 19:08:28 +0000 |
607 | @@ -4,7 +4,7 @@ |
608 | # |
609 | # A library for simple, DRY configuration of applications |
610 | # |
611 | -# (C) 2009--2011 by Canonical Ltd. |
612 | +# (C) 2009--2013 by Canonical Ltd. |
613 | # by John R. Lenton <john.lenton@canonical.com> |
614 | # and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
615 | # |
616 | @@ -16,14 +16,12 @@ |
617 | from __future__ import unicode_literals |
618 | |
619 | import json |
620 | -from configparser import ( |
621 | - NoSectionError, |
622 | - NoOptionError, |
623 | -) |
624 | from copy import deepcopy |
625 | from inspect import getmembers |
626 | |
627 | -from configglue._compat import text_type, string_types |
628 | +from ._compat import text_type, string_types |
629 | +from ._compat import NoSectionError, NoOptionError |
630 | + |
631 | |
632 | |
633 | __all__ = [ |
634 | |
635 | === modified file 'configglue/tests/__init__.py' |
636 | --- configglue/tests/__init__.py 2011-07-17 22:32:16 +0000 |
637 | +++ configglue/tests/__init__.py 2013-07-11 19:08:28 +0000 |
638 | @@ -4,7 +4,7 @@ |
639 | # |
640 | # A library for simple, DRY configuration of applications |
641 | # |
642 | -# (C) 2009--2011 by Canonical Ltd. |
643 | +# (C) 2009--2013 by Canonical Ltd. |
644 | # by John R. Lenton <john.lenton@canonical.com> |
645 | # and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
646 | # |
647 | |
648 | === modified file 'configglue/tests/app/test_base.py' |
649 | --- configglue/tests/app/test_base.py 2013-05-26 16:20:41 +0000 |
650 | +++ configglue/tests/app/test_base.py 2013-07-11 19:08:28 +0000 |
651 | @@ -4,7 +4,7 @@ |
652 | # |
653 | # A library for simple, DRY configuration of applications |
654 | # |
655 | -# (C) 2009--2011 by Canonical Ltd. |
656 | +# (C) 2009--2013 by Canonical Ltd. |
657 | # by John R. Lenton <john.lenton@canonical.com> |
658 | # and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
659 | # |
660 | |
661 | === modified file 'configglue/tests/app/test_plugin.py' |
662 | --- configglue/tests/app/test_plugin.py 2011-07-17 22:32:16 +0000 |
663 | +++ configglue/tests/app/test_plugin.py 2013-07-11 19:08:28 +0000 |
664 | @@ -4,7 +4,7 @@ |
665 | # |
666 | # A library for simple, DRY configuration of applications |
667 | # |
668 | -# (C) 2009--2011 by Canonical Ltd. |
669 | +# (C) 2009--2013 by Canonical Ltd. |
670 | # by John R. Lenton <john.lenton@canonical.com> |
671 | # and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
672 | # |
673 | |
674 | === modified file 'configglue/tests/inischema/__init__.py' |
675 | --- configglue/tests/inischema/__init__.py 2011-07-17 22:32:16 +0000 |
676 | +++ configglue/tests/inischema/__init__.py 2013-07-11 19:08:28 +0000 |
677 | @@ -4,7 +4,7 @@ |
678 | # |
679 | # A library for simple, DRY configuration of applications |
680 | # |
681 | -# (C) 2009--2011 by Canonical Ltd. |
682 | +# (C) 2009--2013 by Canonical Ltd. |
683 | # by John R. Lenton <john.lenton@canonical.com> |
684 | # and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
685 | # |
686 | |
687 | === modified file 'configglue/tests/inischema/test_attributed.py' |
688 | --- configglue/tests/inischema/test_attributed.py 2013-05-26 16:15:48 +0000 |
689 | +++ configglue/tests/inischema/test_attributed.py 2013-07-11 19:08:28 +0000 |
690 | @@ -4,7 +4,7 @@ |
691 | # |
692 | # A library for simple, DRY configuration of applications |
693 | # |
694 | -# (C) 2009--2011 by Canonical Ltd. |
695 | +# (C) 2009--2013 by Canonical Ltd. |
696 | # by John R. Lenton <john.lenton@canonical.com> |
697 | # and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
698 | # |
699 | @@ -19,9 +19,9 @@ |
700 | # runner's output, so pylint: disable-msg=C0111 |
701 | |
702 | import unittest |
703 | -from configparser import RawConfigParser |
704 | from io import StringIO |
705 | |
706 | +from configglue._compat import RawConfigParser |
707 | from configglue.inischema.attributed import AttributedConfigParser |
708 | |
709 | |
710 | |
711 | === modified file 'configglue/tests/inischema/test_glue.py' |
712 | --- configglue/tests/inischema/test_glue.py 2013-05-26 19:07:46 +0000 |
713 | +++ configglue/tests/inischema/test_glue.py 2013-07-11 19:08:28 +0000 |
714 | @@ -4,7 +4,7 @@ |
715 | # |
716 | # A library for simple, DRY configuration of applications |
717 | # |
718 | -# (C) 2009--2011 by Canonical Ltd. |
719 | +# (C) 2009--2013 by Canonical Ltd. |
720 | # by John R. Lenton <john.lenton@canonical.com> |
721 | # and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
722 | # |
723 | |
724 | === modified file 'configglue/tests/inischema/test_glue2glue.py' |
725 | --- configglue/tests/inischema/test_glue2glue.py 2013-05-26 16:15:48 +0000 |
726 | +++ configglue/tests/inischema/test_glue2glue.py 2013-07-11 19:08:28 +0000 |
727 | @@ -5,7 +5,7 @@ |
728 | # |
729 | # A library for simple, DRY configuration of applications |
730 | # |
731 | -# (C) 2009--2011 by Canonical Ltd. |
732 | +# (C) 2009--2013 by Canonical Ltd. |
733 | # by John R. Lenton <john.lenton@canonical.com> |
734 | # and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
735 | # |
736 | |
737 | === modified file 'configglue/tests/inischema/test_parsers.py' |
738 | --- configglue/tests/inischema/test_parsers.py 2011-07-17 22:32:16 +0000 |
739 | +++ configglue/tests/inischema/test_parsers.py 2013-07-11 19:08:28 +0000 |
740 | @@ -4,7 +4,7 @@ |
741 | # |
742 | # A library for simple, DRY configuration of applications |
743 | # |
744 | -# (C) 2009--2011 by Canonical Ltd. |
745 | +# (C) 2009--2013 by Canonical Ltd. |
746 | # by John R. Lenton <john.lenton@canonical.com> |
747 | # and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
748 | # |
749 | |
750 | === modified file 'configglue/tests/inischema/test_typed.py' |
751 | --- configglue/tests/inischema/test_typed.py 2013-05-26 16:15:48 +0000 |
752 | +++ configglue/tests/inischema/test_typed.py 2013-07-11 19:08:28 +0000 |
753 | @@ -5,7 +5,7 @@ |
754 | # |
755 | # A library for simple, DRY configuration of applications |
756 | # |
757 | -# (C) 2009--2011 by Canonical Ltd. |
758 | +# (C) 2009--2013 by Canonical Ltd. |
759 | # by John R. Lenton <john.lenton@canonical.com> |
760 | # and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
761 | # |
762 | @@ -21,8 +21,8 @@ |
763 | |
764 | import unittest |
765 | from io import StringIO |
766 | -from configparser import RawConfigParser |
767 | |
768 | +from configglue._compat import RawConfigParser |
769 | from configglue.inischema.typed import TypedConfigParser |
770 | |
771 | |
772 | |
773 | === modified file 'configglue/tests/test_contrib_schema.py' |
774 | --- configglue/tests/test_contrib_schema.py 2013-05-30 19:48:15 +0000 |
775 | +++ configglue/tests/test_contrib_schema.py 2013-07-11 19:08:28 +0000 |
776 | @@ -1,3 +1,18 @@ |
777 | +############################################################################### |
778 | +# |
779 | +# configglue -- glue for your apps' configuration |
780 | +# |
781 | +# A library for simple, DRY configuration of applications |
782 | +# |
783 | +# (C) 2009--2013 by Canonical Ltd. |
784 | +# by John R. Lenton <john.lenton@canonical.com> |
785 | +# and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
786 | +# |
787 | +# Released under the BSD License (see the file LICENSE) |
788 | +# |
789 | +# For bug reports, support, and new releases: http://launchpad.net/configglue |
790 | +# |
791 | +############################################################################### |
792 | from unittest import TestCase |
793 | |
794 | from configglue.schema import ListOption, StringOption |
795 | |
796 | === modified file 'configglue/tests/test_parser.py' |
797 | --- configglue/tests/test_parser.py 2013-07-08 20:10:06 +0000 |
798 | +++ configglue/tests/test_parser.py 2013-07-11 19:08:28 +0000 |
799 | @@ -5,7 +5,7 @@ |
800 | # |
801 | # A library for simple, DRY configuration of applications |
802 | # |
803 | -# (C) 2009--2011 by Canonical Ltd. |
804 | +# (C) 2009--2013 by Canonical Ltd. |
805 | # by John R. Lenton <john.lenton@canonical.com> |
806 | # and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
807 | # |
808 | @@ -22,13 +22,6 @@ |
809 | import tempfile |
810 | import textwrap |
811 | import unittest |
812 | -from configparser import ( |
813 | - DEFAULTSECT, |
814 | - InterpolationDepthError, |
815 | - InterpolationMissingOptionError, |
816 | - InterpolationSyntaxError, |
817 | - NoSectionError, |
818 | -) |
819 | from io import BytesIO |
820 | |
821 | from mock import ( |
822 | @@ -38,9 +31,16 @@ |
823 | ) |
824 | |
825 | from configglue._compat import iteritems |
826 | +from configglue._compat import ( |
827 | + DEFAULTSECT, |
828 | + InterpolationDepthError, |
829 | + InterpolationMissingOptionError, |
830 | + InterpolationSyntaxError, |
831 | + NoOptionError, |
832 | + NoSectionError, |
833 | +) |
834 | from configglue.parser import ( |
835 | CONFIG_FILE_ENCODING, |
836 | - NoOptionError, |
837 | SchemaConfigParser, |
838 | SchemaValidationError, |
839 | ) |
840 | @@ -248,8 +248,8 @@ |
841 | rawval = '%(bar)' |
842 | vars = {'foo': '%(bar)s', 'bar': 'pepe'} |
843 | parser = SchemaConfigParser(MySchema()) |
844 | - self.assertRaises(InterpolationSyntaxError, parser._interpolate, |
845 | - section, option, rawval, vars) |
846 | + self.assertRaises(InterpolationSyntaxError, |
847 | + parser._interpolate, section, option, rawval, vars) |
848 | |
849 | def test_interpolate_across_sections(self): |
850 | """Test interpolation across sections.""" |
851 | @@ -278,8 +278,8 @@ |
852 | config = BytesIO(b"[foo]\nbar=%(wham)s\n[baz]\nwham=42") |
853 | parser = SchemaConfigParser(MySchema()) |
854 | parser.readfp(config) |
855 | - self.assertRaises(InterpolationMissingOptionError, parser.get, |
856 | - 'foo', 'bar') |
857 | + self.assertRaises(InterpolationMissingOptionError, |
858 | + parser.get, 'foo', 'bar') |
859 | |
860 | @patch('configglue.parser.os') |
861 | def test_interpolate_environment_basic_syntax(self, mock_os): |
862 | @@ -592,7 +592,8 @@ |
863 | self.assertEqual(set(items), set([('foo', 'bar')])) |
864 | |
865 | def test_items_no_section(self): |
866 | - self.assertRaises(NoSectionError, self.parser.items, '__main__') |
867 | + self.assertRaises(NoSectionError, self.parser.items, |
868 | + '__main__') |
869 | |
870 | def test_items_raw(self): |
871 | config = BytesIO(b'[__main__]\nfoo=%(baz)s') |
872 | @@ -624,8 +625,8 @@ |
873 | def test_items_interpolate_error(self): |
874 | config = BytesIO(b'[__main__]\nfoo=%(bar)s') |
875 | self.parser.readfp(config) |
876 | - self.assertRaises(InterpolationMissingOptionError, self.parser.items, |
877 | - '__main__') |
878 | + self.assertRaises(InterpolationMissingOptionError, |
879 | + self.parser.items, '__main__') |
880 | |
881 | def test_values_empty_parser(self): |
882 | values = self.parser.values() |
883 | @@ -820,12 +821,12 @@ |
884 | self.assertEqual(default, expected) |
885 | |
886 | def test_get_default_no_option(self): |
887 | - self.assertRaises(NoOptionError, self.parser._get_default, |
888 | - '__main__', 'bar') |
889 | + self.assertRaises(NoOptionError, |
890 | + self.parser._get_default, '__main__', 'bar') |
891 | |
892 | def test_get_default_no_section(self): |
893 | - self.assertRaises(NoSectionError, self.parser._get_default, |
894 | - 'foo', 'bar') |
895 | + self.assertRaises(NoSectionError, |
896 | + self.parser._get_default, 'foo', 'bar') |
897 | |
898 | def test_multi_file_dict_config(self): |
899 | """Test parsing a dict option spanning multiple files.""" |
900 | |
901 | === modified file 'configglue/tests/test_schema.py' |
902 | --- configglue/tests/test_schema.py 2013-05-31 15:26:42 +0000 |
903 | +++ configglue/tests/test_schema.py 2013-07-11 19:08:28 +0000 |
904 | @@ -5,7 +5,7 @@ |
905 | # |
906 | # A library for simple, DRY configuration of applications |
907 | # |
908 | -# (C) 2009--2011 by Canonical Ltd. |
909 | +# (C) 2009--2013 by Canonical Ltd. |
910 | # by John R. Lenton <john.lenton@canonical.com> |
911 | # and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
912 | # |
913 | @@ -18,13 +18,10 @@ |
914 | |
915 | import textwrap |
916 | import unittest |
917 | -from configparser import ( |
918 | - NoOptionError, |
919 | - NoSectionError, |
920 | -) |
921 | from io import BytesIO |
922 | |
923 | from configglue._compat import text_type |
924 | +from configglue._compat import NoOptionError, NoSectionError |
925 | from configglue.parser import ( |
926 | SchemaConfigParser, |
927 | SchemaValidationError, |
928 | |
929 | === modified file 'configglue/tests/test_schemaconfig.py' |
930 | --- configglue/tests/test_schemaconfig.py 2013-05-26 19:07:46 +0000 |
931 | +++ configglue/tests/test_schemaconfig.py 2013-07-11 19:08:28 +0000 |
932 | @@ -5,7 +5,7 @@ |
933 | # |
934 | # A library for simple, DRY configuration of applications |
935 | # |
936 | -# (C) 2009--2011 by Canonical Ltd. |
937 | +# (C) 2009--2013 by Canonical Ltd. |
938 | # by John R. Lenton <john.lenton@canonical.com> |
939 | # and Ricardo Kirkner <ricardo.kirkner@canonical.com> |
940 | # |
941 | @@ -31,14 +31,12 @@ |
942 | ) |
943 | |
944 | from configglue._compat import PY2 |
945 | +from configglue._compat import NoSectionError |
946 | from configglue.glue import ( |
947 | configglue, |
948 | schemaconfigglue, |
949 | ) |
950 | -from configglue.parser import ( |
951 | - NoSectionError, |
952 | - SchemaConfigParser, |
953 | -) |
954 | +from configglue.parser import SchemaConfigParser |
955 | from configglue.schema import ( |
956 | DictOption, |
957 | IntOption, |
958 | |
959 | === removed directory 'debian' |
960 | === removed file 'debian/changelog' |
961 | --- debian/changelog 2012-05-10 12:46:50 +0000 |
962 | +++ debian/changelog 1970-01-01 00:00:00 +0000 |
963 | @@ -1,122 +0,0 @@ |
964 | -python-configglue (1.0.3-0ubuntu2) precise; urgency=low |
965 | - |
966 | - * fixed missing renames |
967 | - |
968 | - -- Ricardo Kirkner <ricardo.kirkner@canonical.com> Thu, 10 May 2012 12:46:25 +0000 |
969 | - |
970 | -python-configglue (1.0.3-0ubuntu1) precise; urgency=low |
971 | - |
972 | - * Provide contributed schemas for applications not providing their own schema |
973 | - |
974 | - -- Ricardo Kirkner <ricardo.kirkner@canonical.com> Thu, 10 May 2012 12:27:19 +0000 |
975 | - |
976 | -python-configglue (1.0.1-0ubuntu1) oneiric; urgency=low |
977 | - |
978 | - [Ricardo Kirkner] |
979 | - * updated version for release |
980 | - * support python %(name)s string formatting syntax |
981 | - * some final improvements to the docs |
982 | - * updated docs for the 1.0 release |
983 | - * add support to ListOption to parse json |
984 | - * some small improvements |
985 | - * allow DictOption to be specified in the config using json |
986 | - * log a WARNING when a file could not be read |
987 | - * Better error handling and reporting during configuration validation |
988 | - * simplified option precedence |
989 | - * allow to override App's default option parser |
990 | - * improved equality checks on Option subclasses |
991 | - * added --validate option to App base class to enable config validation |
992 | - * handle different mock versions for backwards compatibility |
993 | - * include testing dependencies as build dependencies |
994 | - * run tests during package build |
995 | - * fixed bug due to incorrect handling of option override precedence when an option is marked as fatal. |
996 | - * Preparing for the 1.0 release. |
997 | - * removed deprecated classes and deprecation warnings |
998 | - * Move configglue.pyschema into configglue to simplify the namespace. |
999 | - * removed dependency on python-xdgapp |
1000 | - * added .tox folder to ignore list |
1001 | - |
1002 | - -- Ricardo Kirkner <ricardo.kirkner@canonical.com> Thu, 05 Jan 2012 13:43:07 -0300 |
1003 | - |
1004 | -python-configglue (0.11.1-0ubuntu1) natty; urgency=low |
1005 | - |
1006 | - [Ricardo Kirkner] |
1007 | - * Bug (LP: #733977) support custom names for schema options in optparse |
1008 | - * updated documentation |
1009 | - * added docs building to the set of tests run by tox |
1010 | - * fix bug with parsing extra sections for DictOption and ListOption |
1011 | - |
1012 | - -- Ricardo Kirkner <ricardo.kirkner@canonical.com> Sat, 09 Jul 2011 18:01:46 -0300 |
1013 | - |
1014 | -python-configglue (0.11-0ubuntu1) natty; urgency=low |
1015 | - |
1016 | - [Ricardo Kirkner] |
1017 | - * applied pep8 and pyflakes cleanups |
1018 | - * various smaller bug fixes |
1019 | - * moved tests into the configglue namespace |
1020 | - * added support for running the tests via tox |
1021 | - * added support for environment variables |
1022 | - * added basic class for simplifying creating configglue-enabled applications |
1023 | - * simplified section and option class names |
1024 | - * Bug (LP: #757955) fatal kwarg on option does not allow --help on cli for non existing config files |
1025 | - * Bug (LP: #793060) TypeError: option values must be strings |
1026 | - * Bug (LP: #753395) Update to schema definition syntax |
1027 | - |
1028 | - -- Ricardo Kirkner <ricardo.kirkner@canonical.com> Thu, 23 Jun 2011 20:44:24 -0300 |
1029 | - |
1030 | -python-configglue (0.10-0ubuntu1) maverick; urgency=low |
1031 | - |
1032 | - [Ricardo Kirkner] |
1033 | - * Override ConfigParser.write in SchemaConfigParser, to support writing non-ascii data. |
1034 | - * documentation + backwards-compatibility |
1035 | - * fixes proper schema inheritance using declarative syntax |
1036 | - * all ConfigOption classes have a name attribute |
1037 | - * Use SafeConfigParser instead of ConfigParser as this will get deprecated |
1038 | - * added debian packaging info directly into the source tree |
1039 | - * added test for regression of bug #659178 |
1040 | - |
1041 | - -- Ricardo Kirkner <ricardo.kirkner@canonical.com> Mon, 02 May 2011 16:44:35 -0300 |
1042 | - |
1043 | -python-configglue (0.9.1-0ubuntu1) maverick; urgency=low |
1044 | - |
1045 | - [Ricardo Kirkner] |
1046 | - * New upstream release. |
1047 | - - simplified setup code to get version |
1048 | - - refactored code to remove circular dependencies |
1049 | - - Simplified configglue api for a common use case. |
1050 | - - Added quickstart guide for getting started |
1051 | - |
1052 | - -- Ricardo Kirkner <ricardo.kirkner@canonical.com> Sun, 20 Feb 2011 19:06:22 -0300 |
1053 | - |
1054 | -python-configglue (0.9pre1-0ubuntu1) maverick; urgency=low |
1055 | - |
1056 | - [Rick McBride] |
1057 | - * New upstream release. Closes (LP: #616477) |
1058 | - - fixed broken tests |
1059 | - - moved existing code around |
1060 | - - initial import of configglue.pyschema (from schemaconfig) |
1061 | - - merged changes from Ricardo Kirkner |
1062 | - - unified the © headers |
1063 | - - worked around circular import that happens when importing pyschema first |
1064 | - - schema inheritance fix |
1065 | - -added optional arguement to ini2schema for ubuntuone-client |
1066 | - |
1067 | - [Elliot Murphy] |
1068 | - * debian/control: bumped standards-version to 3.9.1 |
1069 | - |
1070 | - -- Rick McBride <rick.mcbride@canonical.com> Wed, 11 Aug 2010 16:43:35 -0400 |
1071 | - |
1072 | -python-configglue (0.2dev-0ubuntu2) karmic; urgency=low |
1073 | - |
1074 | - * debian/control: |
1075 | - + XS-Python-Version changed to >= 2.5 because of absolute imports |
1076 | - (LP: #391451) |
1077 | - |
1078 | - -- Andrew Mitchell <ajmitch@ubuntu.com> Wed, 24 Jun 2009 14:35:22 +1200 |
1079 | - |
1080 | -python-configglue (0.2dev-0ubuntu1) karmic; urgency=low |
1081 | - |
1082 | - * Initial package Closes (LP: #384830) |
1083 | - |
1084 | - -- Rick McBride <rick.mcbride@canonical.com> Mon, 15 Jun 2009 14:33:00 -0400 |
1085 | - |
1086 | |
1087 | === removed file 'debian/compat' |
1088 | --- debian/compat 2011-02-20 21:53:16 +0000 |
1089 | +++ debian/compat 1970-01-01 00:00:00 +0000 |
1090 | @@ -1,1 +0,0 @@ |
1091 | -7 |
1092 | |
1093 | === removed file 'debian/control' |
1094 | --- debian/control 2011-07-23 18:35:20 +0000 |
1095 | +++ debian/control 1970-01-01 00:00:00 +0000 |
1096 | @@ -1,24 +0,0 @@ |
1097 | -Source: python-configglue |
1098 | -Section: python |
1099 | -Priority: optional |
1100 | -Maintainer: Ubuntu MOTU Team <ubuntu-motu@lists.ubuntu.com> |
1101 | -XSBC-Original-Maintainer: Ricardo Kirkner <ricardo.kirkner@canonical.com> |
1102 | -Build-Depends: cdbs, |
1103 | - debhelper (>= 7.0.14), |
1104 | - python, |
1105 | - python-setuptools, |
1106 | - python-support, |
1107 | -# needed for building in order to run the tests |
1108 | - python-mock, |
1109 | - python-xdg |
1110 | -Standards-Version: 3.9.1 |
1111 | - |
1112 | -Package: python-configglue |
1113 | -Architecture: all |
1114 | -XB-Python-Version: ${python:Versions} |
1115 | -Depends: ${misc:Depends}, ${python:Depends}, |
1116 | - python-xdg |
1117 | -Description: Glues together optparse.OptionParser and ConfigParser.ConfigParser |
1118 | - Configglue is a library that glues together python's optparse.OptionParser |
1119 | - and ConfigParser.ConfigParser, so that the same options can be exported to a |
1120 | - configuration file and a commandline interface. |
1121 | |
1122 | === removed file 'debian/copyright' |
1123 | --- debian/copyright 2011-06-23 23:58:43 +0000 |
1124 | +++ debian/copyright 1970-01-01 00:00:00 +0000 |
1125 | @@ -1,43 +0,0 @@ |
1126 | -This package was debianized by Rick McBride <rick.mcbride@canonical.com> on |
1127 | -Fri, 20 Mar 2009 14:26:00 -0400. |
1128 | - |
1129 | -Copyright: |
1130 | - |
1131 | - Copyright (C) 2009-2011 Canonical |
1132 | - |
1133 | -License: |
1134 | - |
1135 | - Upstream Author: John R. Lenton <john lenton at canonical com> |
1136 | - Ricardo Kirkner <ricardo kirkner at canonical com> |
1137 | - Project Homepage: https://launchpad.net/configglue |
1138 | - Released under the BSD License |
1139 | - |
1140 | - Copyright (C) 2009-2011, Canonical |
1141 | - All rights reserved. |
1142 | - |
1143 | - Redistribution and use in source and binary forms, with or without |
1144 | - modification, are permitted provided that the following conditions are met: |
1145 | - |
1146 | - * Redistributions of source code must retain the above copyright notice, |
1147 | - this list of conditions and the following disclaimer. |
1148 | - * Redistributions in binary form must reproduce the above copyright |
1149 | - notice, this list of conditions and the following disclaimer in the |
1150 | - documentation and/or other materials provided with the distribution. |
1151 | - * Neither the name Canonical nor the names of its contributors may be |
1152 | - used to endorse or promote products derived from this software without |
1153 | - specific prior written permission. |
1154 | - |
1155 | - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
1156 | - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
1157 | - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
1158 | - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
1159 | - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
1160 | - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
1161 | - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
1162 | - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
1163 | - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
1164 | - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
1165 | - POSSIBILITY OF SUCH DAMAGE |
1166 | - |
1167 | - The Debian packaging is (C) 2009-2011, Canonical and is licensed under the |
1168 | - BSD license, see above. |
1169 | |
1170 | === removed file 'debian/pycompat' |
1171 | --- debian/pycompat 2011-02-20 21:53:16 +0000 |
1172 | +++ debian/pycompat 1970-01-01 00:00:00 +0000 |
1173 | @@ -1,1 +0,0 @@ |
1174 | -2 |
1175 | |
1176 | === removed file 'debian/rules' |
1177 | --- debian/rules 2011-07-23 12:15:10 +0000 |
1178 | +++ debian/rules 1970-01-01 00:00:00 +0000 |
1179 | @@ -1,8 +0,0 @@ |
1180 | -#!/usr/bin/make -f |
1181 | - |
1182 | -include /usr/share/cdbs/1/rules/debhelper.mk |
1183 | -DEB_PYTHON_SYSTEM = pysupport |
1184 | -include /usr/share/cdbs/1/class/python-distutils.mk |
1185 | - |
1186 | -build/python-configglue:: |
1187 | - python setup.py test |
1188 | |
1189 | === removed file 'debian/watch' |
1190 | --- debian/watch 2011-02-20 21:53:16 +0000 |
1191 | +++ debian/watch 1970-01-01 00:00:00 +0000 |
1192 | @@ -1,2 +0,0 @@ |
1193 | -version=3 |
1194 | -http://pypi.python.org/packages/source/c/configglue/configglue-(.+)\.tar\.gz |
1195 | |
1196 | === modified file 'setup.py' |
1197 | --- setup.py 2013-05-27 00:42:51 +0000 |
1198 | +++ setup.py 2013-07-11 19:08:28 +0000 |
1199 | @@ -21,12 +21,9 @@ |
1200 | ) |
1201 | |
1202 | import configglue |
1203 | -from configglue._compat import PY2 |
1204 | |
1205 | |
1206 | install_requires = ['pyxdg'] |
1207 | -if PY2: |
1208 | - install_requires.extend(['configparser']) |
1209 | |
1210 | |
1211 | setup(name='configglue', |
1212 | |
1213 | === modified file 'tox.ini' |
1214 | --- tox.ini 2013-05-27 00:42:51 +0000 |
1215 | +++ tox.ini 2013-07-11 19:08:28 +0000 |
1216 | @@ -8,16 +8,6 @@ |
1217 | commands = |
1218 | python setup.py test |
1219 | |
1220 | -[testenv:py26] |
1221 | -deps = |
1222 | - {[testenv]deps} |
1223 | - configparser |
1224 | - |
1225 | -[testenv:py27] |
1226 | -deps = |
1227 | - {[testenv]deps} |
1228 | - configparser |
1229 | - |
1230 | [testenv:docs] |
1231 | changedir = doc |
1232 | deps = |
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.