-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·68 lines (56 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
62
63
64
65
66
67
68
#!/usr/bin/env python
# coding: utf-8
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
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)
def read_file(x, *more):
def _inner():
with open(x, "r") as fh:
for line in fh:
line = line.strip()
if line.startswith("#"):
continue
if "#egg=" in line:
yield line[line.rindex("#egg=") + 5 :]
elif line:
yield line
ret = list(_inner())
for item in more:
for i in item:
if i not in ret:
ret.append(i)
return ret
require = read_file("requirements.txt")
tests_require = [x for x in read_file("test-requirements.txt", require) if not x.startswith("-r ")]
setup_require = require + ["setuptools_scm"]
setup(
name="ldogger",
use_scm_version={
"write_to": "ldogger/version.py",
"tag_regex": r"^(?P<prefix>v)(?P<version>\d+\.\d+\.\d+)(?P<suffix>.*)?$",
# NOTE: use ./setup.py --version to regenerate version.py and print the
# computed version
},
description="ldogger — a collection of gadgets for using logdna from loonix shells",
author="Paul Miller",
author_email="[email protected]",
url="https://github.com/jettero/ldogger",
cmdclass={"test": PyTest},
packages=find_packages(),
install_requires=require,
tests_require=tests_require,
setup_requires=setup_require,
entry_points={
"console_scripts": ["ldogger = ldogger.cmd:ldogger", "sj2l = ldogger.cmd:sj2l"],
},
)