Completed
Push — master ( 6e23b2...bd66a8 )
by Jace
18s
created

setup.build_description()   A

Complexity

Conditions 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
#!/usr/bin/env python
2
3
"""Setup script for the package."""
4
5
import os
6
import sys
7
8
import setuptools
9
10
11
PACKAGE_NAME = 'log'
12
13
14
def read_package_variable(key, filename='__init__.py'):
15
    """Read the value of a variable from the package without importing."""
16
    module_path = os.path.join(PACKAGE_NAME, filename)
17
    with open(module_path) as module:
18
        for line in module:
19
            parts = line.strip().split(' ', 2)
20
            if parts[:-1] == [key, '=']:
21
                return parts[-1].strip("'")
22
    sys.exit("'%s' not found in '%s'", key, module_path)
23
24
25
def build_description():
26
    """Build a description for the project from documentation files."""
27
    readme = open("README.md").read()
28
    changelog = open("CHANGELOG.md").read()
29
    return readme + '\n' + changelog
30
31
32
setuptools.setup(
33
    name=read_package_variable('__project__'),
34
    version=read_package_variable('__version__'),
35
36
    description="Minimalistic wrapper for Python logging.",
37
    url='https://github.com/jacebrowning/minilog',
38
    author='Jace Browning',
39
    author_email='[email protected]',
40
41
    packages=setuptools.find_packages(),
42
43
    long_description=build_description(),
44
    long_description_content_type='text/markdown',
45
    license='MIT',
46
    classifiers=[
47
        'Development Status :: 4 - Beta',
48
        'Intended Audience :: Developers',
49
        'License :: OSI Approved :: MIT License',
50
        'Natural Language :: English',
51
        'Operating System :: OS Independent',
52
        'Programming Language :: Python :: 3',
53
        'Programming Language :: Python :: 3.4',
54
        'Programming Language :: Python :: 3.5',
55
        'Programming Language :: Python :: 3.6',
56
        'Programming Language :: Python :: 3.7',
57
        'Programming Language :: Python',
58
        'Topic :: Software Development',
59
        'Topic :: System :: Logging',
60
    ],
61
)
62