forked from openedx/openedx-webhooks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
69 lines (56 loc) · 1.88 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
import re
import sys
from setuptools import find_packages, setup
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('openedx_webhooks/__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="openedx_webhooks",
version=version,
description="Automated tasks for Open edX",
long_description=open('README.rst').read(),
author="Open Source Community Managers at edX",
author_email="[email protected]",
url="https://github.com/edx/openedx_webhooks",
packages=find_packages(),
install_requires=get_requirements("requirements.txt"),
tests_require=get_requirements("requirements/test.txt"),
cmdclass={'test': PyTest},
license='Apache 2.0',
classifiers=(
'License :: OSI Approved :: Apache Software License',
'Framework :: Flask',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
),
zip_safe=False,
)