This repository has been archived by the owner on Dec 24, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup.py
executable file
·72 lines (55 loc) · 2.08 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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import inspect
import os
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
def read_version(package):
with open(os.path.join(package, '__init__.py'), 'r') as fd:
for line in fd:
if line.startswith('__version__ = '):
return line.split()[-1].strip().strip("'")
version = read_version('oauth2_proxy')
__location__ = os.path.join(os.getcwd(), os.path.dirname(inspect.getfile(inspect.currentframe())))
def get_install_requirements(path):
content = open(os.path.join(__location__, path)).read()
return [req for req in content.split('\\n') if req != '']
class PyTest(TestCommand):
user_options = [('cov-html=', None, 'Generate junit html report')]
def initialize_options(self):
TestCommand.initialize_options(self)
self.cov = None
self.pytest_args = ['--cov', 'oauth2_proxy', '--cov-report', 'term-missing']
self.cov_html = False
def finalize_options(self):
TestCommand.finalize_options(self)
if self.cov_html:
self.pytest_args.extend(['--cov-report', 'html'])
def run_tests(self):
import pytest
errno = pytest.main(self.pytest_args)
sys.exit(errno)
setup(
name='oauth2-proxy',
packages=find_packages(),
version=version,
description='OAuth2 proxy with authorization/redirect flow',
long_description=open('README.rst').read(),
author='Zalando SE',
url='https://github.com/zalando-stups/oauth2-proxy',
keywords='oauth flask proxy serve',
license='Apache License Version 2.0',
setup_requires=['flake8'],
install_requires=get_install_requirements('requirements.txt'),
tests_require=['pytest-cov', 'pytest', 'mock'],
cmdclass={'test': PyTest},
test_suite='tests',
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 3.4',
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Operating System :: OS Independent',
]
)