forked from singingwolfboy/flask-dance
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
80 lines (66 loc) · 2.32 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
77
78
79
80
# coding=utf-8
from __future__ import unicode_literals
import sys
import re
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
# import here, because outside the eggs aren't loaded
import pytest
errno = pytest.main(self.test_args)
sys.exit(errno)
def is_requirement(line):
line = line.strip()
# Skip blank lines, comments, and editable installs
return not (
line == ""
or line.startswith("--")
or line.startswith("-r")
or line.startswith("#")
or line.startswith("-e")
or line.startswith("git+")
)
def get_requirements(path):
with open(path) as f:
lines = f.readlines()
return [l.strip() for l in lines if is_requirement(l)]
version = ""
with open("flask_dance/__init__.py", "r") as fd:
version = re.search(
r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE
).group(1)
if not version:
raise RuntimeError("Cannot find version information")
setup(
name="Flask-Dance",
version=version,
description="Doing the OAuth dance with style using Flask, requests, and oauthlib",
long_description=open("README.rst").read(),
author="David Baumgold",
author_email="[email protected]",
url="https://github.com/singingwolfboy/flask-dance",
packages=find_packages(),
install_requires=get_requirements("requirements.txt"),
tests_require=get_requirements("tests/requirements.txt"),
extras_require={"sqla": ["sqlalchemy", "sqlalchemy-utils"], "signals": ["blinker"]},
cmdclass={"test": PyTest},
entry_points={"pytest11": ["pytest_flask_dance = flask_dance.fixtures.pytest"]},
license="MIT",
classifiers=[
"License :: OSI Approved :: MIT License",
"Framework :: Flask",
"Framework :: Pytest",
"Programming Language :: Python",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
],
zip_safe=False,
)