-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
71 lines (60 loc) · 2.11 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
import ast
import sys
import os
import re
from setuptools import setup
path = os.path.join(os.path.dirname(__file__), 'dirty_models', '__init__.py')
with open(path, 'r') as file:
t = compile(file.read(), path, 'exec', ast.PyCF_ONLY_AST)
for node in (n for n in t.body if isinstance(n, ast.Assign)):
if len(node.targets) != 1:
continue
name = node.targets[0]
if not isinstance(name, ast.Name) or \
name.id not in ('__version__', '__version_info__', 'VERSION'):
continue
v = node.value
if isinstance(v, ast.Str):
version = v.s
break
if isinstance(v, ast.Tuple):
r = []
for e in v.elts:
if isinstance(e, ast.Str):
r.append(e.s)
elif isinstance(e, ast.Num):
r.append(str(e.n))
version = '.'.join(r)
break
install_requires = ['python-dateutil']
if sys.version_info < (3, 4):
install_requires.append('enum34')
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as desc_file:
long_desc = desc_file.read()
invalid_roles = ['meth', 'class', 'attr']
long_desc = re.sub(r':(?:{}):`([^`]+)`'.format('|'.join(invalid_roles)), r'`\1`', long_desc)
setup(
name='dirty-models',
url='https://github.com/alfred82santa/dirty-models',
author='alfred82santa',
version=version,
author_email='alfred82santa@gmail.com',
license='BSD',
classifiers=[
'Intended Audience :: Developers',
'Programming Language :: Python',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'License :: OSI Approved :: BSD License',
'Development Status :: 4 - Beta'],
packages=['dirty_models'],
include_package_data=False,
install_requires=install_requires,
description="Dirty models for python 3",
long_description=long_desc,
test_suite="nose.collector",
tests_require="nose",
zip_safe=True,
)