-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
99 lines (83 loc) · 2.74 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
96
97
98
99
"""
Setup for pyprototypr
"""
import ast
import io
import os
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
here = os.path.abspath(os.path.dirname(__file__))
class PyTest(TestCommand):
"""Wrapper for test runs."""
def __init__(self):
super(PyTest).__init__()
self.test_args = None
self.test_suite = None
def finalize_options(self):
"""."""
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
"""."""
import pytest
errcode = pytest.main(self.test_args)
sys.exit(errcode)
def get_version():
"""."""
try:
version_file = 'pyprototypr/_version.py'
with open(version_file, "rt") as vf:
verstrline = vf.readlines()[0]
_ver = verstrline.split('__version_info__ = ')
version_tuple = ast.literal_eval(_ver[1])
version_string = '.'.join(map(str, version_tuple))
return version_string
except Exception:
raise RuntimeError(
f'Unable to find version string in {version_file}.')
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 _file:
buf.append(_file.read())
return sep.join(buf)
VERSION = get_version()
LONG_DESCRIPTION = read('README.md', 'CHANGES.txt')
setup(
name='pyprototypr',
version=VERSION,
author='Derek Hohls',
author_email='gamesbook@gmail.com',
url='http://github.com/gamesbook/pyprototypr/',
tests_require=['pytest'],
cmdclass={'test': PyTest},
description='Python utility for designing and creating simple, regular,'
' graphic outputs as PDF files',
long_description=LONG_DESCRIPTION,
packages=find_packages(exclude=['dist', 'build', 'docs', 'examples']),
include_package_data=True,
install_requires=['reportlab', 'xlrd', 'bgg-api', 'svglib', 'lxml'],
test_suite='pyprototypr.test',
classifiers=[
'Programming Language :: Python :: 3.11',
'Development Status :: 3 - Alpha',
'Natural Language :: English',
'Environment :: Console',
'Intended Audience :: End Users/Desktop',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Games/Entertainment :: Board Games',
'Topic :: Multimedia :: Graphics :: Presentation'
],
platforms='any',
license='MIT License',
extras_require={
'testing': ['pytest'],
}
)