diff options
author | Rob Dennis <robd@services-in.xr> | 2023-01-17 16:38:34 -0500 |
---|---|---|
committer | Rob Dennis <robd@services-in.xr> | 2023-01-17 16:38:34 -0500 |
commit | 3323078a05d57bf99adb16a71b69fcbcd48146ea (patch) | |
tree | 3c7e56e41aa4d6bbd682e011b0b94043ac27c011 | |
parent | 178ba90da21998968acb18cf02e7449741ddac4e (diff) | |
download | configobj-git-3323078a05d57bf99adb16a71b69fcbcd48146ea.tar.gz |
#128, #203 - re-implement the move to a configobj package done in master
-rw-r--r-- | .github/workflows/python-test.yml | 8 | ||||
-rw-r--r-- | CHANGES.rst | 28 | ||||
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | pyproject.toml | 3 | ||||
-rw-r--r-- | setup.cfg | 28 | ||||
-rw-r--r-- | setup.py | 111 | ||||
-rw-r--r-- | src/configobj/__init__.py (renamed from configobj.py) | 4 | ||||
-rw-r--r-- | src/configobj/_version.py (renamed from _version.py) | 0 | ||||
-rw-r--r-- | src/configobj/validate.py (renamed from validate.py) | 0 | ||||
-rw-r--r-- | src/tests/__init__.py (renamed from tests/__init__.py) | 0 | ||||
-rw-r--r-- | src/tests/conf.ini (renamed from tests/conf.ini) | 0 | ||||
-rw-r--r-- | src/tests/conf.spec (renamed from tests/conf.spec) | 0 | ||||
-rw-r--r-- | src/tests/configobj_doctests.py (renamed from test_configobj.py) | 6 | ||||
-rw-r--r-- | src/tests/conftest.py (renamed from tests/conftest.py) | 2 | ||||
-rw-r--r-- | src/tests/test_configobj.py (renamed from tests/test_configobj.py) | 2 | ||||
-rw-r--r-- | src/tests/test_validate.py (renamed from tests/test_validate.py) | 2 | ||||
-rw-r--r-- | src/tests/test_validate_errors.py (renamed from tests/test_validate_errors.py) | 2 | ||||
-rw-r--r-- | tox.ini | 12 |
18 files changed, 142 insertions, 67 deletions
diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index e06ce0a..a13efe3 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -20,7 +20,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pytest coverage + pip install pytest coverage pytest-cov six mock if [ -f requirements.txt ]; then pip install -r requirements.txt; fi pip install -e . - name: Test with pytest @@ -43,9 +43,11 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pytest coverage + pip install pytest coverage pytest-cov six mock if [ -f requirements.txt ]; then pip install -r requirements.txt; fi pip install -e . - name: Test with pytest run: | - pytest tests + python src/tests/configobj_doctests.py + python -m configobj.validate + py.test -c setup.cfg --color=yes --cov=configobj --cov-report=term --cov-report=html --cov-report=xml diff --git a/CHANGES.rst b/CHANGES.rst new file mode 100644 index 0000000..86e4fb1 --- /dev/null +++ b/CHANGES.rst @@ -0,0 +1,28 @@ +Changelog +--------- + +Release 5.0.7 +""""""""""""" + +* update testing to validate against python version 2.7 and 3.5-3.11 +* update broken links / non-existent services and references + +Older Releases +"""""""""""""" + +* Release 5.0.6 improves error messages in certain edge cases +* Release 5.0.5 corrects a unicode-bug that still existed in writing files +* Release 5.0.4 corrects a unicode-bug that still existed in reading files after + fixing lists of string in 5.0.3 +* Release 5.0.3 corrects errors related to the incorrectly handling unicode + encoding and writing out files +* Release 5.0.2 adds a specific error message when trying to install on + Python versions older than 2.5 +* Release 5.0.1 fixes a regression with unicode conversion not happening + in certain cases PY2 +* Release 5.0.0 updates the supported Python versions to 2.6, 2.7, 3.2, 3.3 + and is otherwise unchanged +* Release 4.7.2 fixes several bugs in 4.7.1 +* Release 4.7.1 fixes a bug with the deprecated options keyword in 4.7.0. +* Release 4.7.0 improves performance adds features for validation and + fixes some bugs.
\ No newline at end of file @@ -1,5 +1,6 @@ # configobj [](https://coveralls.io/r/DiffSK/configobj?branch=master) +[](https://pypi.python.org/pypi/configobj) [](https://github.com/DiffSK/configobj/blob/master/LICENSE) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..fed528d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..0c68fcd --- /dev/null +++ b/setup.cfg @@ -0,0 +1,28 @@ +# +# Configuration for setuptools +# + +[egg_info] +tag_build = .dev0 +tag_date = false + + +[sdist] +formats = zip + + +[bdist_wheel] +# If you set this to 1, make sure you have a proper Travis CI build matrix, +# and that your Trove classifiers state you support Python 2 and 3 +universal = 1 + + +[tool:pytest] +norecursedirs = .* *.egg *.egg-info bin dist include lib local share static docs +python_files = src/tests/test_*.py +#addopts = + + +[flake8] +#ignore = E226,… +max-line-length = 132 @@ -1,5 +1,10 @@ +#!/usr/bin/env python # setup.py -# Install script for ConfigObj +# -*- coding: utf-8 -*- +# pylint: disable=invalid-name + +"""Install script for ConfigObj""" + # Copyright (C) 2005-2014: # (name) : (email) # Michael Foord: fuzzyman AT voidspace DOT org DOT uk @@ -10,31 +15,48 @@ # This software is licensed under the terms of the BSD license. # http://opensource.org/licenses/BSD-3-Clause +import io import os +import re import sys -from distutils.core import setup -# a simple import wouldn't work if we moved towards a package with __init__ -from _version import __version__ +from contextlib import closing + +from setuptools import setup if sys.version_info < (2, 6): - print('for python versions < 2.6 use configobj ' + print('for Python versions < 2.6 use configobj ' 'version 4.7.2') sys.exit(1) +elif sys.version_info < (2, 7): + print('for Python version 2.6 use configobj ' + 'version 5.0.6') + sys.exit(1) __here__ = os.path.abspath(os.path.dirname(__file__)) -VERSION = __version__ NAME = 'configobj' -MODULES = 'configobj', 'validate', '_version' - +MODULES = [] +PACKAGES = ['configobj'] DESCRIPTION = 'Config file reading, writing and validation.' - URL = 'https://github.com/DiffSK/configobj' +REQUIRES = """ + six +""" + +VERSION = '' +with closing(open(os.path.join(__here__, 'src', PACKAGES[0], '_version.py'), 'r')) as handle: + for line in handle.readlines(): + if line.startswith('__version__'): + VERSION = re.split('''['"]''', line)[1] +assert re.match(r"[0-9](\.[0-9]+)", VERSION), "No semantic version found in 'configobj._version'" + LONG_DESCRIPTION = """**ConfigObj** is a simple but powerful config file reader and writer: an *ini file round tripper*. Its main feature is that it is very easy to use, with a straightforward programmer's interface and a simple syntax for config files. -It has lots of other features though : + +List of Features +---------------- * Nested sections (subsections), to any level * List values @@ -51,35 +73,31 @@ It has lots of other features though : * The order of keys/sections is preserved * Powerful ``unrepr`` mode for storing/retrieving Python data-types -| Release 5.0.6 improves error messages in certain edge cases -| Release 5.0.5 corrects a unicode-bug that still existed in writing files -| Release 5.0.4 corrects a unicode-bug that still existed in reading files after -| fixing lists of string in 5.0.3 -| Release 5.0.3 corrects errors related to the incorrectly handling unicode -| encoding and writing out files -| Release 5.0.2 adds a specific error message when trying to install on -| Python versions older than 2.5 -| Release 5.0.1 fixes a regression with unicode conversion not happening -| in certain cases PY2 -| Release 5.0.0 updates the supported Python versions to 2.6, 2.7, 3.2, 3.3 -| and is otherwise unchanged -| Release 4.7.2 fixes several bugs in 4.7.1 -| Release 4.7.1 fixes a bug with the deprecated options keyword in -| 4.7.0. -| Release 4.7.0 improves performance adds features for validation and -| fixes some bugs.""" +""" + +try: + with io.open('CHANGES.rst', encoding='utf-8') as handle: + LONG_DESCRIPTION += handle.read() +except EnvironmentError as exc: + # Build / install anyway + print("WARNING: Cannot open/read CHANGES.rst due to {}".format(exc)) CLASSIFIERS = [ + # Details at http://pypi.python.org/pypi?:action=list_classifiers 'Development Status :: 6 - Mature', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Programming Language :: Python', 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.2', - 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', 'Operating System :: OS Independent', 'Topic :: Software Development :: Libraries', 'Topic :: Software Development :: Libraries :: Python Modules', @@ -91,16 +109,23 @@ AUTHOR_EMAIL = 'rdennis+configobj@gmail.com, eli@courtwright.org, fuzzyman@voids KEYWORDS = "config, ini, dictionary, application, admin, sysadmin, configuration, validation".split(', ') - -setup(name=NAME, - version=VERSION, - install_requires=['six'], - description=DESCRIPTION, - long_description=LONG_DESCRIPTION, - author=AUTHOR, - author_email=AUTHOR_EMAIL, - url=URL, - py_modules=MODULES, - classifiers=CLASSIFIERS, - keywords=KEYWORDS - ) +project = dict( + name=NAME, + version=VERSION, + description=DESCRIPTION, + long_description=LONG_DESCRIPTION, + author=AUTHOR, + author_email=AUTHOR_EMAIL, + url=URL, + py_modules=MODULES, + package_dir={'': 'src'}, + packages=PACKAGES, + install_requires=[i.strip() for i in REQUIRES.splitlines() if i.strip()], + python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', + classifiers=CLASSIFIERS, + keywords=KEYWORDS, + license='BSD (2 clause)', +) + +if __name__ == '__main__': + setup(**project)
\ No newline at end of file diff --git a/configobj.py b/src/configobj/__init__.py index ba886e8..0d752bc 100644 --- a/configobj.py +++ b/src/configobj/__init__.py @@ -20,7 +20,7 @@ import sys from codecs import BOM_UTF8, BOM_UTF16, BOM_UTF16_BE, BOM_UTF16_LE import six -from _version import __version__ +from ._version import __version__ # imported lazily to avoid startup performance hit if it isn't used compiler = None @@ -2170,7 +2170,7 @@ class ConfigObj(Section): if preserve_errors: # We do this once to remove a top level dependency on the validate module # Which makes importing configobj faster - from validate import VdtMissingValue + from configobj.validate import VdtMissingValue self._vdtMissingValue = VdtMissingValue section = self diff --git a/_version.py b/src/configobj/_version.py index 6d01371..6d01371 100644 --- a/_version.py +++ b/src/configobj/_version.py diff --git a/validate.py b/src/configobj/validate.py index b7a964c..b7a964c 100644 --- a/validate.py +++ b/src/configobj/validate.py diff --git a/tests/__init__.py b/src/tests/__init__.py index e69de29..e69de29 100644 --- a/tests/__init__.py +++ b/src/tests/__init__.py diff --git a/tests/conf.ini b/src/tests/conf.ini index aa429ff..aa429ff 100644 --- a/tests/conf.ini +++ b/src/tests/conf.ini diff --git a/tests/conf.spec b/src/tests/conf.spec index 3af70ac..3af70ac 100644 --- a/tests/conf.spec +++ b/src/tests/conf.spec diff --git a/test_configobj.py b/src/tests/configobj_doctests.py index 2133a7d..ab9e04d 100644 --- a/test_configobj.py +++ b/src/tests/configobj_doctests.py @@ -33,7 +33,7 @@ if INTP_VER < (2, 2): from codecs import BOM_UTF8 from configobj import * -from validate import Validator, VdtValueTooSmallError +from configobj.validate import Validator, VdtValueTooSmallError def _test_validate(): @@ -45,7 +45,7 @@ def _test_validate(): >>> c = ConfigObj(a, configspec=b) >>> c ConfigObj({'foo': 'fish'}) - >>> from validate import Validator + >>> from configobj.validate import Validator >>> v = Validator() >>> c.validate(v) 0 @@ -691,7 +691,7 @@ def _unexpected_validation_errors(): report the failure to validate # section specified, got scalar - >>> from validate import ValidateError + >>> from configobj.validate import ValidateError >>> s = ['[cow]', 'something = boolean'] >>> c = ['cow = true'] >>> ini = ConfigObj(c, configspec=s) diff --git a/tests/conftest.py b/src/tests/conftest.py index e11ad40..33b1bc9 100644 --- a/tests/conftest.py +++ b/src/tests/conftest.py @@ -2,7 +2,7 @@ import pytest from configobj import ConfigObj -from validate import Validator +from configobj.validate import Validator @pytest.fixture def empty_cfg(): diff --git a/tests/test_configobj.py b/src/tests/test_configobj.py index 473992b..b9004fd 100644 --- a/tests/test_configobj.py +++ b/src/tests/test_configobj.py @@ -12,7 +12,7 @@ import six import configobj as co from configobj import ConfigObj, flatten_errors, ReloadError, DuplicateError, MissingInterpolationOption, InterpolationLoopError, ConfigObjError -from validate import Validator, VdtValueTooSmallError +from configobj.validate import Validator, VdtValueTooSmallError def cfg_lines(config_string_representation): diff --git a/tests/test_validate.py b/src/tests/test_validate.py index bffb0dc..07c1de7 100644 --- a/tests/test_validate.py +++ b/src/tests/test_validate.py @@ -2,7 +2,7 @@ from configobj import ConfigObj import pytest -from validate import Validator, VdtValueTooSmallError +from configobj.validate import Validator, VdtValueTooSmallError class TestBasic(object): diff --git a/tests/test_validate_errors.py b/src/tests/test_validate_errors.py index 644dfb3..399daa8 100644 --- a/tests/test_validate_errors.py +++ b/src/tests/test_validate_errors.py @@ -3,7 +3,7 @@ import os import pytest from configobj import ConfigObj, get_extra_values, ParseError, NestingError -from validate import Validator +from configobj.validate import Validator @pytest.fixture() def thisdir(): diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 1d71631..0000000 --- a/tox.ini +++ /dev/null @@ -1,12 +0,0 @@ -# content of: tox.ini, put in same dir as setup.py -[tox] -envlist = py26,py27,py32,py33 -[testenv] -deps=pytest - pytest-cov -setenv = - PYTHONWARNINGS = always -commands=python test_configobj.py - python validate.py - coverage run --source=configobj.py,validate.py -m py.test tests - coverage report |