From 3323078a05d57bf99adb16a71b69fcbcd48146ea Mon Sep 17 00:00:00 2001 From: Rob Dennis Date: Tue, 17 Jan 2023 16:38:34 -0500 Subject: #128, #203 - re-implement the move to a configobj package done in master --- setup.py | 111 ++++++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 68 insertions(+), 43 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index c6d57a6..fcdecc0 100644 --- a/setup.py +++ b/setup.py @@ -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 -- cgit v1.2.1