Auto sync2gitlab import of python-iniparse-0.4-31.el8.src.rpm
This commit is contained in:
parent
2dfdc02a92
commit
bc167a93f0
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/iniparse-0.4.tar.gz
|
27
fix-issue-28.patch
Normal file
27
fix-issue-28.patch
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
From b3d6ea5ed88b0e6cf9fdb411a14e725665ded92e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Tim Lauridsen <timlau@fedoraproject.org>
|
||||||
|
Date: Fri, 7 Mar 2014 19:06:40 +0100
|
||||||
|
Subject: [PATCH] Fix handling of REM xxxxxxxx as a comment, but REMXXXX is not
|
||||||
|
(upstream issue #28)
|
||||||
|
|
||||||
|
---
|
||||||
|
tests/test_ini.py | 3 +--
|
||||||
|
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tests/test_ini.py b/tests/test_ini.py
|
||||||
|
index 07d4f4e..6d974f0 100644
|
||||||
|
--- a/tests/test_ini.py
|
||||||
|
+++ b/tests/test_ini.py
|
||||||
|
@@ -144,8 +144,7 @@ class test_comment_line(unittest.TestCase):
|
||||||
|
'#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:
|
||||||
|
--
|
||||||
|
1.8.5.3
|
||||||
|
|
523
python-iniparse-python3-compat.patch
Normal file
523
python-iniparse-python3-compat.patch
Normal file
@ -0,0 +1,523 @@
|
|||||||
|
Index: iniparse/__init__.py
|
||||||
|
===================================================================
|
||||||
|
--- iniparse/__init__.py (revision 146)
|
||||||
|
+++ iniparse/__init__.py (working copy)
|
||||||
|
@@ -3,17 +3,17 @@
|
||||||
|
# Copyright (c) 2007 Tim Lauridsen <tla@rasmil.dk>
|
||||||
|
# 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',
|
||||||
|
Index: iniparse/compat.py
|
||||||
|
===================================================================
|
||||||
|
--- iniparse/compat.py (revision 146)
|
||||||
|
+++ iniparse/compat.py (working copy)
|
||||||
|
@@ -12,20 +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 ini
|
||||||
|
+import six
|
||||||
|
|
||||||
|
+from . import ini
|
||||||
|
+
|
||||||
|
class RawConfigParser(object):
|
||||||
|
def __init__(self, defaults=None, dict_type=dict):
|
||||||
|
if dict_type != dict:
|
||||||
|
@@ -56,7 +58,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)
|
||||||
|
@@ -88,7 +90,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:
|
||||||
|
@@ -143,7 +145,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 +236,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 +285,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
|
||||||
|
Index: iniparse/config.py
|
||||||
|
===================================================================
|
||||||
|
--- iniparse/config.py (revision 146)
|
||||||
|
+++ iniparse/config.py (working copy)
|
||||||
|
@@ -143,7 +143,7 @@
|
||||||
|
|
||||||
|
>>> n.aaa = 42
|
||||||
|
>>> del n.x
|
||||||
|
- >>> print n
|
||||||
|
+ >>> print(n)
|
||||||
|
aaa = 42
|
||||||
|
name.first = paramjit
|
||||||
|
name.last = oberoi
|
||||||
|
@@ -152,7 +152,7 @@
|
||||||
|
|
||||||
|
>>> isinstance(n.name, ConfigNamespace)
|
||||||
|
True
|
||||||
|
- >>> print n.name
|
||||||
|
+ >>> print(n.name)
|
||||||
|
first = paramjit
|
||||||
|
last = oberoi
|
||||||
|
>>> sorted(list(n.name))
|
||||||
|
@@ -160,7 +160,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 +171,7 @@
|
||||||
|
... ''')
|
||||||
|
>>> n = BasicConfig()
|
||||||
|
>>> n._readfp(sio)
|
||||||
|
- >>> print n
|
||||||
|
+ >>> print(n)
|
||||||
|
complexity = medium
|
||||||
|
data.secret.password = goodness=gracious me
|
||||||
|
have_python
|
||||||
|
@@ -199,7 +199,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 +258,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 +267,7 @@
|
||||||
|
>>> from iniparse import ini
|
||||||
|
>>> i = ini.INIConfig()
|
||||||
|
>>> update_config(i, n)
|
||||||
|
- >>> print i
|
||||||
|
+ >>> print(i)
|
||||||
|
[playlist]
|
||||||
|
expand_playlist = True
|
||||||
|
<BLANKLINE>
|
||||||
|
@@ -277,7 +277,7 @@
|
||||||
|
width = 150
|
||||||
|
|
||||||
|
"""
|
||||||
|
- for name in source:
|
||||||
|
+ for name in sorted(source):
|
||||||
|
value = source[name]
|
||||||
|
if isinstance(value, ConfigNamespace):
|
||||||
|
if name in target:
|
||||||
|
Index: iniparse/configparser.py
|
||||||
|
===================================================================
|
||||||
|
--- iniparse/configparser.py (revision 0)
|
||||||
|
+++ iniparse/configparser.py (working copy)
|
||||||
|
@@ -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
|
||||||
|
Index: iniparse/ini.py
|
||||||
|
===================================================================
|
||||||
|
--- iniparse/ini.py (revision 146)
|
||||||
|
+++ iniparse/ini.py (working copy)
|
||||||
|
@@ -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,10 +42,12 @@
|
||||||
|
# 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 @@
|
||||||
|
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 @@
|
||||||
|
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 @@
|
||||||
|
|
||||||
|
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
|
||||||
|
Index: iniparse/utils.py
|
||||||
|
===================================================================
|
||||||
|
--- iniparse/utils.py (revision 146)
|
||||||
|
+++ iniparse/utils.py (working copy)
|
||||||
|
@@ -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.
|
||||||
|
Index: tests/__init__.py
|
||||||
|
===================================================================
|
||||||
|
--- tests/__init__.py (revision 146)
|
||||||
|
+++ tests/__init__.py (working copy)
|
||||||
|
@@ -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
|
||||||
|
|
||||||
|
Index: tests/test_compat.py
|
||||||
|
===================================================================
|
||||||
|
--- tests/test_compat.py (revision 146)
|
||||||
|
+++ tests/test_compat.py (working copy)
|
||||||
|
@@ -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 @@
|
||||||
|
|
||||||
|
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 @@
|
||||||
|
"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 @@
|
||||||
|
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 @@
|
||||||
|
"foo: another very\n"
|
||||||
|
" long line"
|
||||||
|
)
|
||||||
|
- output = StringIO.StringIO()
|
||||||
|
+ output = StringIO()
|
||||||
|
cf.write(output)
|
||||||
|
self.assertEqual(
|
||||||
|
output.getvalue(),
|
||||||
|
@@ -465,7 +472,7 @@
|
||||||
|
"o1=4\n"
|
||||||
|
"[a]\n"
|
||||||
|
"k=v\n")
|
||||||
|
- output = StringIO.StringIO()
|
||||||
|
+ output = StringIO()
|
||||||
|
self.cf.write(output)
|
||||||
|
self.assertEquals(output.getvalue(),
|
||||||
|
"[a]\n"
|
||||||
|
Index: tests/test_fuzz.py
|
||||||
|
===================================================================
|
||||||
|
--- tests/test_fuzz.py (revision 146)
|
||||||
|
+++ tests/test_fuzz.py (working copy)
|
||||||
|
@@ -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 @@
|
||||||
|
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 @@
|
||||||
|
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):
|
||||||
|
Index: tests/test_ini.py
|
||||||
|
===================================================================
|
||||||
|
--- tests/test_ini.py (revision 146)
|
||||||
|
+++ tests/test_ini.py (working copy)
|
||||||
|
@@ -1,5 +1,5 @@
|
||||||
|
import unittest
|
||||||
|
-from StringIO import StringIO
|
||||||
|
+from six import StringIO
|
||||||
|
|
||||||
|
from iniparse import ini
|
||||||
|
from iniparse import compat
|
||||||
|
@@ -196,13 +196,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')
|
||||||
|
Index: tests/test_misc.py
|
||||||
|
===================================================================
|
||||||
|
--- tests/test_misc.py (revision 146)
|
||||||
|
+++ tests/test_misc.py (working copy)
|
||||||
|
@@ -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):
|
||||||
|
Index: tests/test_tidy.py
|
||||||
|
===================================================================
|
||||||
|
--- tests/test_tidy.py (revision 146)
|
||||||
|
+++ tests/test_tidy.py (working copy)
|
||||||
|
@@ -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
|
||||||
|
Index: tests/test_unicode.py
|
||||||
|
===================================================================
|
||||||
|
--- tests/test_unicode.py (revision 146)
|
||||||
|
+++ tests/test_unicode.py (working copy)
|
||||||
|
@@ -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 @@
|
||||||
|
"""
|
||||||
|
|
||||||
|
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):
|
48
python-iniparse-setup-fixes.patch
Normal file
48
python-iniparse-setup-fixes.patch
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
diff --git a/PKG-INFO b/PKG-INFO
|
||||||
|
index 31c4ad2..bebcb80 100644
|
||||||
|
--- PKG-INFO
|
||||||
|
+++ PKG-INFO
|
||||||
|
@@ -18,7 +18,10 @@ 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.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/setup.py b/setup.py
|
||||||
|
index 736cfa1..e2f8de0 100644
|
||||||
|
--- setup.py
|
||||||
|
+++ 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',
|
235
python-iniparse.spec
Normal file
235
python-iniparse.spec
Normal file
@ -0,0 +1,235 @@
|
|||||||
|
%global modname iniparse
|
||||||
|
|
||||||
|
# Use the same directory of the main package for subpackage licence and docs
|
||||||
|
%global _docdir_fmt %{name}
|
||||||
|
|
||||||
|
Name: python-%{modname}
|
||||||
|
Version: 0.4
|
||||||
|
Release: 31%{?dist}
|
||||||
|
Summary: Python Module for Accessing and Modifying Configuration Data in INI files
|
||||||
|
License: MIT and Python
|
||||||
|
URL: http://code.google.com/p/iniparse/
|
||||||
|
Source0: http://iniparse.googlecode.com/files/%{modname}-%{version}.tar.gz
|
||||||
|
Patch0: fix-issue-28.patch
|
||||||
|
# The patch upstream (http://code.google.com/p/iniparse/issues/detail?id=22)
|
||||||
|
# is Python3-only. The patch below uses python-six to create a version that works
|
||||||
|
# with both Python major versions and is more error-prone.
|
||||||
|
Patch1: %{name}-python3-compat.patch
|
||||||
|
# Fixup the module to have proper setup.py information
|
||||||
|
Patch2: %{name}-setup-fixes.patch
|
||||||
|
|
||||||
|
BuildArch: noarch
|
||||||
|
|
||||||
|
%global _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.
|
||||||
|
|
||||||
|
%description %{_description}
|
||||||
|
|
||||||
|
%package -n python3-%{modname}
|
||||||
|
Summary: %{summary}
|
||||||
|
%{?python_provide:%python_provide python3-%{modname}}
|
||||||
|
BuildRequires: python3-devel
|
||||||
|
BuildRequires: python3-setuptools
|
||||||
|
BuildRequires: python3-six
|
||||||
|
BuildRequires: python3-test
|
||||||
|
Requires: python3-six
|
||||||
|
Obsoletes: platform-python-%{modname} < %{version}-%{release}
|
||||||
|
|
||||||
|
%description -n python3-%{modname} %{_description}
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -q -n %{modname}-%{version}
|
||||||
|
%patch0 -p1
|
||||||
|
%patch1 -p0
|
||||||
|
%patch2 -p0
|
||||||
|
chmod -c -x html/index.html
|
||||||
|
|
||||||
|
%build
|
||||||
|
%py3_build
|
||||||
|
|
||||||
|
%install
|
||||||
|
%py3_install
|
||||||
|
rm -vfr %{buildroot}%{_docdir}/*
|
||||||
|
|
||||||
|
%check
|
||||||
|
%{__python3} runtests.py
|
||||||
|
|
||||||
|
%files -n python3-%{modname}
|
||||||
|
%license LICENSE LICENSE-PSF
|
||||||
|
%doc README Changelog html/
|
||||||
|
%{python3_sitelib}/%{modname}/
|
||||||
|
%{python3_sitelib}/%{modname}-%{version}-*.egg-info
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Thu May 31 2018 Petr Viktorin <pviktori@redhat.com> - 0.4-31
|
||||||
|
- Remove Python 2 subpackage
|
||||||
|
https://bugzilla.redhat.com/show_bug.cgi?id=1567873
|
||||||
|
|
||||||
|
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.4-30
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Dec 11 2017 Iryna Shcherbina <ishcherb@redhat.com> - 0.4-29
|
||||||
|
- Fix ambiguous Python 2 dependency declarations
|
||||||
|
(See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
|
||||||
|
|
||||||
|
* Tue Nov 07 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.4-28
|
||||||
|
- Use better Obsoletes for platform-python
|
||||||
|
|
||||||
|
* Fri Nov 03 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.4-27
|
||||||
|
- Remove platform-python subpackage
|
||||||
|
|
||||||
|
* Thu Aug 10 2017 Miro Hrončok <mhroncok@redhat.com> - 0.4-26
|
||||||
|
- Add platform-python package
|
||||||
|
- Add bconds
|
||||||
|
- Remove %%{?system_python_abi}
|
||||||
|
|
||||||
|
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.4-25
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
|
||||||
|
|
||||||
|
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.4-24
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
|
||||||
|
|
||||||
|
* Sun Dec 11 2016 Neal Gompa <ngompa13@gmail.com> - 0.4-23
|
||||||
|
- Add patch to update setup.py to use setuptools and declare install dependencies
|
||||||
|
|
||||||
|
* Fri Dec 09 2016 Charalampos Stratakis <cstratak@redhat.com> - 0.4-22
|
||||||
|
- Rebuild for Python 3.6
|
||||||
|
|
||||||
|
* Tue Aug 09 2016 Igor Gnatenko <ignatenko@redhat.com> - 0.4-21
|
||||||
|
- Cleanups
|
||||||
|
- Add %%{?system_python_abi}
|
||||||
|
|
||||||
|
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4-20
|
||||||
|
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
|
||||||
|
|
||||||
|
* Tue Apr 12 2016 Igor Gnatenko <ignatenko@redhat.com> - 0.4-19
|
||||||
|
- Make python3 builds conditionally
|
||||||
|
- Adopt to new packaging guidelines
|
||||||
|
- Remove setuptools from BRs as it's not needed
|
||||||
|
- Cleanup spec
|
||||||
|
|
||||||
|
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.4-18
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
|
||||||
|
|
||||||
|
* Wed Oct 14 2015 Robert Kuska <rkuska@redhat.com> - 0.4-17
|
||||||
|
- Rebuilt for Python3.5 rebuild
|
||||||
|
|
||||||
|
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4-16
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
|
||||||
|
|
||||||
|
* Thu Jul 31 2014 Tom Callaway <spot@fedoraproject.org> - 0.4-15
|
||||||
|
- fix license handling
|
||||||
|
|
||||||
|
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4-14
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
|
||||||
|
|
||||||
|
* Wed May 14 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 0.4-13
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
|
||||||
|
|
||||||
|
* Fri Mar 07 2014 Tim Lauridsen <timlau@fedoraproject.org> - 0.4-12
|
||||||
|
- added python3-test to buildreq for python3
|
||||||
|
- run unittest with python3 also
|
||||||
|
|
||||||
|
* Fri Mar 07 2014 Tim Lauridsen <timlau@fedoraproject.org> - 0.4-11
|
||||||
|
- added python-test to buildreq, for unittests
|
||||||
|
|
||||||
|
* Fri Mar 07 2014 Tim Lauridsen <timlau@fedoraproject.org> - 0.4-10
|
||||||
|
- added %%check to run unittests when build
|
||||||
|
- updated fix-issue-28.patch, so test cases dont fail
|
||||||
|
|
||||||
|
* Fri Sep 20 2013 Bohuslav Kabrda <bkabrda@redhat.com> - 0.4-9
|
||||||
|
- Introduce python3 subpackage.
|
||||||
|
- Use %%__python2 instead of %%__python.
|
||||||
|
|
||||||
|
* Mon Jul 29 2013 Ville Skyttä <ville.skytta@iki.fi> - 0.4-8
|
||||||
|
- Install docs to %%{_pkgdocdir} where available.
|
||||||
|
|
||||||
|
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4-7
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
|
||||||
|
|
||||||
|
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4-6
|
||||||
|
- fix for upstream issue 28
|
||||||
|
|
||||||
|
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4-5
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
|
||||||
|
|
||||||
|
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4-4
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
|
||||||
|
|
||||||
|
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4-3
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
|
||||||
|
|
||||||
|
* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 0.4-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
|
||||||
|
|
||||||
|
|
||||||
|
* Sat Nov 7 2009 Tim Lauridsen <timlau@fedoraproject.org> - 0.4-1
|
||||||
|
- Release 0.4
|
||||||
|
|
||||||
|
* Sat Nov 7 2009 Tim Lauridsen <timlau@fedoraproject.org> - 0.3.1-2
|
||||||
|
- removed patch
|
||||||
|
|
||||||
|
* Sat Nov 7 2009 Tim Lauridsen <timlau@fedoraproject.org> - 0.3.1-1
|
||||||
|
- Release 0.3.1
|
||||||
|
- Fix empty-line handling bugs introduced in 0.3.0
|
||||||
|
|
||||||
|
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.0-3
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Mar 2 2009 Tim Lauridsen <timlau@fedoraproject.org> - 0.3.0-2
|
||||||
|
- added patch from upstream to fix regrestion :
|
||||||
|
|
||||||
|
* Sat Feb 28 2009 Tim Lauridsen <timlau@fedoraproject.org> - 0.3.0-1
|
||||||
|
- Release 0.3.0
|
||||||
|
- Fix handling of continuation lines
|
||||||
|
- Fix DEFAULT handling
|
||||||
|
- Fix picking/unpickling
|
||||||
|
|
||||||
|
* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.4-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
|
||||||
|
|
||||||
|
* Sun Dec 7 2008 Tim Lauridsen <timlau@fedoraproject.org> - 0.2.4-1
|
||||||
|
- Release 0.2.4:
|
||||||
|
- Updated to work with Python-2.6 (Python-2.4 and 2.5 are still supported)
|
||||||
|
- Support for files opened in unicode mode
|
||||||
|
- Fixed Python-3.0 compatibility warnings
|
||||||
|
- Minor API cleanup
|
||||||
|
* Fri Nov 28 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 0.2.3-5
|
||||||
|
- Rebuild for Python 2.6
|
||||||
|
* Tue Jan 8 2008 Tim Lauridsen <timlau@fedoraproject.org> - 0.2.3-4
|
||||||
|
- own the %%{_docdir}/python-iniparse-%%{version} directory
|
||||||
|
* Tue Dec 11 2007 Tim Lauridsen <timlau@fedoraproject.org> - 0.2.3-3
|
||||||
|
- handle egg-info too
|
||||||
|
* Tue Dec 11 2007 Tim Lauridsen <timlau@fedoraproject.org> - 0.2.3-2
|
||||||
|
- removed patch source line
|
||||||
|
* Tue Dec 11 2007 Tim Lauridsen <timlau@fedoraproject.org> - 0.2.3-1
|
||||||
|
- Updates to release 0.2.3
|
||||||
|
- removed empty ini file patch, it is included in 0.2.3
|
||||||
|
* Mon Nov 19 2007 Tim Lauridsen <timlau@fedoraproject.org> - 0.2.2-2
|
||||||
|
- Added upstream patch to fix problems with empty ini files.
|
||||||
|
* Tue Sep 25 2007 Tim Lauridsen <timlau@fedoraproject.org> - 0.2.2-1
|
||||||
|
- Updated to release 0.2.2
|
||||||
|
- removed patch to to fix problems with out commented lines, included in upstream source
|
||||||
|
* Wed Sep 12 2007 Tim Lauridsen <timlau@fedoraproject.org> - 0.2.1-4
|
||||||
|
- Added some logic to get the right python-setuptools buildrequeres
|
||||||
|
- based on the fedora version, to make the same spec file useful in
|
||||||
|
- all fedora releases.
|
||||||
|
* Mon Sep 10 2007 Tim Lauridsen <timlau@fedoraproject.org> - 0.2.1-3
|
||||||
|
- Added patch from upstream svn to fix problems with out commented lines.
|
||||||
|
* Tue Aug 28 2007 Tim Lauridsen <timlau@fedoraproject.org> - 0.2.1-2
|
||||||
|
- Changed BuildRequires python-setuptools to python-setuptools-devel
|
||||||
|
* Tue Aug 7 2007 Paramjit Oberoi <param@cs.wisc.edu> - 0.2.1-1
|
||||||
|
- Release 0.2.1
|
||||||
|
* Fri Jul 27 2007 Tim Lauridsen <timlau@fedoraproject.org> - 0.2-3
|
||||||
|
- relocated doc to %%{_docdir}/python-iniparse-%%{version}
|
||||||
|
* Thu Jul 26 2007 Tim Lauridsen <timlau@fedoraproject.org> - 0.2-2
|
||||||
|
- changed name from iniparse to python-iniparse
|
||||||
|
* Tue Jul 17 2007 Tim Lauridsen <timlau@fedoraproject.org> - 0.2-1
|
||||||
|
- Release 0.2
|
||||||
|
- Added html/* to %%doc
|
||||||
|
* Fri Jul 13 2007 Tim Lauridsen <timlau@fedoraproject.org> - 0.1-1
|
||||||
|
- Initial build.
|
Loading…
Reference in New Issue
Block a user