-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
72 lines (53 loc) · 1.6 KB
/
setup.py
File metadata and controls
72 lines (53 loc) · 1.6 KB
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 python
# -*- coding: utf-8 -*-
"""
TODO: File Comment
"""
import os
import re
import sys
from setuptools import setup, find_packages
if sys.version_info < (2, 6):
raise Exception('Celery 3.1 requires Python 2.6 or higher.')
# -*- Distribution Meta -*-
re_meta = re.compile(r'__(\w+?)__\s*=\s*(.*)')
re_vers = re.compile(r"^VERSION\s*=\s*'.*'")
re_doc = re.compile(r'^"""(.+?)"""')
def rq(s):
return s.strip("\"'")
def add_default(m):
attr_name, attr_value = m.groups()
return ((attr_name, rq(attr_value)),)
def add_version(m):
v = m.group().split("'")[1]
return (('VERSION', v),)
def add_doc(m):
return (('doc', m.groups()[0]),)
pats = {re_meta: add_default,
re_vers: add_version,
re_doc: add_doc}
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'celery_ex/__init__.py')) as meta_fh:
meta = {}
for line in meta_fh:
if line.strip() == '# -eof meta-':
break
for pattern, handler in pats.items():
m = pattern.match(line.strip())
if m:
meta.update(handler(m))
def get_requirements():
return open('requirements.txt').read().splitlines()
install_requires = get_requirements()
setup(
name='celery_ex',
version=meta['VERSION'],
description='Celery Extension',
author=meta['author'],
author_email=meta['contact'],
url=meta['homepage'],
platforms=['any'],
license='BSD',
packages=find_packages(exclude=['tests', 'tests.*', 'example', 'example.*'], include=['celery_ex', 'celery_ex.*']),
install_requires=install_requires,
)