forked from DiffSK/configobj
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·128 lines (106 loc) · 3.91 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/usr/bin/env python
# setup.py
# -*- 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
# Mark Andrews: mark AT la-la DOT com
# Nicola Larosa: nico AT tekNico DOT net
# Rob Dennis: rdennis AT gmail DOT com
# Eli Courtwright: eli AT courtwright DOT org
# 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 contextlib import closing
from setuptools import setup
if sys.version_info < (2, 6):
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.5')
sys.exit(1)
__here__ = os.path.abspath(os.path.dirname(__file__))
NAME = 'configobj'
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.
List of Features
----------------
* Nested sections (subsections), to any level
* List values
* Multiple line values
* Full Unicode support
* String interpolation (substitution)
* Integrated with a powerful validation system
- including automatic type checking/conversion
- and allowing default values
- repeated sections
* All comments in the file are preserved
* The order of keys/sections is preserved
* Powerful ``unrepr`` mode for storing/retrieving Python data-types
"""
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.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Operating System :: OS Independent',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
]
AUTHOR = 'Rob Dennis, Eli Courtwright (Michael Foord & Nicola Larosa original maintainers)'
KEYWORDS = "config, ini, dictionary, application, admin, sysadmin, configuration, validation".split(', ')
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)