1
|
|
|
#!/usr/bin/env python |
2
|
|
|
|
3
|
|
|
import os |
4
|
|
|
import sys |
5
|
|
|
|
6
|
|
|
import setuptools |
7
|
|
|
|
8
|
|
|
|
9
|
|
|
PACKAGE_NAME = 'verchew' |
10
|
|
|
MINIMUM_PYTHON_VERSION = '2.7' |
11
|
|
|
|
12
|
|
|
|
13
|
|
|
def check_python_version(): |
14
|
|
|
"""Exit when the Python version is too low.""" |
15
|
|
|
if sys.version < MINIMUM_PYTHON_VERSION: |
16
|
|
|
sys.exit("Python {0}+ is required.".format(MINIMUM_PYTHON_VERSION)) |
17
|
|
|
|
18
|
|
|
|
19
|
|
|
def read_package_variable(key, filename='__init__.py'): |
20
|
|
|
"""Read the value of a variable from the package without importing.""" |
21
|
|
|
module_path = os.path.join(PACKAGE_NAME, filename) |
22
|
|
|
with open(module_path) as module: |
23
|
|
|
for line in module: |
24
|
|
|
parts = line.strip().split(' ', 2) |
25
|
|
|
if parts[:-1] == [key, '=']: |
26
|
|
|
return parts[-1].strip("'") |
27
|
|
|
sys.exit("'%s' not found in '%s'", key, module_path) |
28
|
|
|
|
29
|
|
|
|
30
|
|
|
def build_description(): |
31
|
|
|
"""Build a description for the project from documentation files.""" |
32
|
|
|
readme = open("README.md").read() |
33
|
|
|
changelog = open("CHANGELOG.md").read() |
34
|
|
|
return readme + '\n' + changelog |
35
|
|
|
|
36
|
|
|
|
37
|
|
|
check_python_version() |
38
|
|
|
|
39
|
|
|
setuptools.setup( |
40
|
|
|
name=PACKAGE_NAME, |
41
|
|
|
version=read_package_variable(filename='script.py', key='__version__'), |
42
|
|
|
|
43
|
|
|
description="System dependency version checker.", |
44
|
|
|
url='https://github.com/jacebrowning/verchew', |
45
|
|
|
author='Jace Browning', |
46
|
|
|
author_email='[email protected]', |
47
|
|
|
|
48
|
|
|
packages=setuptools.find_packages(), |
49
|
|
|
|
50
|
|
|
entry_points={'console_scripts': [ |
51
|
|
|
'verchew = verchew.script:main', |
52
|
|
|
]}, |
53
|
|
|
|
54
|
|
|
long_description=build_description(), |
55
|
|
|
license='MIT', |
56
|
|
|
classifiers=[ |
57
|
|
|
'Development Status :: 5 - Production/Stable', |
58
|
|
|
'Environment :: Console', |
59
|
|
|
'Intended Audience :: Developers', |
60
|
|
|
'Natural Language :: English', |
61
|
|
|
'Operating System :: OS Independent', |
62
|
|
|
'Programming Language :: Python', |
63
|
|
|
'Programming Language :: Python :: 2', |
64
|
|
|
'Programming Language :: Python :: 2.7', |
65
|
|
|
'Programming Language :: Python :: 3', |
66
|
|
|
'Programming Language :: Python :: 3.4', |
67
|
|
|
'Programming Language :: Python :: 3.5', |
68
|
|
|
'Programming Language :: Python :: 3.6', |
69
|
|
|
'Topic :: Software Development', |
70
|
|
|
'Topic :: Software Development :: Build Tools', |
71
|
|
|
'Topic :: Software Development :: Testing', |
72
|
|
|
'Topic :: System :: Installation/Setup', |
73
|
|
|
'Topic :: Utilities', |
74
|
|
|
], |
75
|
|
|
) |
76
|
|
|
|