1#!/usr/bin/env python
2
3# Verbose, notice, and spam log levels for Python's logging module.
4#
5# Author: Peter Odding <peter@peterodding.com>
6# Last Change: March 7, 2017
7# URL: https://verboselogs.readthedocs.io
8
9"""Setup script for the `verboselogs` package."""
10
11# Standard library modules.
12import codecs
13import os
14import re
15
16# De-facto standard solution for Python packaging.
17from setuptools import find_packages, setup
18
19
20def get_contents(*args):
21    """Get the contents of a file relative to the source distribution directory."""
22    with codecs.open(get_absolute_path(*args), 'r', 'UTF-8') as handle:
23        return handle.read()
24
25
26def get_version(*args):
27    """Extract the version number from a Python module."""
28    contents = get_contents(*args)
29    metadata = dict(re.findall('__([a-z]+)__ = [\'"]([^\'"]+)', contents))
30    return metadata['version']
31
32
33def get_absolute_path(*args):
34    """Transform relative pathnames into absolute pathnames."""
35    return os.path.join(os.path.dirname(os.path.abspath(__file__)), *args)
36
37
38setup(
39    name='verboselogs',
40    version=get_version('verboselogs', '__init__.py'),
41    description="Verbose logging level for Python's logging module",
42    long_description=get_contents('README.rst'),
43    url='https://verboselogs.readthedocs.io',
44    author='Peter Odding',
45    author_email='peter@peterodding.com',
46    packages=find_packages(),
47    classifiers=[
48        'Development Status :: 5 - Production/Stable',
49        'Intended Audience :: Developers',
50        'Intended Audience :: Information Technology',
51        'Intended Audience :: System Administrators',
52        'License :: OSI Approved :: MIT License',
53        'Programming Language :: Python',
54        'Programming Language :: Python :: 2',
55        'Programming Language :: Python :: 2.6',
56        'Programming Language :: Python :: 2.7',
57        'Programming Language :: Python :: 3',
58        'Programming Language :: Python :: 3.4',
59        'Programming Language :: Python :: 3.5',
60        'Programming Language :: Python :: 3.6',
61        'Programming Language :: Python :: Implementation :: CPython',
62        'Programming Language :: Python :: Implementation :: PyPy',
63        'Topic :: Software Development',
64        'Topic :: Software Development :: Libraries',
65        'Topic :: Software Development :: Libraries :: Python Modules',
66        'Topic :: System',
67        'Topic :: System :: Logging',
68        'Topic :: System :: Systems Administration',
69        'Topic :: Terminals',
70    ])
71