Skip to content

Commit 02dc6d9

Browse files
committed
Add support for Python 3 (up to Python 3.7)
Add tox.ini file Add gitignore
1 parent a032f01 commit 02dc6d9

File tree

7 files changed

+34
-7
lines changed

7 files changed

+34
-7
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# build files
2+
*.pyc
3+
__pycache__
4+
*.egg-info
5+
.eggs
6+
dist
7+
build
8+
.tox

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ read configuration files, conf.d style
77
Requirements
88
============
99

10-
* Python 2.6+
10+
* Python 2.6+ or Python 3.4+
1111

1212
Installation
1313
============
@@ -20,7 +20,7 @@ From Github::
2020

2121
From PyPI::
2222

23-
pip install conf_d==0.0.3
23+
pip install conf_d==0.0.5
2424

2525
Usage
2626
=====

conf_d/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# -*- coding: utf-8 -*-
2-
import ConfigParser
32
import os
43

5-
__version__ = '0.0.4'
4+
from conf_d.compat import ConfigParser
5+
6+
__version__ = '0.0.5'
67

78

89
class Configuration():
910

10-
def __init__(self, name, path, parse=True, confd_path=None, conf_ext=None, main_defaults={}, section_defaults={}, main_parser=None, section_parser=None, path_from_main=None, config_parser=ConfigParser.ConfigParser):
11+
def __init__(self, name, path, parse=True, confd_path=None, conf_ext=None, main_defaults={}, section_defaults={}, main_parser=None, section_parser=None, path_from_main=None, config_parser=ConfigParser):
1112
self._conf_ext = conf_ext
1213
self._config_sections = {}
1314
self._confd_path = confd_path

conf_d/compat.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# -*- coding: utf-8 -*-
2+
from sys import version_info
3+
4+
if version_info[0] < 3:
5+
from ConfigParser import ConfigParser
6+
else:
7+
from configparser import ConfigParser

conf_d/tests/test_configuration.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# -*- coding: utf-8 -*-
2-
import ConfigParser
32
import unittest
43

54
from conf_d import Configuration
5+
from conf_d.compat import ConfigParser
66

7-
class TestConfigParser(ConfigParser.ConfigParser):
7+
8+
class TestConfigParser(ConfigParser):
89
def read(self, path):
910
raise NotImplementedError('Catch this')
1011

setup.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
'License :: OSI Approved :: MIT License',
3434
'Programming Language :: Python :: 2.6',
3535
'Programming Language :: Python :: 2.7',
36+
'Programming Language :: Python :: 3.4',
37+
'Programming Language :: Python :: 3.5',
38+
'Programming Language :: Python :: 3.6',
39+
'Programming Language :: Python :: 3.7',
3640
],
3741
description='read configuration files, conf.d style',
3842
long_description=open('README.rst').read() + '\n\n' +

tox.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[tox]
2+
envlist = py26,py27,py34,py35,py36,py37
3+
4+
[testenv]
5+
commands=
6+
python setup.py test

0 commit comments

Comments
 (0)