Debian Codegraph @

setup.py

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 # <sure - utility belt for automated testing in python>
4 # Copyright (C) <2010-2023> Gabriel Falcão <[email protected]>
5 #
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19 "utility belt for automated testing in python for python"
20
21 import os
22 import ast
23 import sys
24 import codecs
25 from setuptools import setup, find_packages
26
27 # These python versions are explicitly not supported
28 # by sure. This is mostly because of the incompatiblities
29 # with unicode strings. If there is an urgent reason why
30 # to support it after all or if you have a quick fix
31 # please open an issue on GitHub.
32 EXPL_NOT_SUPPORTED_VERSIONS = ((3, 0), (3, 1), (3, 2))
33
34 if sys.version_info[0:2] in EXPL_NOT_SUPPORTED_VERSIONS:
35 raise SystemExit(
36 "sure does explicitly not support the following python versions "
37 "due to big incompatibilities: {0}".format(EXPL_NOT_SUPPORTED_VERSIONS)
38 )
39
40
41 PROJECT_ROOT = os.path.dirname(__file__)
42
43
44 class VersionFinder(ast.NodeVisitor):
45 VARIABLE_NAME = "version"
46
47 def __init__(self):
48 self.version = None
49
50 def visit_Assign(self, node):
51 try:
52 if node.targets[0].id == self.VARIABLE_NAME:
53 self.version = node.value.s
54 except Exception:
55 pass
56
57
58 def read_version():
59 finder = VersionFinder()
60 finder.visit(ast.parse(local_text_file("sure", "version.py")))
61 return finder.version
62
63
64 def local_text_file(*f):
65 path = os.path.join(PROJECT_ROOT, *f)
66 with open(path, "rt") as fp:
67 file_data = fp.read()
68
69 return file_data
70
71
72 def read_readme():
73 """Read README content.
74 If the README.rst file does not exist yet
75 (this is the case when not releasing)
76 only the short description is returned.
77 """
78 try:
79 return local_text_file("README.rst")
80 except IOError:
81 return __doc__
82
83
•84 install_requires = ["six"]
85 tests_require = ["nose"]
86 version = read_version()
87
88 if __name__ == "__main__":
89 setup(
90 name="sure",
91 version=version,
92 description=__doc__,
93 long_description=read_readme(),
94 url="http://github.com/gabrielfalcao/sure",
95 author="Gabriel Falcao",
96 author_email="[email protected]",
97 maintainer="Timo Furrer",
98 maintainer_email="[email protected]",
99 include_package_data=True,
100 packages=find_packages(exclude=["*tests*"]),
101 install_requires=install_requires,
102 long_description_content_type='text/x-rst',
103 entry_points={
104 "console_scripts": ["sure = sure.cli:entrypoint"],
105 },
106 tests_require=tests_require,
107 test_suite="nose.collector",
108 classifiers=[
109 "Development Status :: 5 - Production/Stable",
110 "Environment :: Console",
111 "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
112 "Operating System :: MacOS :: MacOS X",
113 "Operating System :: POSIX",
114 "Operating System :: POSIX :: Linux",
115 "Programming Language :: Python",
116 "Programming Language :: Python :: 3",
117 "Programming Language :: Python :: 3.6",
118 "Programming Language :: Python :: 3.7",
119 "Programming Language :: Python :: 3.8",
120 "Programming Language :: Python :: 3.9",
121 "Programming Language :: Python :: 3.10",
122 "Programming Language :: Python :: 3.11",
123 "Programming Language :: Python :: Implementation",
124 "Programming Language :: Python :: Implementation :: CPython",
125 "Programming Language :: Python :: Implementation :: PyPy",
126 "Topic :: Software Development :: Testing",
127 ],
128 )