-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
executable file
·61 lines (52 loc) · 1.93 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
#!/usr/bin/env python3
# pylint: disable=import-outside-toplevel,attribute-defined-outside-init
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
try:
from sphinx.setup_command import BuildDoc
except ModuleNotFoundError:
BuildDoc = None
class PyTest(TestCommand):
user_options = [("pytest-args=", "a", "Arguments to pass to pytest")]
def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = ""
def run_tests(self):
import shlex
import pytest
errno = pytest.main(shlex.split(self.pytest_args))
sys.exit(errno)
setup(
name="jstat",
description="Dstat clone in py3, with thoughts about pip-based plugins",
author="Paul Miller",
author_email="[email protected]",
url="https://github.com/jettero/jstat",
packages=find_packages(),
cmdclass={"test": PyTest, "build_sphinx": BuildDoc},
command_options={
"build_sphinx": {
"source_dir": ("setup.py", "doc/source"),
"build_dir": ("setup.py", "doc/build"),
"builder": ("setup.py", "html"),
# because sphinx conf relies on reading jstat version
# jstat must be installed to build the sphinx docs
# (TODO: fix above somehow)
#
# To build html sphinx docs, ./setup.py --builder html
# man with ./setup.py --builder man
}
},
tests_require=["pytest"],
install_requires=["pygments", "pluggy", "click"],
setup_requires=["setuptools_scm"],
extras_require={"docs": ["sphinx"],},
use_scm_version={
"write_to": "jstat/__version__.py",
"tag_regex": r"^(?P<prefix>v)?(?P<version>[^\+]+)(?P<suffix>.*)?$",
# NOTE: use ./setup.py --version to regenerate version.py and print the
# computed version
},
entry_points={"console_scripts": ["jstat = jstat.cmd:run"],},
)