-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathsetup.py
95 lines (78 loc) · 2.64 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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# <sure - sophisticated automated test library and runner>
# Copyright (C) <2010-2024> Gabriel Falcão <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""sophisticated automated test library and runner"""
import os
import ast
import sys
import codecs
from setuptools import setup, find_packages
# These python versions are explicitly not supported
# by sure. This is mostly because of the incompatiblities
# with unicode strings. If there is an urgent reason why
# to support it after all or if you have a quick fix
# please open an issue on GitHub.
EXPL_NOT_SUPPORTED_VERSIONS = ((3, 0), (3, 1), (3, 2), (3, 3), (3, 4))
if sys.version_info[0:2] in EXPL_NOT_SUPPORTED_VERSIONS:
raise SystemExit(
"Sure does explicitly not support the following python versions "
"due to big incompatibilities: {0}".format(EXPL_NOT_SUPPORTED_VERSIONS)
)
if sys.version_info[0] < 3:
raise SystemExit(
"Sure no longer supports Python 2"
)
PROJECT_ROOT = os.path.dirname(__file__)
def read_version():
mod = ast.parse(local_text_file("sure", "version.py"))
exp = mod.body[0]
tgt = exp.targets[0]
cst = exp.value
assert tgt.id == "version"
return cst.value
def local_text_file(*f):
path = os.path.join(PROJECT_ROOT, *f)
with open(path, "rt") as fp:
file_data = fp.read()
return file_data
def read_readme():
"""Read README content.
If the README.rst file does not exist yet
(this is the case when not releasing)
only the short description is returned.
"""
try:
return local_text_file("README.rst")
except IOError:
return __doc__
version = read_version()
packages = find_packages(exclude=[
"*docs*",
"*e2e*",
"*examples*",
"*tests*",
])
if __name__ == "__main__":
setup(
name="sure",
version=version,
description=__doc__,
long_description=read_readme(),
include_package_data=True,
packages=packages,
long_description_content_type='text/x-rst',
)