-
Notifications
You must be signed in to change notification settings - Fork 18
/
setup.py
108 lines (90 loc) · 3 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
# Copyright 2017 LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license.
# See LICENSE in the project root for license information.
import io
import venv
import sys
from pathlib import Path
from setuptools import setup, find_packages, Command
from setuptools.command.test import test as TestCommand
if sys.version_info < (3, 6):
print('asciietch requires at least Python 3.6!')
sys.exit(1)
description = 'A library for graphing charts using ascii characters.'
try:
with io.open('README.md', encoding="utf-8") as fh:
long_description = fh.read()
except IOError:
long_description = description
class Tox(TestCommand):
def run_tests(self):
import tox
errno = -1
try:
tox.session.main()
except SystemExit as e:
errno = e.code
sys.exit(errno)
class PyTest(TestCommand):
def run_tests(self):
import pytest
errno = pytest.main()
sys.exit(errno)
class Venv(Command):
user_options = []
def initialize_options(self):
"""Abstract method that is required to be overwritten"""
def finalize_options(self):
"""Abstract method that is required to be overwritten"""
def run(self):
venv_path = Path(__file__).absolute().parent / 'venv' / 'asciietch'
print(f'Creating virtual environment in {venv_path}')
venv.main(args=[str(venv_path)])
print(
'Linking `activate` to top level of project.\n'
'To activate, simply run `source activate`.'
)
activate = Path(venv_path, 'bin', 'activate')
activate_link = Path(__file__).absolute().parent / 'activate'
try:
activate_link.symlink_to(activate)
except FileExistsError:
...
setup(
name='asciietch',
version='1.0.6',
description=description,
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/linkedin/asciietch',
author='Steven R. Callister',
cmdclass={'venv': Venv,
'test': PyTest,
'pytest': PyTest,
'tox': Tox,
},
license='License :: OSI Approved :: BSD License',
packages=find_packages(),
install_requires=[
'parsedatetime==2.4',
'setuptools>=30',
],
tests_require=[
'flake8>=3.5.0',
'pytest>=3.0.6',
'tox',
],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: Information Technology',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3 :: Only',
'Operating System :: POSIX :: Linux'
],
)