Hello community,
here is the log from the commit of package python-iniparse for openSUSE:Factory
checked in at 2020-04-19 21:49:14
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-iniparse (Old)
and /work/SRC/openSUSE:Factory/.python-iniparse.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-iniparse"
Sun Apr 19 21:49:14 2020 rev:23 rq:793895 version:0.5
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-iniparse/python-iniparse.changes
2018-12-27 00:26:47.399790787 +0100
+++
/work/SRC/openSUSE:Factory/.python-iniparse.new.2738/python-iniparse.changes
2020-04-19 21:49:15.700055714 +0200
@@ -1,0 +2,13 @@
+Tue Apr 14 13:15:45 UTC 2020 - Marketa Calabkova <[email protected]>
+
+- Update to 0.5
+ * upstream changed
+ * code improvements
+ * Python 3 support
+- Reapplied patch iniparse-insert-after-commented-option.patch
+- Dropped upstreamed patches:
+ * iniparse-fix-issue-28.patch
+ * python-iniparse-python3-compat.patch
+ * python-iniparse-setup-fixes.patch
+
+-------------------------------------------------------------------
Old:
----
iniparse-0.4.tar.gz
iniparse-fix-issue-28.patch
python-iniparse-python3-compat.patch
python-iniparse-setup-fixes.patch
New:
----
iniparse-0.5.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-iniparse.spec ++++++
--- /var/tmp/diff_new_pack.oiVzqr/_old 2020-04-19 21:49:17.140058603 +0200
+++ /var/tmp/diff_new_pack.oiVzqr/_new 2020-04-19 21:49:17.144058611 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python-iniparse
#
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2017 Neal Gompa <[email protected]>.
#
# All modifications and additions to the file contributed by third parties
@@ -19,22 +19,15 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-iniparse
-Version: 0.4
+Version: 0.5
Release: 0
Summary: Python Module for Accessing and Modifying Configuration Data
in INI files
License: MIT
Group: Development/Libraries/Python
-Url: http://code.google.com/p/iniparse/
-Source: http://iniparse.googlecode.com/files/iniparse-%{version}.tar.gz
+URL: https://github.com/candlepin/python-iniparse
+Source:
https://files.pythonhosted.org/packages/source/i/iniparse/iniparse-%{version}.tar.gz
# PATCH-FIX-UPSTREAM: [email protected] -- Backport of
https://code.google.com/p/iniparse/issues/detail?id=31
Patch0: iniparse-insert-after-commented-option.patch
-# PATCH-FIX-UPSTREAM: [email protected] -- Backport of
https://code.google.com/p/iniparse/issues/detail?id=28
-Patch1: iniparse-fix-issue-28.patch
-# PATCH-FIX-OPENSUSE: [email protected] -- Variant of
http://code.google.com/p/iniparse/issues/detail?id=22 that uses python-six to
support py2+py3, from Fedora
-Patch2: python-iniparse-python3-compat.patch
-# PATCH-FIX-OPENSUSE: [email protected] -- Fix setup.py to have correct
information, from Fedora
-Patch3: python-iniparse-setup-fixes.patch
-
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module six}
BuildRequires: python-rpm-macros
@@ -42,11 +35,8 @@
BuildRequires: python2-devel
# tests require testsuite modules
BuildRequires: python3-testsuite
-BuildRoot: %{_tmppath}/%{name}-%{version}-build
-BuildArch: noarch
-
Requires: python-six
-
+BuildArch: noarch
%python_subpackages
%description
@@ -57,10 +47,7 @@
%prep
%setup -q -n iniparse-%{version}
-%patch0 -p0
-%patch1 -p1
-%patch2 -p0
-%patch3 -p0
+%patch0
chmod 644 html/index.html
sed -i "/.*test_multiprocessing.*/d" tests/__init__.py # NOTE(saschpe):
Doesn't work and I'm lazy
@@ -76,8 +63,8 @@
%python_exec runtests.py
%files %{python_files}
-%defattr(-,root,root,-)
-%doc Changelog LICENSE LICENSE-PSF README html/*
+%license LICENSE
+%doc Changelog LICENSE-PSF README.md html/*
%{python_sitelib}/*
%changelog
++++++ iniparse-0.4.tar.gz -> iniparse-0.5.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniparse-0.4/PKG-INFO new/iniparse-0.5/PKG-INFO
--- old/iniparse-0.4/PKG-INFO 2010-06-12 18:47:42.000000000 +0200
+++ new/iniparse-0.5/PKG-INFO 2020-01-29 14:26:13.000000000 +0100
@@ -1,12 +1,13 @@
-Metadata-Version: 1.0
+Metadata-Version: 1.1
Name: iniparse
-Version: 0.4
+Version: 0.5
Summary: Accessing and Modifying INI files
-Home-page: http://code.google.com/p/iniparse/
+Home-page: https://github.com/candlepin/python-iniparse
Author: Paramjit Oberoi
-Author-email: [email protected]
+Author-email: [email protected]
License: MIT
-Description: iniparse is an INI parser for Python which is API compatible
+Description-Content-Type: UNKNOWN
+Description: iniparse is an INI parser for Python which is API compatible
with the standard library's ConfigParser, preserves structure of INI
files (order of sections & options, indentation, comments, and blank
lines are preserved when data is updated), and is more convenient to
@@ -18,7 +19,10 @@
Classifier: License :: OSI Approved :: Python Software Foundation License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2.4
-Classifier: Programming Language :: Python :: 2.5
+Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
Classifier: Topic :: Software Development :: Libraries :: Python Modules
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniparse-0.4/README new/iniparse-0.5/README
--- old/iniparse-0.4/README 2009-02-27 17:30:37.000000000 +0100
+++ new/iniparse-0.5/README 1970-01-01 01:00:00.000000000 +0100
@@ -1,28 +0,0 @@
-Introduction to iniparse
-
-iniparse is a INI parser for Python which is:
-
-* Compatible with ConfigParser: Backward compatible implementations
- of ConfigParser, RawConfigParser, and SafeConfigParser are included
- that are API-compatible with the Python standard library.
-
-* Preserves structure of INI files: Order of sections & options,
- indentation, comments, and blank lines are preserved as far as
- possible when data is updated.
-
-* More convenient: Values can be accessed using dotted notation
- (cfg.user.name), or using container syntax (cfg['user']['name']).
-
-It is very useful for config files that are updated both by users and by
-programs, since it is very disorienting for a user to have her config file
-completely rearranged whenever a program changes it. iniparse also allows
-making the order of entries in a config file significant, which is desirable
-in applications like image galleries.
-
-Website: http://code.google.com/p/iniparse/
-Mailing List: [email protected]
-
-Copyright (c) 2001-2008 Python Software Foundation
-Copyright (c) 2004-2009 Paramjit Oberoi <param.cs.wisc.edu>
-Copyright (c) 2007 Tim Lauridsen <[email protected]>
-All Rights Reserved. See LICENSE-PSF & LICENSE for details.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniparse-0.4/README.md new/iniparse-0.5/README.md
--- old/iniparse-0.4/README.md 1970-01-01 01:00:00.000000000 +0100
+++ new/iniparse-0.5/README.md 2020-01-29 13:56:22.000000000 +0100
@@ -0,0 +1,34 @@
+Introduction to iniparse
+------------------------
+
+[](https://travis-ci.org/candlepin/python-iniparse)
+
+iniparse is a INI parser for Python which is:
+
+* Compatible with ConfigParser: Backward compatible implementations
+ of ConfigParser, RawConfigParser, and SafeConfigParser are included
+ that are API-compatible with the Python standard library.
+
+* Preserves structure of INI files: Order of sections & options,
+ indentation, comments, and blank lines are preserved as far as
+ possible when data is updated.
+
+* More convenient: Values can be accessed using dotted notation
+ (`cfg.user.name`), or using container syntax (`cfg['user']['name']`).
+
+It is very useful for config files that are updated both by users and by
+programs, since it is very disorienting for a user to have her config file
+completely rearranged whenever a program changes it. iniparse also allows
+making the order of entries in a config file significant, which is desirable
+in applications like image galleries.
+
+Website: https://github.com/candlepin/python-iniparse/
+
+
+Copyright (c) 2001-2008 Python Software Foundation
+
+Copyright (c) 2004-2009 Paramjit Oberoi <param.cs.wisc.edu>
+
+Copyright (c) 2007 Tim Lauridsen <[email protected]>
+
+All Rights Reserved. See LICENSE-PSF & LICENSE for details.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniparse-0.4/iniparse/__init__.py
new/iniparse-0.5/iniparse/__init__.py
--- old/iniparse-0.4/iniparse/__init__.py 2010-05-08 21:36:42.000000000
+0200
+++ new/iniparse-0.5/iniparse/__init__.py 2018-05-18 13:41:42.000000000
+0200
@@ -3,17 +3,17 @@
# Copyright (c) 2007 Tim Lauridsen <[email protected]>
# All Rights Reserved. See LICENSE-PSF & LICENSE for details.
-from ini import INIConfig, change_comment_syntax
-from config import BasicConfig, ConfigNamespace
-from compat import RawConfigParser, ConfigParser, SafeConfigParser
-from utils import tidy
+from .ini import INIConfig, change_comment_syntax
+from .config import BasicConfig, ConfigNamespace
+from .compat import RawConfigParser, ConfigParser, SafeConfigParser
+from .utils import tidy
-from ConfigParser import DuplicateSectionError, \
- NoSectionError, NoOptionError, \
- InterpolationMissingOptionError, \
- InterpolationDepthError, \
- InterpolationSyntaxError, \
- DEFAULTSECT, MAX_INTERPOLATION_DEPTH
+from .configparser import DuplicateSectionError, \
+ NoSectionError, NoOptionError, \
+ InterpolationMissingOptionError, \
+ InterpolationDepthError, \
+ InterpolationSyntaxError, \
+ DEFAULTSECT, MAX_INTERPOLATION_DEPTH
__all__ = [
'BasicConfig', 'ConfigNamespace',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniparse-0.4/iniparse/compat.py
new/iniparse-0.5/iniparse/compat.py
--- old/iniparse-0.4/iniparse/compat.py 2010-05-08 02:51:42.000000000 +0200
+++ new/iniparse-0.5/iniparse/compat.py 2020-01-29 11:55:30.000000000 +0100
@@ -12,19 +12,22 @@
"""
import re
-from ConfigParser import DuplicateSectionError, \
- NoSectionError, NoOptionError, \
- InterpolationMissingOptionError, \
- InterpolationDepthError, \
- InterpolationSyntaxError, \
- DEFAULTSECT, MAX_INTERPOLATION_DEPTH
+from .configparser import DuplicateSectionError, \
+ NoSectionError, NoOptionError, \
+ InterpolationMissingOptionError, \
+ InterpolationDepthError, \
+ InterpolationSyntaxError, \
+ DEFAULTSECT, MAX_INTERPOLATION_DEPTH
# These are imported only for compatiability.
# The code below does not reference them directly.
-from ConfigParser import Error, InterpolationError, \
- MissingSectionHeaderError, ParsingError
+from .configparser import Error, InterpolationError, \
+ MissingSectionHeaderError, ParsingError
+
+import six
+
+from . import ini
-import ini
class RawConfigParser(object):
def __init__(self, defaults=None, dict_type=dict):
@@ -56,7 +59,7 @@
# The default section is the only one that gets the case-insensitive
# treatment - so it is special-cased here.
if section.lower() == "default":
- raise ValueError, 'Invalid section name: %s' % section
+ raise ValueError('Invalid section name: %s' % section)
if self.has_section(section):
raise DuplicateSectionError(section)
@@ -68,7 +71,7 @@
The DEFAULT section is not acknowledged.
"""
- return (section in self.data)
+ return section in self.data
def options(self, section):
"""Return a list of option names for the given section name."""
@@ -88,7 +91,7 @@
filename may also be given.
"""
files_read = []
- if isinstance(filenames, basestring):
+ if isinstance(filenames, six.string_types):
filenames = [filenames]
for filename in filenames:
try:
@@ -113,8 +116,6 @@
def get(self, section, option, vars=None):
if not self.has_section(section):
raise NoSectionError(section)
- if vars is not None and option in vars:
- value = vars[option]
sec = self.data[section]
if option in sec:
@@ -143,7 +144,7 @@
def getboolean(self, section, option):
v = self.get(section, option)
if v.lower() not in self._boolean_states:
- raise ValueError, 'Not a boolean: %s' % v
+ raise ValueError('Not a boolean: %s' % v)
return self._boolean_states[v.lower()]
def has_option(self, section, option):
@@ -234,7 +235,7 @@
if "%(" in value:
try:
value = value % vars
- except KeyError, e:
+ except KeyError as e:
raise InterpolationMissingOptionError(
option, section, rawval, e.args[0])
else:
@@ -283,7 +284,7 @@
_badpercent_re = re.compile(r"%[^%]|%$")
def set(self, section, option, value):
- if not isinstance(value, basestring):
+ if not isinstance(value, six.string_types):
raise TypeError("option values must be strings")
# check for bad percent signs:
# first, replace all "good" interpolations
@@ -323,8 +324,7 @@
elif c == "(":
m = self._interpvar_match(rest)
if m is None:
- raise InterpolationSyntaxError(option, section,
- "bad interpolation variable reference %r" % rest)
+ raise InterpolationSyntaxError(option, section, "bad
interpolation variable reference %r" % rest)
var = m.group(1)
rest = rest[m.end():]
try:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniparse-0.4/iniparse/config.py
new/iniparse-0.5/iniparse/config.py
--- old/iniparse-0.4/iniparse/config.py 2010-05-08 21:55:43.000000000 +0200
+++ new/iniparse-0.5/iniparse/config.py 2020-01-29 11:55:30.000000000 +0100
@@ -86,6 +86,7 @@
def __setstate__(self, state):
self.__dict__.update(state)
+
class Undefined(object):
"""Helper class used to hold undefined names until assignment.
@@ -143,16 +144,16 @@
>>> n.aaa = 42
>>> del n.x
- >>> print n
+ >>> print(n)
aaa = 42
name.first = paramjit
name.last = oberoi
- Nested namepsaces are also namespaces:
+ Nested namespaces are also namespaces:
>>> isinstance(n.name, ConfigNamespace)
True
- >>> print n.name
+ >>> print(n.name)
first = paramjit
last = oberoi
>>> sorted(list(n.name))
@@ -160,7 +161,7 @@
Finally, values can be read from a file as follows:
- >>> from StringIO import StringIO
+ >>> from six import StringIO
>>> sio = StringIO('''
... # comment
... ui.height = 100
@@ -171,7 +172,7 @@
... ''')
>>> n = BasicConfig()
>>> n._readfp(sio)
- >>> print n
+ >>> print(n)
complexity = medium
data.secret.password = goodness=gracious me
have_python
@@ -199,7 +200,7 @@
def __str__(self, prefix=''):
lines = []
- keys = self._data.keys()
+ keys = list(self._data.keys())
keys.sort()
for name in keys:
value = self._data[name]
@@ -258,7 +259,7 @@
>>> n.ui.display_clock = True
>>> n.ui.display_qlength = True
>>> n.ui.width = 150
- >>> print n
+ >>> print(n)
playlist.expand_playlist = True
ui.display_clock = True
ui.display_qlength = True
@@ -267,7 +268,7 @@
>>> from iniparse import ini
>>> i = ini.INIConfig()
>>> update_config(i, n)
- >>> print i
+ >>> print(i)
[playlist]
expand_playlist = True
<BLANKLINE>
@@ -277,7 +278,7 @@
width = 150
"""
- for name in source:
+ for name in sorted(source):
value = source[name]
if isinstance(value, ConfigNamespace):
if name in target:
@@ -289,6 +290,3 @@
update_config(myns, value)
else:
target[name] = value
-
-
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniparse-0.4/iniparse/configparser.py
new/iniparse-0.5/iniparse/configparser.py
--- old/iniparse-0.4/iniparse/configparser.py 1970-01-01 01:00:00.000000000
+0100
+++ new/iniparse-0.5/iniparse/configparser.py 2018-05-18 13:41:42.000000000
+0200
@@ -0,0 +1,7 @@
+try:
+ from ConfigParser import *
+ # not all objects get imported with __all__
+ from ConfigParser import Error, InterpolationMissingOptionError
+except ImportError:
+ from configparser import *
+ from configparser import Error, InterpolationMissingOptionError
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniparse-0.4/iniparse/ini.py
new/iniparse-0.5/iniparse/ini.py
--- old/iniparse-0.4/iniparse/ini.py 2010-05-08 21:36:42.000000000 +0200
+++ new/iniparse-0.5/iniparse/ini.py 2020-01-29 11:55:30.000000000 +0100
@@ -7,7 +7,7 @@
Example:
- >>> from StringIO import StringIO
+ >>> from six import StringIO
>>> sio = StringIO('''# configure foo-application
... [foo]
... bar1 = qualia
@@ -16,14 +16,14 @@
... special = 1''')
>>> cfg = INIConfig(sio)
- >>> print cfg.foo.bar1
+ >>> print(cfg.foo.bar1)
qualia
- >>> print cfg['foo-ext'].special
+ >>> print(cfg['foo-ext'].special)
1
>>> cfg.foo.newopt = 'hi!'
>>> cfg.baz.enabled = 0
- >>> print cfg
+ >>> print(cfg)
# configure foo-application
[foo]
bar1 = qualia
@@ -42,9 +42,12 @@
# Backward-compatiable with ConfigParser
import re
-from ConfigParser import DEFAULTSECT, ParsingError, MissingSectionHeaderError
+from .configparser import DEFAULTSECT, ParsingError, MissingSectionHeaderError
+
+import six
+
+from . import config
-import config
class LineType(object):
line = None
@@ -73,10 +76,10 @@
class SectionLine(LineType):
- regex = re.compile(r'^\['
- r'(?P<name>[^]]+)'
- r'\]\s*'
- r'((?P<csep>;|#)(?P<comment>.*))?$')
+ regex = re.compile(r'^\['
+ r'(?P<name>[^]]+)'
+ r'\]\s*'
+ r'((?P<csep>;|#)(?P<comment>.*))?$')
def __init__(self, name, comment=None, comment_separator=None,
comment_offset=-1, line=None):
@@ -170,6 +173,7 @@
regex += r')(?P<comment>.*)$'
CommentLine.regex = re.compile(regex)
+
class CommentLine(LineType):
regex = re.compile(r'^(?P<csep>[;#]|[rR][eE][mM])'
r'(?P<comment>.*)$')
@@ -187,6 +191,7 @@
if m is None:
return None
return cls(m.group('comment'), m.group('csep'), line)
+
parse = classmethod(parse)
@@ -195,11 +200,13 @@
def to_string(self):
return ''
- value = property(lambda _: '')
+ value = property(lambda self: '')
def parse(cls, line):
- if line.strip(): return None
+ if line.strip():
+ return None
return cls(line)
+
parse = classmethod(parse)
@@ -221,6 +228,7 @@
if m is None:
return None
return cls(m.group('value'), m.start('value'), line)
+
parse = classmethod(parse)
@@ -275,6 +283,7 @@
self.add(EmptyLine())
name = property(get_name, set_name)
+
value = property(get_value, set_value)
def __str__(self):
@@ -322,8 +331,8 @@
_optionxformvalue = None
_optionxformsource = None
_compat_skip_empty_lines = set()
- def __init__(self, lineobj, defaults = None,
- optionxformvalue=None, optionxformsource=None):
+
+ def __init__(self, lineobj, defaults=None, optionxformvalue=None,
optionxformsource=None):
self._lines = [lineobj]
self._defaults = defaults
self._optionxformvalue = optionxformvalue
@@ -453,6 +462,7 @@
_sectionxformsource = None
_parse_exc = None
_bom = False
+
def __init__(self, fp=None, defaults=None, parse_exc=True,
optionxformvalue=lower, optionxformsource=None,
sectionxformvalue=None, sectionxformsource=None):
@@ -465,7 +475,7 @@
self._sections = {}
if defaults is None: defaults = {}
self._defaults = INISection(LineContainer(), optionxformsource=self)
- for name, value in defaults.iteritems():
+ for name, value in defaults.items():
self._defaults[name] = value
if fp is not None:
self._readfp(fp)
@@ -545,34 +555,34 @@
fname = fp.name
except AttributeError:
fname = '<???>'
- linecount = 0
+ line_count = 0
exc = None
line = None
for line in readline_iterator(fp):
# Check for BOM on first line
- if linecount == 0 and isinstance(line, unicode):
+ if line_count == 0 and isinstance(line, six.text_type):
if line[0] == u'\ufeff':
line = line[1:]
self._bom = True
- lineobj = self._parse(line)
- linecount += 1
+ line_obj = self._parse(line)
+ line_count += 1
- if not cur_section and not isinstance(lineobj,
- (CommentLine, EmptyLine, SectionLine)):
+ if not cur_section and not isinstance(line_obj, (CommentLine,
EmptyLine, SectionLine)):
if self._parse_exc:
- raise MissingSectionHeaderError(fname, linecount, line)
+ raise MissingSectionHeaderError(fname, line_count, line)
else:
- lineobj = make_comment(line)
+ line_obj = make_comment(line)
- if lineobj is None:
+ if line_obj is None:
if self._parse_exc:
- if exc is None: exc = ParsingError(fname)
- exc.append(linecount, line)
- lineobj = make_comment(line)
+ if exc is None:
+ exc = ParsingError(fname)
+ exc.append(line_count, line)
+ line_obj = make_comment(line)
- if isinstance(lineobj, ContinuationLine):
+ if isinstance(line_obj, ContinuationLine):
if cur_option:
if pending_lines:
cur_option.extend(pending_lines)
@@ -580,20 +590,21 @@
if pending_empty_lines:
optobj._compat_skip_empty_lines.add(cur_option_name)
pending_empty_lines = False
- cur_option.add(lineobj)
+ cur_option.add(line_obj)
else:
# illegal continuation line - convert to comment
if self._parse_exc:
- if exc is None: exc = ParsingError(fname)
- exc.append(linecount, line)
- lineobj = make_comment(line)
+ if exc is None:
+ exc = ParsingError(fname)
+ exc.append(line_count, line)
+ line_obj = make_comment(line)
- if isinstance(lineobj, OptionLine):
+ if isinstance(line_obj, OptionLine):
if pending_lines:
cur_section.extend(pending_lines)
pending_lines = []
pending_empty_lines = False
- cur_option = LineContainer(lineobj)
+ cur_option = LineContainer(line_obj)
cur_section.add(cur_option)
if self._optionxform:
cur_option_name = self._optionxform(cur_option.name)
@@ -605,11 +616,11 @@
optobj = self._sections[cur_section_name]
optobj._options[cur_option_name] = cur_option
- if isinstance(lineobj, SectionLine):
+ if isinstance(line_obj, SectionLine):
self._data.extend(pending_lines)
pending_lines = []
pending_empty_lines = False
- cur_section = LineContainer(lineobj)
+ cur_section = LineContainer(line_obj)
self._data.add(cur_section)
cur_option = None
cur_option_name = None
@@ -628,16 +639,14 @@
else:
self._sections[cur_section_name]._lines.append(cur_section)
- if isinstance(lineobj, (CommentLine, EmptyLine)):
- pending_lines.append(lineobj)
- if isinstance(lineobj, EmptyLine):
+ if isinstance(line_obj, (CommentLine, EmptyLine)):
+ pending_lines.append(line_obj)
+ if isinstance(line_obj, EmptyLine):
pending_empty_lines = True
self._data.extend(pending_lines)
- if line and line[-1]=='\n':
+ if line and line[-1] == '\n':
self._data.add(EmptyLine())
if exc:
raise exc
-
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniparse-0.4/iniparse/utils.py
new/iniparse-0.5/iniparse/utils.py
--- old/iniparse-0.4/iniparse/utils.py 2010-05-08 21:36:42.000000000 +0200
+++ new/iniparse-0.5/iniparse/utils.py 2020-01-29 11:55:30.000000000 +0100
@@ -1,5 +1,6 @@
-import compat
-from ini import LineContainer, EmptyLine
+from . import compat
+from .ini import LineContainer, EmptyLine
+
def tidy(cfg):
"""Clean up blank lines.
@@ -32,12 +33,12 @@
if cont and not isinstance(cont[-1], EmptyLine):
cont.append(EmptyLine())
+
def tidy_section(lc):
cont = lc.contents
i = 1
while i < len(cont):
- if (isinstance(cont[i-1], EmptyLine) and
- isinstance(cont[i], EmptyLine)):
+ if isinstance(cont[i-1], EmptyLine) and isinstance(cont[i], EmptyLine):
del cont[i]
else:
i += 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniparse-0.4/iniparse.egg-info/PKG-INFO
new/iniparse-0.5/iniparse.egg-info/PKG-INFO
--- old/iniparse-0.4/iniparse.egg-info/PKG-INFO 1970-01-01 01:00:00.000000000
+0100
+++ new/iniparse-0.5/iniparse.egg-info/PKG-INFO 2020-01-29 14:26:13.000000000
+0100
@@ -0,0 +1,28 @@
+Metadata-Version: 1.1
+Name: iniparse
+Version: 0.5
+Summary: Accessing and Modifying INI files
+Home-page: https://github.com/candlepin/python-iniparse
+Author: Paramjit Oberoi
+Author-email: [email protected]
+License: MIT
+Description-Content-Type: UNKNOWN
+Description: iniparse is an INI parser for Python which is API compatible
+ with the standard library's ConfigParser, preserves structure of INI
+ files (order of sections & options, indentation, comments, and blank
+ lines are preserved when data is updated), and is more convenient to
+ use.
+Platform: UNKNOWN
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: MIT License
+Classifier: License :: OSI Approved :: Python Software Foundation License
+Classifier: Operating System :: OS Independent
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.6
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniparse-0.4/iniparse.egg-info/SOURCES.txt
new/iniparse-0.5/iniparse.egg-info/SOURCES.txt
--- old/iniparse-0.4/iniparse.egg-info/SOURCES.txt 1970-01-01
01:00:00.000000000 +0100
+++ new/iniparse-0.5/iniparse.egg-info/SOURCES.txt 2020-01-29
14:26:13.000000000 +0100
@@ -0,0 +1,30 @@
+Changelog
+LICENSE
+LICENSE-PSF
+MANIFEST.in
+Makefile
+README.md
+python-iniparse.spec
+runtests.py
+setup.py
+html/index.html
+html/style.css
+iniparse/__init__.py
+iniparse/compat.py
+iniparse/config.py
+iniparse/configparser.py
+iniparse/ini.py
+iniparse/utils.py
+iniparse.egg-info/PKG-INFO
+iniparse.egg-info/SOURCES.txt
+iniparse.egg-info/dependency_links.txt
+iniparse.egg-info/requires.txt
+iniparse.egg-info/top_level.txt
+tests/__init__.py
+tests/test_compat.py
+tests/test_fuzz.py
+tests/test_ini.py
+tests/test_misc.py
+tests/test_multiprocessing.py
+tests/test_tidy.py
+tests/test_unicode.py
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniparse-0.4/iniparse.egg-info/dependency_links.txt
new/iniparse-0.5/iniparse.egg-info/dependency_links.txt
--- old/iniparse-0.4/iniparse.egg-info/dependency_links.txt 1970-01-01
01:00:00.000000000 +0100
+++ new/iniparse-0.5/iniparse.egg-info/dependency_links.txt 2020-01-29
14:26:13.000000000 +0100
@@ -0,0 +1 @@
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniparse-0.4/iniparse.egg-info/requires.txt
new/iniparse-0.5/iniparse.egg-info/requires.txt
--- old/iniparse-0.4/iniparse.egg-info/requires.txt 1970-01-01
01:00:00.000000000 +0100
+++ new/iniparse-0.5/iniparse.egg-info/requires.txt 2020-01-29
14:26:13.000000000 +0100
@@ -0,0 +1 @@
+six
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniparse-0.4/iniparse.egg-info/top_level.txt
new/iniparse-0.5/iniparse.egg-info/top_level.txt
--- old/iniparse-0.4/iniparse.egg-info/top_level.txt 1970-01-01
01:00:00.000000000 +0100
+++ new/iniparse-0.5/iniparse.egg-info/top_level.txt 2020-01-29
14:26:13.000000000 +0100
@@ -0,0 +1 @@
+iniparse
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniparse-0.4/runtests.py new/iniparse-0.5/runtests.py
--- old/iniparse-0.4/runtests.py 2008-12-06 08:56:15.000000000 +0100
+++ new/iniparse-0.5/runtests.py 2020-01-29 11:55:30.000000000 +0100
@@ -6,7 +6,7 @@
if __name__ == '__main__':
if len(sys.argv) == 2 and sys.argv[1] == '-g':
import unittestgui
- unittestgui.main('tests.suite')
+ unittestgui.main('tests.Suite')
else:
import unittest
- unittest.main(defaultTest='tests.suite')
+ unittest.main(defaultTest='tests.Suite')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniparse-0.4/setup.cfg new/iniparse-0.5/setup.cfg
--- old/iniparse-0.4/setup.cfg 1970-01-01 01:00:00.000000000 +0100
+++ new/iniparse-0.5/setup.cfg 2020-01-29 14:26:13.000000000 +0100
@@ -0,0 +1,4 @@
+[egg_info]
+tag_build =
+tag_date = 0
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniparse-0.4/setup.py new/iniparse-0.5/setup.py
--- old/iniparse-0.4/setup.py 2010-06-12 18:15:40.000000000 +0200
+++ new/iniparse-0.5/setup.py 2020-01-29 14:22:11.000000000 +0100
@@ -1,18 +1,18 @@
#!/usr/bin/env python
-from distutils.core import setup
+from setuptools import setup
-VERSION = '0.4'
+VERSION = '0.5'
setup(name ='iniparse',
version = VERSION,
description = 'Accessing and Modifying INI files',
author = 'Paramjit Oberoi',
- author_email = '[email protected]',
- url = 'http://code.google.com/p/iniparse/',
+ author_email = '[email protected]',
+ url = 'https://github.com/candlepin/python-iniparse',
license = 'MIT',
long_description = '''\
-iniparse is an INI parser for Python which is API compatible
+iniparse is an INI parser for Python which is API compatible
with the standard library's ConfigParser, preserves structure of INI
files (order of sections & options, indentation, comments, and blank
lines are preserved when data is updated), and is more convenient to
@@ -24,14 +24,18 @@
'License :: OSI Approved :: Python Software Foundation License',
'Operating System :: OS Independent',
'Programming Language :: Python',
- 'Programming Language :: Python :: 2.4',
- 'Programming Language :: Python :: 2.5',
+ 'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
+ 'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.3',
+ 'Programming Language :: Python :: 3.4',
'Topic :: Software Development :: Libraries :: Python Modules',
],
packages = ['iniparse'],
+ install_requires=['six'],
data_files = [
- ('share/doc/iniparse-%s' % VERSION, ['README', 'LICENSE-PSF',
+ ('share/doc/iniparse-%s' % VERSION, ['README.md', 'LICENSE-PSF',
'LICENSE', 'Changelog',
'html/index.html',
'html/style.css',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniparse-0.4/tests/__init__.py
new/iniparse-0.5/tests/__init__.py
--- old/iniparse-0.4/tests/__init__.py 2010-05-05 23:00:22.000000000 +0200
+++ new/iniparse-0.5/tests/__init__.py 2020-01-29 11:55:30.000000000 +0100
@@ -1,25 +1,26 @@
import unittest, doctest
-import test_ini
-import test_misc
-import test_fuzz
-import test_compat
-import test_unicode
-import test_tidy
-import test_multiprocessing
+from . import test_ini
+from . import test_misc
+from . import test_fuzz
+from . import test_compat
+from . import test_unicode
+from . import test_tidy
+from . import test_multiprocessing
from iniparse import config
from iniparse import ini
-class suite(unittest.TestSuite):
+
+class Suite(unittest.TestSuite):
def __init__(self):
unittest.TestSuite.__init__(self, [
doctest.DocTestSuite(config),
doctest.DocTestSuite(ini),
- test_ini.suite(),
- test_misc.suite(),
- test_fuzz.suite(),
- test_compat.suite(),
- test_unicode.suite(),
- test_tidy.suite(),
- test_multiprocessing.suite(),
+ test_ini.Suite(),
+ test_misc.Suite(),
+ test_fuzz.Suite(),
+ test_compat.Suite(),
+ test_unicode.Suite(),
+ test_tidy.Suite(),
+ test_multiprocessing.Suite(),
])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniparse-0.4/tests/test_compat.py
new/iniparse-0.5/tests/test_compat.py
--- old/iniparse-0.4/tests/test_compat.py 2008-12-06 11:15:30.000000000
+0100
+++ new/iniparse-0.5/tests/test_compat.py 2020-01-29 11:55:30.000000000
+0100
@@ -1,9 +1,17 @@
from iniparse import compat as ConfigParser
-import StringIO
+from six import StringIO
+try:
+ import UserDict
+except ImportError:
+ import collections as UserDict
import unittest
-import UserDict
-from test import test_support
+import sys
+if sys.version_info[0] < 3:
+ from test import test_support
+else:
+ from test import support as test_support
+
class SortedDict(UserDict.UserDict):
def items(self):
@@ -18,12 +26,19 @@
def values(self):
result = self.items()
- return [i[1] for i in values]
+ return [i[1] for i in result]
+
+ def iteritems(self):
+ return iter(self.items())
+
+ def iterkeys(self):
+ return iter(self.keys())
- def iteritems(self): return iter(self.items())
- def iterkeys(self): return iter(self.keys())
__iter__ = iterkeys
- def itervalues(self): return iter(self.values())
+
+ def itervalues(self):
+ return iter(self.values())
+
class TestCaseBase(unittest.TestCase):
def newconfig(self, defaults=None):
@@ -35,7 +50,7 @@
def fromstring(self, string, defaults=None):
cf = self.newconfig(defaults)
- sio = StringIO.StringIO(string)
+ sio = StringIO(string)
cf.readfp(sio)
return cf
@@ -134,7 +149,6 @@
defaults={"key":"value"})
self.failUnless(cf.has_option("section", "Key"))
-
def test_default_case_sensitivity(self):
cf = self.newconfig({"foo": "Bar"})
self.assertEqual(
@@ -161,7 +175,7 @@
"No Section!\n")
def parse_error(self, exc, src):
- sio = StringIO.StringIO(src)
+ sio = StringIO(src)
self.assertRaises(exc, self.cf.readfp, sio)
def test_query_errors(self):
@@ -181,7 +195,7 @@
def get_error(self, exc, section, option):
try:
self.cf.get(section, option)
- except exc, e:
+ except exc as e:
return e
else:
self.fail("expected exception type %s.%s"
@@ -227,7 +241,7 @@
"foo: another very\n"
" long line"
)
- output = StringIO.StringIO()
+ output = StringIO()
cf.write(output)
self.assertEqual(
output.getvalue(),
@@ -452,6 +466,7 @@
cf = self.newconfig()
self.assertRaises(ValueError, cf.add_section, "DEFAULT")
+
class SortedTestCase(RawConfigParserTestCase):
def newconfig(self, defaults=None):
self.cf = self.config_class(defaults=defaults, dict_type=SortedDict)
@@ -465,7 +480,7 @@
"o1=4\n"
"[a]\n"
"k=v\n")
- output = StringIO.StringIO()
+ output = StringIO()
self.cf.write(output)
self.assertEquals(output.getvalue(),
"[a]\n"
@@ -476,6 +491,7 @@
"o3 = 2\n"
"o4 = 1\n\n")
+
def test_main():
test_support.run_unittest(
ConfigParserTestCase,
@@ -484,14 +500,16 @@
SortedTestCase
)
-class suite(unittest.TestSuite):
+
+class Suite(unittest.TestSuite):
def __init__(self):
unittest.TestSuite.__init__(self, [
unittest.makeSuite(RawConfigParserTestCase, 'test'),
unittest.makeSuite(ConfigParserTestCase, 'test'),
unittest.makeSuite(SafeConfigParserTestCase, 'test'),
- #unittest.makeSuite(SortedTestCase, 'test'),
- ])
+ # unittest.makeSuite(SortedTestCase, 'test')
+ ])
+
if __name__ == "__main__":
test_main()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniparse-0.4/tests/test_fuzz.py
new/iniparse-0.5/tests/test_fuzz.py
--- old/iniparse-0.4/tests/test_fuzz.py 2010-05-08 21:36:42.000000000 +0200
+++ new/iniparse-0.5/tests/test_fuzz.py 2020-01-29 11:55:30.000000000 +0100
@@ -1,15 +1,17 @@
import re
import os
import random
+import sys
import unittest
-import ConfigParser
-from StringIO import StringIO
+from six import StringIO
+from six.moves import configparser
from iniparse import compat, ini, tidy
# TODO:
# tabs
# substitutions
+
def random_string(maxlen=200):
length = random.randint(0, maxlen)
s = []
@@ -18,10 +20,12 @@
return ''.join(s)
+
def random_space(maxlen=10):
length = random.randint(0, maxlen)
return ' '*length
+
def random_ini_file():
num_lines = random.randint(0, 100)
lines = []
@@ -66,7 +70,8 @@
return '\n'.join(lines)
-class test_fuzz(unittest.TestCase):
+
+class TestFuzz(unittest.TestCase):
def test_fuzz(self):
random.seed(42)
try:
@@ -96,24 +101,25 @@
s = '\n'.join(good_lines)
cc = compat.RawConfigParser()
cc.readfp(StringIO(s))
- cc_py = ConfigParser.RawConfigParser()
+ cc_py = configparser.RawConfigParser()
cc_py.readfp(StringIO(s))
# compare the two configparsers
self.assertEqualConfig(cc_py, cc)
# check that tidy does not change semantics
tidy(cc)
- cc_tidy = ConfigParser.RawConfigParser()
+ cc_tidy = configparser.RawConfigParser()
cc_tidy.readfp(StringIO(str(cc.data)))
self.assertEqualConfig(cc_py, cc_tidy)
except AssertionError:
fname = 'fuzz-test-iter-%d.ini' % fuzz_iter
- print 'Fuzz test failed at iteration', fuzz_iter
- print 'Writing out failing INI file as', fname
+ print('Fuzz test failed at iteration', fuzz_iter)
+ print('Writing out failing INI file as', fname)
f = open(fname, 'w')
f.write(s)
f.close()
raise
+ @unittest.skipIf(sys.version_info[0] > 2,
'http://code.google.com/p/iniparse/issues/detail?id=22#c9')
def assertEqualConfig(self, c1, c2):
self.assertEqualSorted(c1.sections(), c2.sections())
self.assertEqualSorted(c1.defaults().items(), c2.defaults().items())
@@ -123,12 +129,11 @@
self.assertEqual(c1.get(sec, opt), c2.get(sec, opt))
def assertEqualSorted(self, l1, l2):
- l1.sort()
- l2.sort()
- self.assertEqual(l1, l2)
+ self.assertEqual(sorted(l1), sorted(l2))
+
-class suite(unittest.TestSuite):
+class Suite(unittest.TestSuite):
def __init__(self):
unittest.TestSuite.__init__(self, [
- unittest.makeSuite(test_fuzz, 'test'),
- ])
+ unittest.makeSuite(TestFuzz, 'test'),
+ ])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniparse-0.4/tests/test_ini.py
new/iniparse-0.5/tests/test_ini.py
--- old/iniparse-0.4/tests/test_ini.py 2010-05-08 21:36:03.000000000 +0200
+++ new/iniparse-0.5/tests/test_ini.py 2020-01-29 11:55:30.000000000 +0100
@@ -1,11 +1,12 @@
import unittest
-from StringIO import StringIO
+from six import StringIO
from iniparse import ini
from iniparse import compat
from iniparse import config
-class test_section_line(unittest.TestCase):
+
+class TestSectionLine(unittest.TestCase):
invalid_lines = [
'# this is a comment',
'; this is a comment',
@@ -17,19 +18,21 @@
'[ice-cream] = mmmm',
'-$%^',
]
+
def test_invalid(self):
for l in self.invalid_lines:
p = ini.SectionLine.parse(l)
self.assertEqual(p, None)
lines = [
- ('[section]' , ('section', None, None, -1)),
- ('[se\ct%[ion\t]' , ('se\ct%[ion\t', None, None, -1)),
- ('[sec tion] ; hi' , ('sec tion', ' hi', ';', 12)),
- ('[section] #oops!' , ('section', 'oops!', '#', 11)),
- ('[section] ; ' , ('section', '', ';', 12)),
- ('[section] ' , ('section', None, None, -1)),
+ ('[section]', ('section', None, None, -1)),
+ ('[se\ct%[ion\t]', ('se\ct%[ion\t', None, None, -1)),
+ ('[sec tion] ; hi', ('sec tion', ' hi', ';', 12)),
+ ('[section] #oops!', ('section', 'oops!', '#', 11)),
+ ('[section] ; ', ('section', '', ';', 12)),
+ ('[section] ', ('section', None, None, -1)),
]
+
def test_parsing(self):
for l in self.lines:
p = ini.SectionLine.parse(l[0])
@@ -53,13 +56,15 @@
('[oldname] ; comment', 'really long new name',
'[really long new name] ; comment'),
]
+
def test_preserve_indentation(self):
for l in self.indent_test_lines:
p = ini.SectionLine.parse(l[0])
p.name = l[1]
self.assertEqual(str(p), l[2])
-class test_option_line(unittest.TestCase):
+
+class TestOptionLine(unittest.TestCase):
lines = [
('option = value', 'option', ' = ', 'value', None, None, -1),
('option: value', 'option', ': ', 'value', None, None, -1),
@@ -95,6 +100,7 @@
'[section=option]',
'option',
]
+
def test_invalid(self):
for l in self.invalid_lines:
p = ini.OptionLine.parse(l)
@@ -110,6 +116,7 @@
'option = value;2 ;; 4 5',
'option = value ; hi!',
]
+
def test_printing(self):
for l in self.print_lines:
p = ini.OptionLine.parse(l)
@@ -122,6 +129,7 @@
('option = value ;comment', 'newoption', 'newval',
'newoption = newval ;comment'),
]
+
def test_preserve_indentation(self):
for l in self.indent_test_lines:
p = ini.OptionLine.parse(l[0])
@@ -129,12 +137,14 @@
p.value = l[2]
self.assertEqual(str(p), l[3])
-class test_comment_line(unittest.TestCase):
+
+class TestCommentLine(unittest.TestCase):
invalid_lines = [
'[section]',
'option = value ;comment',
' # must start on first column',
]
+
def test_invalid(self):
for l in self.invalid_lines:
p = ini.CommentLine.parse(l)
@@ -144,16 +154,17 @@
'#this is a comment',
';; this is also a comment',
'; so is this ',
- 'Rem and this',
- 'remthis too!'
+ 'Rem and this'
]
+
def test_parsing(self):
for l in self.lines:
p = ini.CommentLine.parse(l)
self.assertEqual(str(p), l)
self.assertEqual(p.to_string(), l.rstrip())
-class test_other_lines(unittest.TestCase):
+
+class TestOtherLines(unittest.TestCase):
def test_empty(self):
for s in ['asdf', '; hi', ' #rr', '[sec]', 'opt=val']:
self.assertEqual(ini.EmptyLine.parse(s), None)
@@ -170,7 +181,7 @@
s.rstrip().replace('\t',' '))
-class test_ini(unittest.TestCase):
+class TestIni(unittest.TestCase):
s1 = """
[section1]
help = me
@@ -196,13 +207,13 @@
self.assertEqual(p._data.find('section2').find('just').value,
'kidding')
itr = p._data.finditer('section1')
- v = itr.next()
+ v = next(itr)
self.assertEqual(v.find('help').value, 'yourself')
self.assertEqual(v.find('but').value, 'also me')
- v = itr.next()
+ v = next(itr)
self.assertEqual(v.find('help').value, 'me')
self.assertEqual(v.find('I\'m').value, 'desperate')
- self.assertRaises(StopIteration, itr.next)
+ self.assertRaises(StopIteration, next, itr)
self.assertRaises(KeyError, p._data.find, 'section')
self.assertRaises(KeyError, p._data.find('section2').find, 'ahem')
@@ -394,12 +405,12 @@
self.assertEqual(str(ip), self.s6)
-class suite(unittest.TestSuite):
+class Suite(unittest.TestSuite):
def __init__(self):
unittest.TestSuite.__init__(self, [
- unittest.makeSuite(test_section_line, 'test'),
- unittest.makeSuite(test_option_line, 'test'),
- unittest.makeSuite(test_comment_line, 'test'),
- unittest.makeSuite(test_other_lines, 'test'),
- unittest.makeSuite(test_ini, 'test'),
+ unittest.makeSuite(TestSectionLine, 'test'),
+ unittest.makeSuite(TestOptionLine, 'test'),
+ unittest.makeSuite(TestCommentLine, 'test'),
+ unittest.makeSuite(TestOtherLines, 'test'),
+ unittest.makeSuite(TestIni, 'test'),
])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniparse-0.4/tests/test_misc.py
new/iniparse-0.5/tests/test_misc.py
--- old/iniparse-0.4/tests/test_misc.py 2010-05-05 07:15:39.000000000 +0200
+++ new/iniparse-0.5/tests/test_misc.py 2020-01-29 11:55:30.000000000 +0100
@@ -1,18 +1,20 @@
import re
import unittest
import pickle
-import ConfigParser
+from six.moves import configparser
+from six import StringIO
from textwrap import dedent
-from StringIO import StringIO
from iniparse import compat, ini
+
class CaseSensitiveConfigParser(compat.ConfigParser):
"""Case Sensitive version of ConfigParser"""
def optionxform(self, option):
"""Use str()"""
return str(option)
-class test_optionxform_override(unittest.TestCase):
+
+class TestOptionxFormOverride(unittest.TestCase):
def test_derivedclass(self):
c = CaseSensitiveConfigParser()
c.add_section('foo')
@@ -52,7 +54,8 @@
def readline(self):
return self.sio.readline()
-class test_readline(unittest.TestCase):
+
+class TestReadline(unittest.TestCase):
"""Test that the file object passed to readfp only needs to
support the .readline() method. As of Python-2.4.4, this is
true of the standard librariy's ConfigParser, and so other
@@ -91,7 +94,7 @@
self.assertEqual(s, ss.getvalue())
-class test_multiline_with_comments(unittest.TestCase):
+class TestMultilineWithComments(unittest.TestCase):
"""Test that multiline values are allowed to span comments."""
s = """\
@@ -115,7 +118,8 @@
[sec]
opt = xyz""")
-class test_empty_file(unittest.TestCase):
+
+class TestEmptyFile(unittest.TestCase):
"""Test if it works with an blank file"""
s = ""
@@ -133,11 +137,13 @@
[sec]
opt = xyz""")
-class test_custom_dict(unittest.TestCase):
+
+class TestCustomDict(unittest.TestCase):
def test_custom_dict_not_supported(self):
self.assertRaises(ValueError, compat.RawConfigParser, None, 'foo')
-class test_compat(unittest.TestCase):
+
+class TestCompat(unittest.TestCase):
"""Miscellaneous compatibility tests."""
s = dedent("""\
@@ -272,13 +278,13 @@
''])
def test_py_rawcfg(self):
- self.do_configparser_test(ConfigParser.RawConfigParser)
+ self.do_configparser_test(configparser.RawConfigParser)
def test_py_cfg(self):
- self.do_configparser_test(ConfigParser.ConfigParser)
+ self.do_configparser_test(configparser.ConfigParser)
def test_py_safecfg(self):
- self.do_configparser_test(ConfigParser.SafeConfigParser)
+ self.do_configparser_test(configparser.SafeConfigParser)
def do_compat_test(self, cfg_class):
c = cfg_class()
@@ -320,7 +326,8 @@
def test_py_safecfg(self):
self.do_compat_test(compat.SafeConfigParser)
-class test_pickle(unittest.TestCase):
+
+class TestPickle(unittest.TestCase):
s = dedent("""\
[DEFAULT]
pi = 3.1415
@@ -399,7 +406,8 @@
c2 = pickle.loads(p)
self.do_ini_checks(c2)
-class test_comment_syntax(unittest.TestCase):
+
+class TestCommentSyntax(unittest.TestCase):
"""Test changing comment syntax with change_comment_syntax"""
def test_regex(self):
@@ -446,15 +454,15 @@
ini.change_comment_syntax(';#', True)
-class suite(unittest.TestSuite):
+class Suite(unittest.TestSuite):
def __init__(self):
unittest.TestSuite.__init__(self, [
- unittest.makeSuite(test_optionxform_override, 'test'),
- unittest.makeSuite(test_readline, 'test'),
- unittest.makeSuite(test_multiline_with_comments, 'test'),
- unittest.makeSuite(test_empty_file, 'test'),
- unittest.makeSuite(test_custom_dict, 'test'),
- unittest.makeSuite(test_compat, 'test'),
- unittest.makeSuite(test_pickle, 'test'),
- unittest.makeSuite(test_comment_syntax, 'test'),
+ unittest.makeSuite(TestOptionxFormOverride, 'test'),
+ unittest.makeSuite(TestReadline, 'test'),
+ unittest.makeSuite(TestMultilineWithComments, 'test'),
+ unittest.makeSuite(TestEmptyFile, 'test'),
+ unittest.makeSuite(TestCustomDict, 'test'),
+ unittest.makeSuite(TestCompat, 'test'),
+ unittest.makeSuite(TestPickle, 'test'),
+ unittest.makeSuite(TestCommentSyntax, 'test'),
])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniparse-0.4/tests/test_multiprocessing.py
new/iniparse-0.5/tests/test_multiprocessing.py
--- old/iniparse-0.4/tests/test_multiprocessing.py 2010-05-07
07:45:01.000000000 +0200
+++ new/iniparse-0.5/tests/test_multiprocessing.py 2020-01-29
11:55:30.000000000 +0100
@@ -3,17 +3,21 @@
from multiprocessing import Process, Queue, Pipe
disabled = False
except ImportError:
+ Process = None
+ Queue = None
+ Pipe = None
disabled = True
-from iniparse import compat, ini
+from iniparse import ini
-class test_ini(unittest.TestCase):
+
+class TestIni(unittest.TestCase):
"""Test sending INIConfig objects."""
def test_queue(self):
- def getxy(q, w):
- cfg = q.get_nowait()
- w.put(cfg.x.y)
+ def getxy(_q, _w):
+ _cfg = _q.get_nowait()
+ _w.put(_cfg.x.y)
cfg = ini.INIConfig()
cfg.x.y = '42'
q = Queue()
@@ -23,11 +27,12 @@
p.start()
self.assertEqual(w.get(timeout=1), '42')
-class suite(unittest.TestSuite):
+
+class Suite(unittest.TestSuite):
def __init__(self):
if disabled:
unittest.TestSuite.__init__(self, [])
else:
unittest.TestSuite.__init__(self, [
- unittest.makeSuite(test_ini, 'test'),
+ unittest.makeSuite(TestIni, 'test'),
])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniparse-0.4/tests/test_tidy.py
new/iniparse-0.5/tests/test_tidy.py
--- old/iniparse-0.4/tests/test_tidy.py 2010-05-08 21:36:42.000000000 +0200
+++ new/iniparse-0.5/tests/test_tidy.py 2020-01-29 11:55:30.000000000 +0100
@@ -1,12 +1,12 @@
import unittest
from textwrap import dedent
-from StringIO import StringIO
+from six import StringIO
-from iniparse import tidy,INIConfig
-from iniparse.ini import EmptyLine
+from iniparse import tidy, INIConfig
from iniparse.compat import ConfigParser
-class test_tidy(unittest.TestCase):
+
+class TestTidy(unittest.TestCase):
def setUp(self):
self.cfg = INIConfig()
@@ -129,8 +129,8 @@
"""))
-class suite(unittest.TestSuite):
+class Suite(unittest.TestSuite):
def __init__(self):
unittest.TestSuite.__init__(self, [
- unittest.makeSuite(test_tidy, 'test'),
+ unittest.makeSuite(TestTidy, 'test'),
])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/iniparse-0.4/tests/test_unicode.py
new/iniparse-0.5/tests/test_unicode.py
--- old/iniparse-0.4/tests/test_unicode.py 2008-12-06 07:44:49.000000000
+0100
+++ new/iniparse-0.5/tests/test_unicode.py 2020-01-29 11:55:30.000000000
+0100
@@ -1,8 +1,9 @@
import unittest
-from StringIO import StringIO
-from iniparse import compat, ini
+import six
+from iniparse import ini
-class test_unicode(unittest.TestCase):
+
+class TestUnicode(unittest.TestCase):
"""Test files read in unicode-mode."""
s1 = u"""\
@@ -17,14 +18,14 @@
"""
def basic_tests(self, s, strable):
- f = StringIO(s)
+ f = six.StringIO(s)
i = ini.INIConfig(f)
- self.assertEqual(unicode(i), s)
- self.assertEqual(type(i.foo.bar), unicode)
+ self.assertEqual(six.text_type(i), s)
+ self.assertEqual(type(i.foo.bar), six.text_type)
if strable:
self.assertEqual(str(i), str(s))
else:
- self.assertRaises(UnicodeEncodeError, lambda: str(i))
+ self.assertRaises(UnicodeEncodeError, lambda:
six.text_type(i).encode('ascii'))
return i
def test_ascii(self):
@@ -41,8 +42,9 @@
self.assertEqual(i.foo.bar, 'mammal')
self.assertEqual(i.foo.baz, u'Marc-Andr\202')
-class suite(unittest.TestSuite):
+
+class Suite(unittest.TestSuite):
def __init__(self):
unittest.TestSuite.__init__(self, [
- unittest.makeSuite(test_unicode, 'test'),
+ unittest.makeSuite(TestUnicode, 'test'),
])
++++++ iniparse-insert-after-commented-option.patch ++++++
--- /var/tmp/diff_new_pack.oiVzqr/_old 2020-04-19 21:49:17.232058787 +0200
+++ /var/tmp/diff_new_pack.oiVzqr/_new 2020-04-19 21:49:17.236058796 +0200
@@ -1,8 +1,8 @@
Index: iniparse/ini.py
===================================================================
---- iniparse/ini.py (revision 146)
-+++ iniparse/ini.py (working copy)
-@@ -232,8 +232,11 @@
+--- iniparse/ini.py.orig
++++ iniparse/ini.py
+@@ -240,8 +240,11 @@ class LineContainer(object):
if isinstance(d, list): self.extend(d)
else: self.add(d)
@@ -16,15 +16,15 @@
def extend(self, x):
for i in x: self.add(i)
-@@ -322,6 +325,7 @@
+@@ -331,6 +334,7 @@ class INISection(config.ConfigNamespace)
_optionxformvalue = None
_optionxformsource = None
_compat_skip_empty_lines = set()
+ _commented_options = {}
- def __init__(self, lineobj, defaults = None,
- optionxformvalue=None, optionxformsource=None):
+
+ def __init__(self, lineobj, defaults=None, optionxformvalue=None,
optionxformsource=None):
self._lines = [lineobj]
-@@ -371,7 +375,10 @@
+@@ -380,7 +384,10 @@ class INISection(config.ConfigNamespace)
if xkey not in self._options:
# create a dummy object - value may have multiple lines
obj = LineContainer(OptionLine(key, ''))
@@ -36,50 +36,50 @@
self._options[xkey] = obj
# the set_value() function in LineContainer
# automatically handles multi-line values
-@@ -546,6 +553,7 @@
+@@ -556,6 +563,7 @@ class INIConfig(config.ConfigNamespace):
except AttributeError:
fname = '<???>'
- linecount = 0
+ line_count = 0
+ sectionlinecount = 0
exc = None
line = None
-@@ -565,6 +573,8 @@
- raise MissingSectionHeaderError(fname, linecount, line)
+@@ -574,6 +582,8 @@ class INIConfig(config.ConfigNamespace):
+ raise MissingSectionHeaderError(fname, line_count, line)
else:
- lineobj = make_comment(line)
+ line_obj = make_comment(line)
+ if cur_section:
+ sectionlinecount += 1
- if lineobj is None:
+ if line_obj is None:
if self._parse_exc:
-@@ -611,6 +621,7 @@
+@@ -622,6 +632,7 @@ class INIConfig(config.ConfigNamespace):
pending_empty_lines = False
- cur_section = LineContainer(lineobj)
+ cur_section = LineContainer(line_obj)
self._data.add(cur_section)
+ sectionlinecount = 1
cur_option = None
cur_option_name = None
if cur_section.name == DEFAULTSECT:
-@@ -630,6 +641,13 @@
+@@ -641,6 +652,13 @@ class INIConfig(config.ConfigNamespace):
- if isinstance(lineobj, (CommentLine, EmptyLine)):
- pending_lines.append(lineobj)
-+ if isinstance(lineobj, CommentLine) and cur_section_name and
cur_section_name != 'DEFAULT':
+ if isinstance(line_obj, (CommentLine, EmptyLine)):
+ pending_lines.append(line_obj)
++ if isinstance(line_obj, CommentLine) and cur_section_name and
cur_section_name != 'DEFAULT':
+ # check if there is a config line in the comment
-+ comment_lineobj = self._parse(lineobj.comment.strip())
++ comment_lineobj = self._parse(line_obj.comment.strip())
+ if isinstance(comment_lineobj, OptionLine):
+ obj = LineContainer(comment_lineobj)
+
self._sections[cur_section_name]._commented_options[obj.name] = sectionlinecount
+ sectionlinecount += 1
- if isinstance(lineobj, EmptyLine):
+ if isinstance(line_obj, EmptyLine):
pending_empty_lines = True
Index: tests/test_ini.py
===================================================================
---- tests/test_ini.py (revision 146)
-+++ tests/test_ini.py (working copy)
-@@ -393,7 +393,41 @@
+--- tests/test_ini.py.orig
++++ tests/test_ini.py
+@@ -404,6 +404,40 @@ another = baz
ip.section.another = 'baz'
self.assertEqual(str(ip), self.s6)
@@ -88,7 +88,7 @@
+[section]
+# Hello
+# option1 = foo
-
++
+#option2=bazz
+#option3=spam
+bumble=bee
@@ -117,7 +117,6 @@
+ ip.section.option3 = 'spam'
+ self.assertEqual(str(ip), self.s8)
+
-+
- class suite(unittest.TestSuite):
+
+ class Suite(unittest.TestSuite):
def __init__(self):
- unittest.TestSuite.__init__(self, [