pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
py-iniparse: python3-compatible py-iniparse (textproc/py-iniparse + patches from Fedora).
Module Name: pkgsrc-wip
Committed By: Aleksej Lebedev <root%zta.lk@localhost>
Pushed By: zhtw
Date: Tue Oct 1 16:33:03 2019 +0200
Changeset: 3450cf1e36b12c663bccc99cf728cb1f40c535d2
Added Files:
py-iniparse/DESCR
py-iniparse/Makefile
py-iniparse/PLIST
py-iniparse/distinfo
py-iniparse/patches/patch-PKG-INFO
py-iniparse/patches/patch-iniparse_____init____.py
py-iniparse/patches/patch-iniparse_compat.py
py-iniparse/patches/patch-iniparse_config.py
py-iniparse/patches/patch-iniparse_configparser.py
py-iniparse/patches/patch-iniparse_ini.py
py-iniparse/patches/patch-iniparse_utils.py
py-iniparse/patches/patch-setup.py
py-iniparse/patches/patch-tests_____init____.py
py-iniparse/patches/patch-tests_test__compat.py
py-iniparse/patches/patch-tests_test__fuzz.py
py-iniparse/patches/patch-tests_test__ini.py
py-iniparse/patches/patch-tests_test__misc.py
py-iniparse/patches/patch-tests_test__tidy.py
py-iniparse/patches/patch-tests_test__unicode.py
Log Message:
py-iniparse: python3-compatible py-iniparse (textproc/py-iniparse + patches from Fedora).
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=3450cf1e36b12c663bccc99cf728cb1f40c535d2
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
py-iniparse/DESCR | 19 +++++
py-iniparse/Makefile | 20 ++++++
py-iniparse/PLIST | 30 ++++++++
py-iniparse/distinfo | 21 ++++++
py-iniparse/patches/patch-PKG-INFO | 17 +++++
py-iniparse/patches/patch-iniparse_____init____.py | 32 +++++++++
py-iniparse/patches/patch-iniparse_compat.py | 80 ++++++++++++++++++++++
py-iniparse/patches/patch-iniparse_config.py | 76 ++++++++++++++++++++
py-iniparse/patches/patch-iniparse_configparser.py | 12 ++++
py-iniparse/patches/patch-iniparse_ini.py | 72 +++++++++++++++++++
py-iniparse/patches/patch-iniparse_utils.py | 12 ++++
py-iniparse/patches/patch-setup.py | 31 +++++++++
py-iniparse/patches/patch-tests_____init____.py | 24 +++++++
py-iniparse/patches/patch-tests_test__compat.py | 69 +++++++++++++++++++
py-iniparse/patches/patch-tests_test__fuzz.py | 58 ++++++++++++++++
py-iniparse/patches/patch-tests_test__ini.py | 28 ++++++++
py-iniparse/patches/patch-tests_test__misc.py | 16 +++++
py-iniparse/patches/patch-tests_test__tidy.py | 12 ++++
py-iniparse/patches/patch-tests_test__unicode.py | 30 ++++++++
19 files changed, 659 insertions(+)
diffs:
diff --git a/py-iniparse/DESCR b/py-iniparse/DESCR
new file mode 100644
index 0000000000..80f04d9e31
--- /dev/null
+++ b/py-iniparse/DESCR
@@ -0,0 +1,19 @@
+iniparse is a INI parser for Python which is:
+
+ * Compatiable with ConfigParser: Backward compatible implementations of
+ ConfigParser, RawConfigParser, and SafeConfigParser are included that are API
+ compatible with the Python standard library. They pass all the unit tests
+ included with Python;
+
+ * 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.
diff --git a/py-iniparse/Makefile b/py-iniparse/Makefile
new file mode 100644
index 0000000000..14aaf7479d
--- /dev/null
+++ b/py-iniparse/Makefile
@@ -0,0 +1,20 @@
+# $NetBSD: Makefile,v 1.11 2019/04/26 13:14:17 maya Exp $
+
+DISTNAME= iniparse-0.4
+PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
+CATEGORIES= python textproc
+MASTER_SITES= http://iniparse.googlecode.com/files/
+
+MAINTAINER= pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE= https://pypi.python.org/pypi/iniparse/
+COMMENT= Better INI parser for Python
+LICENSE= mit AND python-software-foundation
+
+USE_LANGUAGES= # none
+
+post-install:
+ ${CHMOD} -x ${DESTDIR}${PREFIX}/share/doc/iniparse-0.4/index.html
+ cd ${DESTDIR}${PREFIX} && ${MV} share/doc/${DISTNAME} share/doc/${PYPKGPREFIX}-${DISTNAME}
+
+.include "../../lang/python/distutils.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/py-iniparse/PLIST b/py-iniparse/PLIST
new file mode 100644
index 0000000000..f4b720fb5f
--- /dev/null
+++ b/py-iniparse/PLIST
@@ -0,0 +1,30 @@
+@comment $NetBSD$
+${PYSITELIB}/${EGG_FILE}/PKG-INFO
+${PYSITELIB}/${EGG_FILE}/SOURCES.txt
+${PYSITELIB}/${EGG_FILE}/dependency_links.txt
+${PYSITELIB}/${EGG_FILE}/requires.txt
+${PYSITELIB}/${EGG_FILE}/top_level.txt
+${PYSITELIB}/iniparse/__init__.py
+${PYSITELIB}/iniparse/__init__.pyo
+${PYSITELIB}/iniparse/__init__.pyc
+${PYSITELIB}/iniparse/compat.pyo
+${PYSITELIB}/iniparse/compat.pyc
+${PYSITELIB}/iniparse/config.pyo
+${PYSITELIB}/iniparse/config.pyc
+${PYSITELIB}/iniparse/configparser.pyo
+${PYSITELIB}/iniparse/configparser.pyc
+${PYSITELIB}/iniparse/ini.pyo
+${PYSITELIB}/iniparse/ini.pyc
+${PYSITELIB}/iniparse/utils.pyo
+${PYSITELIB}/iniparse/utils.pyc
+${PYSITELIB}/iniparse/compat.py
+${PYSITELIB}/iniparse/config.py
+${PYSITELIB}/iniparse/configparser.py
+${PYSITELIB}/iniparse/ini.py
+${PYSITELIB}/iniparse/utils.py
+share/doc/${PKGNAME}/Changelog
+share/doc/${PKGNAME}/LICENSE
+share/doc/${PKGNAME}/LICENSE-PSF
+share/doc/${PKGNAME}/README
+share/doc/${PKGNAME}/index.html
+share/doc/${PKGNAME}/style.css
diff --git a/py-iniparse/distinfo b/py-iniparse/distinfo
new file mode 100644
index 0000000000..10646b95bc
--- /dev/null
+++ b/py-iniparse/distinfo
@@ -0,0 +1,21 @@
+$NetBSD: distinfo,v 1.2 2015/11/04 02:00:03 agc Exp $
+
+SHA1 (iniparse-0.4.tar.gz) = 2b2af8a19f3e5c212c27d7c524cd748fa0b38650
+RMD160 (iniparse-0.4.tar.gz) = f4cb5edc035e787acea428a7d21343d986f85f5c
+SHA512 (iniparse-0.4.tar.gz) = d59eae7c1ce474c89eddb0b0cbff5973444571728aa0c6ce5b3632984353415f7eec4de63cf007c276df0d1bb914b2ea5dd0acc00f3a261285c8e2e9883fbe9a
+Size (iniparse-0.4.tar.gz) = 31278 bytes
+SHA1 (patch-PKG-INFO) = c23f5e9c5a78f41788d8421ea8d06d4c34ceddbe
+SHA1 (patch-iniparse_____init____.py) = f06881132960a2d3af678f50d041bb0b6fabcba7
+SHA1 (patch-iniparse_compat.py) = 9ed2b4cfe3e339120a10f104cc3a62d8481085da
+SHA1 (patch-iniparse_config.py) = 7282df411af5847068c8035a04c8a549437a9c5c
+SHA1 (patch-iniparse_configparser.py) = cc2fddbb97d64930bf7a59e8045b39a51e74c2ed
+SHA1 (patch-iniparse_ini.py) = 7d68940e0e0e700971cefe99df5378425e83b1ae
+SHA1 (patch-iniparse_utils.py) = aaaeb0e19457bef3e41c846dec75708bd610beeb
+SHA1 (patch-setup.py) = 813fd94a13ee198cd8cc4b1dab358dc806e28e21
+SHA1 (patch-tests_____init____.py) = f7abac75d190fc502e5590a2fc3529ec8c7ac85d
+SHA1 (patch-tests_test__compat.py) = f7f1a4b30e08afcc56d9e521e68ca46f38058bf7
+SHA1 (patch-tests_test__fuzz.py) = ab0745d9349e9461b4a86313ceddd4994e13c265
+SHA1 (patch-tests_test__ini.py) = 54c24e74cf907e7ea4db327d35b9e2652d122e19
+SHA1 (patch-tests_test__misc.py) = b21cee221914da2e459c67a449a73e63c799f890
+SHA1 (patch-tests_test__tidy.py) = 5aa73f3bf1321afe5bfc33d03543003ae9c282bd
+SHA1 (patch-tests_test__unicode.py) = e91cb289c423d586153884f09d2e0cb1ba62700a
diff --git a/py-iniparse/patches/patch-PKG-INFO b/py-iniparse/patches/patch-PKG-INFO
new file mode 100644
index 0000000000..07455789fc
--- /dev/null
+++ b/py-iniparse/patches/patch-PKG-INFO
@@ -0,0 +1,17 @@
+$NetBSD$
+
+--- PKG-INFO.orig 2010-06-12 16:47:42.000000000 +0000
++++ PKG-INFO
+@@ -18,7 +18,10 @@ Classifier: License :: OSI Approved :: M
+ 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 --git a/py-iniparse/patches/patch-iniparse_____init____.py b/py-iniparse/patches/patch-iniparse_____init____.py
new file mode 100644
index 0000000000..0be0c9c4db
--- /dev/null
+++ b/py-iniparse/patches/patch-iniparse_____init____.py
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- iniparse/__init__.py.orig 2010-05-08 19:36:42.000000000 +0000
++++ iniparse/__init__.py
+@@ -3,17 +3,17 @@
+ # Copyright (c) 2007 Tim Lauridsen <tla%rasmil.dk@localhost>
+ # 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 --git a/py-iniparse/patches/patch-iniparse_compat.py b/py-iniparse/patches/patch-iniparse_compat.py
new file mode 100644
index 0000000000..074dfb32af
--- /dev/null
+++ b/py-iniparse/patches/patch-iniparse_compat.py
@@ -0,0 +1,80 @@
+$NetBSD$
+
+--- iniparse/compat.py.orig 2010-05-08 00:51:42.000000000 +0000
++++ iniparse/compat.py
+@@ -12,19 +12,21 @@ The underlying INIConfig object can be a
+ """
+
+ 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 ini
++import six
++
++from . import ini
+
+ class RawConfigParser(object):
+ def __init__(self, defaults=None, dict_type=dict):
+@@ -56,7 +58,7 @@ class RawConfigParser(object):
+ # 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)
+@@ -88,7 +90,7 @@ class RawConfigParser(object):
+ filename may also be given.
+ """
+ files_read = []
+- if isinstance(filenames, basestring):
++ if isinstance(filenames, six.string_types):
+ filenames = [filenames]
+ for filename in filenames:
+ try:
+@@ -143,7 +145,7 @@ class RawConfigParser(object):
+ 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 +236,7 @@ class ConfigParser(RawConfigParser):
+ 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 +285,7 @@ class SafeConfigParser(ConfigParser):
+ _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
diff --git a/py-iniparse/patches/patch-iniparse_config.py b/py-iniparse/patches/patch-iniparse_config.py
new file mode 100644
index 0000000000..63f8ae43e6
--- /dev/null
+++ b/py-iniparse/patches/patch-iniparse_config.py
@@ -0,0 +1,76 @@
+$NetBSD$
+
+--- iniparse/config.py.orig 2010-05-08 19:55:43.000000000 +0000
++++ iniparse/config.py
+@@ -143,7 +143,7 @@ class BasicConfig(ConfigNamespace):
+
+ >>> n.aaa = 42
+ >>> del n.x
+- >>> print n
++ >>> print(n)
+ aaa = 42
+ name.first = paramjit
+ name.last = oberoi
+@@ -152,7 +152,7 @@ class BasicConfig(ConfigNamespace):
+
+ >>> isinstance(n.name, ConfigNamespace)
+ True
+- >>> print n.name
++ >>> print(n.name)
+ first = paramjit
+ last = oberoi
+ >>> sorted(list(n.name))
+@@ -160,7 +160,7 @@ class BasicConfig(ConfigNamespace):
+
+ 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 +171,7 @@ class BasicConfig(ConfigNamespace):
+ ... ''')
+ >>> n = BasicConfig()
+ >>> n._readfp(sio)
+- >>> print n
++ >>> print(n)
+ complexity = medium
+ data.secret.password = goodness=gracious me
+ have_python
+@@ -199,7 +199,7 @@ class BasicConfig(ConfigNamespace):
+
+ 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 +258,7 @@ def update_config(target, source):
+ >>> 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 +267,7 @@ def update_config(target, source):
+ >>> from iniparse import ini
+ >>> i = ini.INIConfig()
+ >>> update_config(i, n)
+- >>> print i
++ >>> print(i)
+ [playlist]
+ expand_playlist = True
+ <BLANKLINE>
+@@ -277,7 +277,7 @@ def update_config(target, source):
+ width = 150
+
+ """
+- for name in source:
++ for name in sorted(source):
+ value = source[name]
+ if isinstance(value, ConfigNamespace):
+ if name in target:
diff --git a/py-iniparse/patches/patch-iniparse_configparser.py b/py-iniparse/patches/patch-iniparse_configparser.py
new file mode 100644
index 0000000000..6af59655cd
--- /dev/null
+++ b/py-iniparse/patches/patch-iniparse_configparser.py
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- iniparse/configparser.py.orig 2019-10-01 14:22:56.883205200 +0000
++++ iniparse/configparser.py
+@@ -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 --git a/py-iniparse/patches/patch-iniparse_ini.py b/py-iniparse/patches/patch-iniparse_ini.py
new file mode 100644
index 0000000000..cb68311ed4
--- /dev/null
+++ b/py-iniparse/patches/patch-iniparse_ini.py
@@ -0,0 +1,72 @@
+$NetBSD$
+
+--- iniparse/ini.py.orig 2010-05-08 19:36:42.000000000 +0000
++++ iniparse/ini.py
+@@ -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 @@ Example:
+ ... 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,11 @@ Example:
+ # Backward-compatiable with ConfigParser
+
+ import re
+-from ConfigParser import DEFAULTSECT, ParsingError, MissingSectionHeaderError
++from .configparser import DEFAULTSECT, ParsingError, MissingSectionHeaderError
+
+-import config
++import six
++
++from . import config
+
+ class LineType(object):
+ line = None
+@@ -278,6 +280,8 @@ class LineContainer(object):
+ value = property(get_value, set_value)
+
+ def __str__(self):
++ for c in self.contents:
++ pass#print(c.__str__())
+ s = [x.__str__() for x in self.contents]
+ return '\n'.join(s)
+
+@@ -465,7 +469,7 @@ class INIConfig(config.ConfigNamespace):
+ 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)
+@@ -551,7 +555,7 @@ class INIConfig(config.ConfigNamespace):
+
+ for line in readline_iterator(fp):
+ # Check for BOM on first line
+- if linecount == 0 and isinstance(line, unicode):
++ if linecount == 0 and isinstance(line, six.text_type):
+ if line[0] == u'\ufeff':
+ line = line[1:]
+ self._bom = True
diff --git a/py-iniparse/patches/patch-iniparse_utils.py b/py-iniparse/patches/patch-iniparse_utils.py
new file mode 100644
index 0000000000..675598faa9
--- /dev/null
+++ b/py-iniparse/patches/patch-iniparse_utils.py
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- iniparse/utils.py.orig 2010-05-08 19:36:42.000000000 +0000
++++ iniparse/utils.py
+@@ -1,5 +1,5 @@
+-import compat
+-from ini import LineContainer, EmptyLine
++from . import compat
++from .ini import LineContainer, EmptyLine
+
+ def tidy(cfg):
+ """Clean up blank lines.
diff --git a/py-iniparse/patches/patch-setup.py b/py-iniparse/patches/patch-setup.py
new file mode 100644
index 0000000000..fa67b4733a
--- /dev/null
+++ b/py-iniparse/patches/patch-setup.py
@@ -0,0 +1,31 @@
+$NetBSD$
+
+--- setup.py.orig 2010-06-12 16:15:40.000000000 +0000
++++ setup.py
+@@ -1,6 +1,6 @@
+ #!/usr/bin/env python
+
+-from distutils.core import setup
++from setuptools import setup
+
+ VERSION = '0.4'
+
+@@ -24,12 +24,16 @@ use.''',
+ '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',
+ 'LICENSE', 'Changelog',
diff --git a/py-iniparse/patches/patch-tests_____init____.py b/py-iniparse/patches/patch-tests_____init____.py
new file mode 100644
index 0000000000..1589969b4b
--- /dev/null
+++ b/py-iniparse/patches/patch-tests_____init____.py
@@ -0,0 +1,24 @@
+$NetBSD$
+
+--- tests/__init__.py.orig 2010-05-05 21:00:22.000000000 +0000
++++ tests/__init__.py
+@@ -1,12 +1,12 @@
+ 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
+
diff --git a/py-iniparse/patches/patch-tests_test__compat.py b/py-iniparse/patches/patch-tests_test__compat.py
new file mode 100644
index 0000000000..50d787bcf4
--- /dev/null
+++ b/py-iniparse/patches/patch-tests_test__compat.py
@@ -0,0 +1,69 @@
+$NetBSD$
+
+--- tests/test_compat.py.orig 2008-12-06 10:15:30.000000000 +0000
++++ tests/test_compat.py
+@@ -1,9 +1,16 @@
+ 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):
+@@ -35,7 +42,7 @@ class TestCaseBase(unittest.TestCase):
+
+ def fromstring(self, string, defaults=None):
+ cf = self.newconfig(defaults)
+- sio = StringIO.StringIO(string)
++ sio = StringIO(string)
+ cf.readfp(sio)
+ return cf
+
+@@ -161,7 +168,7 @@ class TestCaseBase(unittest.TestCase):
+ "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 +188,7 @@ class TestCaseBase(unittest.TestCase):
+ 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 +234,7 @@ class TestCaseBase(unittest.TestCase):
+ "foo: another very\n"
+ " long line"
+ )
+- output = StringIO.StringIO()
++ output = StringIO()
+ cf.write(output)
+ self.assertEqual(
+ output.getvalue(),
+@@ -465,7 +472,7 @@ class SortedTestCase(RawConfigParserTest
+ "o1=4\n"
+ "[a]\n"
+ "k=v\n")
+- output = StringIO.StringIO()
++ output = StringIO()
+ self.cf.write(output)
+ self.assertEquals(output.getvalue(),
+ "[a]\n"
diff --git a/py-iniparse/patches/patch-tests_test__fuzz.py b/py-iniparse/patches/patch-tests_test__fuzz.py
new file mode 100644
index 0000000000..131f17cede
--- /dev/null
+++ b/py-iniparse/patches/patch-tests_test__fuzz.py
@@ -0,0 +1,58 @@
+$NetBSD$
+
+--- tests/test_fuzz.py.orig 2010-05-08 19:36:42.000000000 +0000
++++ tests/test_fuzz.py
+@@ -1,9 +1,10 @@
+ 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:
+@@ -96,24 +97,25 @@ class test_fuzz(unittest.TestCase):
+ 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,9 +125,7 @@ class test_fuzz(unittest.TestCase):
+ 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):
+ def __init__(self):
diff --git a/py-iniparse/patches/patch-tests_test__ini.py b/py-iniparse/patches/patch-tests_test__ini.py
new file mode 100644
index 0000000000..1654637221
--- /dev/null
+++ b/py-iniparse/patches/patch-tests_test__ini.py
@@ -0,0 +1,28 @@
+$NetBSD$
+
+--- tests/test_ini.py.orig 2019-10-01 14:22:20.483058991 +0000
++++ tests/test_ini.py
+@@ -1,5 +1,5 @@
+ import unittest
+-from StringIO import StringIO
++from six import StringIO
+
+ from iniparse import ini
+ from iniparse import compat
+@@ -195,13 +195,13 @@ but = also me
+ 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')
diff --git a/py-iniparse/patches/patch-tests_test__misc.py b/py-iniparse/patches/patch-tests_test__misc.py
new file mode 100644
index 0000000000..507ba8d1f2
--- /dev/null
+++ b/py-iniparse/patches/patch-tests_test__misc.py
@@ -0,0 +1,16 @@
+$NetBSD$
+
+--- tests/test_misc.py.orig 2010-05-05 05:15:39.000000000 +0000
++++ tests/test_misc.py
+@@ -1,9 +1,9 @@
+ 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):
diff --git a/py-iniparse/patches/patch-tests_test__tidy.py b/py-iniparse/patches/patch-tests_test__tidy.py
new file mode 100644
index 0000000000..4e593cc0ec
--- /dev/null
+++ b/py-iniparse/patches/patch-tests_test__tidy.py
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- tests/test_tidy.py.orig 2010-05-08 19:36:42.000000000 +0000
++++ tests/test_tidy.py
+@@ -1,6 +1,6 @@
+ import unittest
+ from textwrap import dedent
+-from StringIO import StringIO
++from six import StringIO
+
+ from iniparse import tidy,INIConfig
+ from iniparse.ini import EmptyLine
diff --git a/py-iniparse/patches/patch-tests_test__unicode.py b/py-iniparse/patches/patch-tests_test__unicode.py
new file mode 100644
index 0000000000..fedc4d791e
--- /dev/null
+++ b/py-iniparse/patches/patch-tests_test__unicode.py
@@ -0,0 +1,30 @@
+$NetBSD$
+
+--- tests/test_unicode.py.orig 2008-12-06 06:44:49.000000000 +0000
++++ tests/test_unicode.py
+@@ -1,5 +1,5 @@
+ import unittest
+-from StringIO import StringIO
++import six
+ from iniparse import compat, ini
+
+ class test_unicode(unittest.TestCase):
+@@ -17,14 +17,14 @@ baz = Marc-Andr\202
+ """
+
+ 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):
Home |
Main Index |
Thread Index |
Old Index