forked from onefinestay/kaiso
/
setup.py
executable file
·76 lines (65 loc) · 2.38 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
#!/usr/bin/env python
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
from os.path import abspath, dirname, join
import sys
setup_dir = dirname(abspath(__file__))
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = [
'--cov', 'kaiso',
'--junitxml=test-results.xml',
join(setup_dir, 'test'),
]
self.test_suite = True
def run_tests(self):
# import here, cause outside the eggs aren't loaded
import pytest
errno = pytest.main(self.test_args)
sys.exit(errno)
def parse_requirements(fn, dependency_links):
requirements = []
with open(fn, 'rb') as f:
for dep in f:
dep = dep.strip()
# need to make test_requirements.txt work with
# setuptools like it would work with `pip -r`
# URLs will not work, so we transform them to
# dependency_links and requirements
if dep.startswith('git+'):
dependency_links.append(dep)
_, dep = dep.rsplit('#egg=', 1)
dep = dep.replace('-', '==', 1)
requirements.append(dep)
return requirements, dependency_links
requirements, dependency_links = parse_requirements(
join(setup_dir, 'requirements.txt'), [])
test_requirements, dependency_links = parse_requirements(
join(setup_dir, 'test_requirements.txt'),
dependency_links)
setup(
name='kaiso',
version='0.10.0',
description='A queryable object persistence and relationship framework'
' based on the Neo4j graph database.',
author='onefinestay',
author_email='engineering@onefinestay.com',
url='http://github.com/onefinestay/kaiso',
packages=find_packages(exclude=['test', 'test.*']),
install_requires=requirements,
tests_require=test_requirements,
dependency_links=dependency_links,
zip_safe=True,
cmdclass={'test': PyTest},
license='Apache License, Version 2.0',
classifiers=[
"Programming Language :: Python",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX",
"Programming Language :: Python :: 2.7",
"Topic :: Internet",
"Topic :: Software Development :: Libraries :: Python Modules",
"Intended Audience :: Developers"
]
)