forked from morganstanley/testplan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
92 lines (80 loc) · 2.14 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
#!/usr/bin/env python
"""
Setup testplan and dependencies.
"""
import ast
import sys
from pathlib import Path, PurePosixPath
from setuptools import setup, find_packages
REQUIRED = [
"sphinx<2",
"sphinx_rtd_theme",
"setuptools",
"pytest",
"py",
"psutil",
"schema",
"pytz",
"lxml",
"python-dateutil",
"reportlab",
"marshmallow==3.11.1",
"termcolor",
"colorama",
"pyzmq",
"terminaltables",
"pyparsing",
"cycler",
"requests>=2.4.3",
"flask>2.0.0",
"werkzeug>2.0.0",
"flask_restx",
"cheroot",
"boltons",
"validators==0.14.0",
"Pillow",
"plotly",
"rpyc",
"matplotlib",
"numpy",
"pandas",
"scipy",
]
WEB_UI_PACKAGE_DIR = "testplan/web_ui/"
VERSION_FILE = "testplan/version.py"
ui_files = [
str(PurePosixPath(p).relative_to(WEB_UI_PACKAGE_DIR))
for p in Path(WEB_UI_PACKAGE_DIR).glob("testing/build/**/*")
]
def get_version():
# we use ast here to avoid import
class VersionFinder(ast.NodeVisitor):
def __init__(self):
self.version = None
def visit_Assign(self, node: ast.Assign):
if node.targets[0].id == "__version__":
# python 3.7 node.value is ast.Str from 3.8 it seem it is ast.Constant
self.version = (
node.value.value
if isinstance(node.value, ast.Constant)
else node.value.s
)
module = ast.parse(Path("testplan/version.py").read_text())
version_visitor = VersionFinder()
version_visitor.visit(module)
return version_visitor.version
setup(
name="testplan",
version=get_version(),
description="Testplan testing framework",
author="",
author_email="[email protected]",
url="https://github.com/morganstanley/testplan",
include_package_data=True,
packages=find_packages(include=("testplan*",)),
package_dir={"testplan": "testplan"},
package_data={"testplan.web_ui": ui_files},
install_requires=REQUIRED,
python_requires=">=3.7",
entry_points={"console_scripts": ["tpsreport=testplan.cli.tpsreport:cli"]},
)