-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.py
107 lines (89 loc) · 3.09 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
100
101
102
103
104
105
106
107
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""setup.py for trivector"""
import codecs
import re
import sys
import os
from setuptools import setup, find_packages
from setuptools.command.test import test
def find_version(*file_paths):
with codecs.open(os.path.join(os.path.abspath(os.path.dirname(__file__)), *file_paths), 'r') as fp:
version_file = fp.read()
m = re.search(r"^__version__ = \((\d+), ?(\d+), ?(\d+)\)", version_file, re.M)
if m:
return "{}.{}.{}".format(*m.groups())
raise RuntimeError("Unable to find a valid version")
VERSION = find_version("trivector", "__init__.py")
class Pylint(test):
user_options = [('pylint-args=', 'a', "Arguments to pass to pylint")]
def initialize_options(self):
test.initialize_options(self)
self.pylint_args = "trivector --persistent=y --rcfile=.pylintrc --output-format=colorized"
def run_tests(self):
import shlex
# import here, cause outside the eggs aren't loaded
from pylint.lint import Run
Run(shlex.split(self.pylint_args))
class PyTest(test):
user_options = [('pytest-args=', 'a', "Arguments to pass to pytest")]
def initialize_options(self):
test.initialize_options(self)
self.pytest_args = "-v --cov={}".format("trivector")
def run_tests(self):
import shlex
# import here, cause outside the eggs aren't loaded
import pytest
errno = pytest.main(shlex.split(self.pytest_args))
sys.exit(errno)
def readme():
with open("README.rst", encoding="utf-8") as f:
return f.read()
setup(
name="trivector",
version=VERSION,
description="Convert an image into a SVG vector image composed "
"of triangular sectors.",
long_description=readme(),
author="Nathan Klapstein",
author_email="[email protected]",
url="https://github.com/nklapste/trivector",
license="MIT",
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Topic :: Multimedia :: Graphics :: Editors :: Vector-Based",
"Topic :: Multimedia :: Graphics :: Graphics Conversion",
],
packages=find_packages(exclude=["tests"]),
include_package_data=True,
install_requires=[
"svgwrite>=1.1.12,<2.0.0",
"opencv-python>=3.4.1.15,<4.0.0.0",
"numpy>=1.14.3,<2.0.0",
"progressbar2>=3.37.1,<4.0.0",
],
tests_require=[
"pytest>=2.8.7,<4.0.0",
"pytest-cov<=2.6.0",
"pylint>=1.9.1,<2.0.0",
"svglib>=0.9.0,<1.0.0",
],
extras_require={
"docs": [
"sphinx>=1.7.5,<2.0.0",
"sphinx_rtd_theme>=0.3.1,<1.0.0",
"sphinx-autodoc-typehints>=1.3.0,<2.0.0",
"sphinx-argparse>=0.2.2,<1.0.0",
],
},
cmdclass={"test": PyTest, "lint": Pylint},
entry_points={
"console_scripts": [
"trivector = trivector.__main__:main"
]
},
)