-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.py
86 lines (71 loc) · 2.25 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
import io
import os
import re
from setuptools import setup
from setuptools.command.test import test as TestCommand
import sys
PKG_NAME = 'flash'
HERE = os.path.abspath(os.path.dirname(__file__))
PATTERN = r'^{target}\s*=\s*([\'"])(.+)\1$'
AUTHOR = re.compile(PATTERN.format(target='__author__'), re.M)
DOCSTRING = re.compile(r'^([\'"])\1\1(.+)\1\1\1$', re.M)
VERSION = re.compile(PATTERN.format(target='__version__'), re.M)
def parse_init():
with open(os.path.join(HERE, PKG_NAME, '__init__.py')) as f:
file_data = f.read()
return [regex.search(file_data).group(2) for regex in
(AUTHOR, DOCSTRING, VERSION)]
def read(*filenames, **kwargs):
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', '\n')
buf = []
for filename in filenames:
with io.open(filename, encoding=encoding) as f:
buf.append(f.read())
return sep.join(buf)
long_description = read('README.rst')
author, description, version = parse_init()
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = [
'--pylint',
'--pylint-error-types=FEW',
'--runslow',
'--driver=Chrome',
]
self.test_suite = True
def run_tests(self):
import pytest
errcode = pytest.main(self.test_args)
sys.exit(errcode)
setup(
author=author,
author_email='[email protected]',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3 :: Only',
],
cmdclass={'test': PyTest},
description=description,
install_requires=['flash_services', 'Flask', 'requests-cache'],
license='License :: OSI Approved :: ISC License (ISCL)',
long_description=long_description,
name=PKG_NAME,
packages=[PKG_NAME],
platforms='any',
tests_require=[
'beautifulsoup4',
'pylint',
'pytest',
'pytest-flask',
'pytest-pylint',
'pytest-selenium',
],
url='http://github.com/textbook/flash/',
version=version,
)