summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Shadura <andrew@shadura.me>2015-08-27 18:45:31 +0200
committerAndrew Shadura <andrew@shadura.me>2015-08-27 18:45:31 +0200
commit8864659127afd728d2ae3f10664f65bcda6f7417 (patch)
treee691707efe75f01667fc54b27167f59e80cc0908
parent0679d83fa29d8c818d407dabbf934e9a43aa2987 (diff)
Add Python3 support, use pybuild.
-rw-r--r--debian/changelog6
-rw-r--r--debian/control48
-rw-r--r--debian/patches/python3.patch81
-rw-r--r--debian/patches/series1
-rw-r--r--debian/python-reconfigure.install1
-rwxr-xr-xdebian/rules4
-rw-r--r--reconfigure/parsers/iniparse/config.py18
7 files changed, 147 insertions, 12 deletions
diff --git a/debian/changelog b/debian/changelog
index 43f6711..c650d52 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+python-reconfigure (0.1.74+git49a20890-3) UNRELEASED; urgency=medium
+
+ *
+
+ -- Andrew Shadura <andrewsh@debian.org> Fri, 21 Aug 2015 17:45:52 +0200
+
python-reconfigure (0.1.74+git49a20890-2) unstable; urgency=medium
* (Build-)Depend on python-iniparse and python-configparser.
diff --git a/debian/control b/debian/control
index fd941ee..f391358 100644
--- a/debian/control
+++ b/debian/control
@@ -6,12 +6,17 @@ Build-Depends:
dh-python,
python-setuptools (>= 0.6.24),
python-all (>= 2.6.6-3),
+ python3-setuptools (>= 0.6.24),
+ python3-all,
python-sphinx (>= 1.0.7+dfsg) | python3-sphinx,
python-chardet,
+ python3-chardet,
python-nose,
+ python3-nose,
python-iniparse,
python-configparser,
python-six,
+ python3-six,
debhelper (>= 9)
Standards-Version: 3.9.4
Homepage: http://eugeny.github.io/reconfigure
@@ -20,7 +25,7 @@ Package: python-reconfigure
Architecture: all
Depends: ${misc:Depends}, ${python:Depends}, python-configparser
Provides: ${python:Provides}
-Description: simple config file management library
+Description: simple config file management library (Python 2)
python-reconfigure provides easy and uniform access to various
kinds of configuration files, easily extendable with custom
parsers.
@@ -66,3 +71,44 @@ Description: simple config file management library (documentation)
parsers.
.
This package provides documentation to python-reconfigure.
+
+Package: python3-reconfigure
+Architecture: all
+Depends: ${misc:Depends}, ${python3:Depends}
+Description: simple config file management library (Python 3)
+ python-reconfigure provides easy and uniform access to various
+ kinds of configuration files, easily extendable with custom
+ parsers.
+ .
+ Supported configuration files:
+ * Ajenti (ajenti)
+ * BIND9 DNS (bind9)
+ * Crontabs (crontab)
+ * Samba CTDB (ctdb)
+ * ISC DHCPD / uDHCPD (dhcpd)
+ * NFS /etc/exports (exports)
+ * /etc/fstab (fstab)
+ * /etc/group (group)
+ * /etc/hosts (hosts)
+ * iptables-save dump (iptables)
+ * Netatalk afp.conf (netatalk)
+ * NSD DNS (nsd)
+ * /etc/passwd (passwd)
+ * /etc/resolv.conf (resolv)
+ * Samba (samba)
+ * Squid 3 (squid)
+ * Supervisord (supervisor)
+ .
+ Included parsers:
+ * BIND9 config (bind9)
+ * Crontab (crontab)
+ * NFS Exports (exports)
+ * .ini (ini)
+ * iptables-save (iptables)
+ * nginx-like (nginx)
+ * squid (squid)
+ * nsd (nsd)
+ * CSV-like space-separated values (ssv)
+ * JSON (jsonparser)
+ .
+ This is a Python 3 version of the package
diff --git a/debian/patches/python3.patch b/debian/patches/python3.patch
new file mode 100644
index 0000000..2ac23b6
--- /dev/null
+++ b/debian/patches/python3.patch
@@ -0,0 +1,81 @@
+Subject: Python3 compat
+From: Andrew Shadura <andrew@shadura.me>
+
+diff --git a/reconfigure/parsers/iniparse/config.py b/reconfigure/parsers/iniparse/config.py
+index d007f16..cc37ac4 100644
+--- a/reconfigure/parsers/iniparse/config.py
++++ b/reconfigure/parsers/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,8 +160,8 @@ class BasicConfig(ConfigNamespace):
+
+ Finally, values can be read from a file as follows:
+
+- >>> from StringIO import StringIO
+- >>> sio = StringIO('''
++ >>> from io import StringIO
++ >>> sio = StringIO(u'''
+ ... # comment
+ ... ui.height = 100
+ ... ui.width = 150
+@@ -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/debian/patches/series b/debian/patches/series
index de59d0e..ad4a200 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
remove-external-images.diff
+python3.patch
diff --git a/debian/python-reconfigure.install b/debian/python-reconfigure.install
deleted file mode 100644
index 6845771..0000000
--- a/debian/python-reconfigure.install
+++ /dev/null
@@ -1 +0,0 @@
-usr/lib
diff --git a/debian/rules b/debian/rules
index e9cfccc..7519210 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,7 +1,9 @@
#!/usr/bin/make -f
+export PYBUILD_NAME=reconfigure
+
%:
- dh $@ --with python2,sphinxdoc --buildsystem=pybuild
+ dh $@ --with python2,python3,sphinxdoc --buildsystem=pybuild
override_dh_auto_build:
dh_auto_build
diff --git a/reconfigure/parsers/iniparse/config.py b/reconfigure/parsers/iniparse/config.py
index d007f16..cc37ac4 100644
--- a/reconfigure/parsers/iniparse/config.py
+++ b/reconfigure/parsers/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,8 +160,8 @@ class BasicConfig(ConfigNamespace):
Finally, values can be read from a file as follows:
- >>> from StringIO import StringIO
- >>> sio = StringIO('''
+ >>> from io import StringIO
+ >>> sio = StringIO(u'''
... # comment
... ui.height = 100
... ui.width = 150
@@ -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: