This repository has been archived by the owner on Feb 1, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
64 lines (61 loc) · 1.75 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
import sys, os
from StringIO import StringIO
from setuptools import setup, Command
from tests.__main__ import main as testmain
try:
import coverage
except ImportError:
coverage = None
if coverage:
class Coverage(Command):
description = 'Calculate code coverage of unit tests'
user_options = []
def run(self):
cover = coverage.Coverage()
buffer = StringIO()
cover.start()
testmain()
cover.stop()
cover.save()
cover.html_report()
cover.report(file=buffer)
buffer.seek(0)
for line in buffer.readlines():
columns = line.split()
# Exclude coverage reports on external modules
if os.path.abspath(columns[0]).startswith(sys.prefix):
continue
# The total is not accurate since we're filtering out entries
if columns[0] == 'TOTAL':
continue
sys.stdout.write(line)
def initialize_options(self):
pass
def finalize_options(self):
pass
else:
class Coverage(Command):
def run(self):
pass
def initialize_options(self):
pass
def finalize_options(self):
pass
setup(
name='makeit',
version='0.1',
description='A reimagined task loader for doit',
author='James Lott',
author_email='[email protected]',
license='MIT',
keywords='doit build automation',
packages=['makeit'],
install_requires=['doit>=0.28'],
test_suite='tests',
cmdclass={
'coverage': Coverage,
},
entry_points={
'console_scripts': ['makeit = makeit.__main__:main']
}
)