| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
> |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 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 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 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 |
) |