-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
127 lines (110 loc) · 2.64 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:license: GPLv3, see LICENSE for more details.
"""
import os
import re
import sys
import setuptools
from MambuPy import __version__
def readme():
"""print long description"""
try:
import m2r2
except ImportError:
with open("README.md") as f:
return f.read()
with open("README.md") as f:
return m2r2.convert(f.read())
class VerifyVersionCommand:
"""Custom command to verify that the git tag matches our version"""
description = "verify that the git tag matches our version"
def run(self):
tag = os.getenv("CIRCLE_TAG")
if tag != __version__:
info = "Git tag: {0} does not match the version of this app: {1}".format(
tag, __version__
)
sys.exit(info)
packages = [
"MambuPy",
"mambupy",
]
major_ver, minor_ver, patch_ver = re.findall(r"([\d]+).([\d]+).([\w]+)", __version__)[0]
prefix_patch, patch = re.findall(r"^([\d]*[\D]+|[\D]*)([\d]+)$", patch_ver)[0]
lite = int(patch) % 2 != 0
if int(major_ver) >= 2:
packages.extend(
[
"MambuPy/api",
"mambupy/api",
"MambuPy/api/connector",
"mambupy/api/connector",
]
)
if not lite:
packages.extend(
[
"MambuPy/rest1to2",
"mambupy/rest1to2",
"MambuPy/utils",
"mambupy/utils",
]
)
else:
packages.extend(
[
"MambuPy/rest",
"mambupy/rest",
]
)
if not lite:
packages.extend(
[
"MambuPy/orm",
"mambupy/orm",
]
)
install_requires = [
"future",
"requests==2.31.0",
"requests_toolbelt==1.0.0",
"dateutils==0.6.12",
]
if not lite:
install_requires.extend(
[
"SQLAlchemy>=1.3.6",
]
)
if int(major_ver) <= 3:
install_requires.extend(
[
"mysqlclient",
]
)
else:
install_requires.extend(
[
"mysqlclient==2.1.0",
]
)
setuptools.setup(
name="MambuPy",
version=__version__,
description="A python lib for using Mambu APIs.",
long_description=readme(),
long_description_content_type="text/markdown",
url="https://mambupydocs.readthedocs.io",
author="Javier Novoa C.",
author_email="[email protected]",
license="GPLv3",
keywords=[
"mambu",
],
packages=packages,
python_requires=">=2.7",
cmdclass={"verify": VerifyVersionCommand},
install_requires=install_requires,
)