forked from nylas/nylas-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
124 lines (105 loc) · 3.9 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
import sys
import re
import subprocess
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
VERSION = ""
with open("nylas_legacy/_client_sdk_version.py", "r") as fd:
VERSION = re.search(
r'^__VERSION__\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE
).group(1)
RUN_DEPENDENCIES = [
"requests[security]>=2.4.2",
"six>=1.4.1",
"urlobject",
"enum34>=1.1.10; python_version<='3.4'",
"websocket-client==0.59.0",
]
TEST_DEPENDENCIES = [
"pytest",
"pytest-cov",
"pytest-timeout",
"pytest-mock",
"responses==0.10.5",
"twine",
"pytz",
"mock; python_version<'3.3'",
]
RELEASE_DEPENDENCIES = ["bumpversion>=0.5.0", "twine>=3.4.2"]
class PyTest(TestCommand):
user_options = [("pytest-args=", "a", "Arguments to pass to pytest")]
def initialize_options(self):
TestCommand.initialize_options(self)
# pylint: disable=attribute-defined-outside-init
self.pytest_args = [
"--cov",
"--cov-report=xml",
"--junitxml",
"./tests/output",
"tests/",
]
self.lint = False
def finalize_options(self):
TestCommand.finalize_options(self)
# pylint: disable=attribute-defined-outside-init
self.test_args = []
self.test_suite = True
def run_tests(self):
# import here, cause outside the eggs aren't loaded
import pytest
errno = pytest.main(self.pytest_args)
sys.exit(errno)
def main():
# A few handy release helpers.
# For publishing you should install the extra 'release' dependencies
# by running: pip install nylas-legacy['release']
if len(sys.argv) > 1:
if sys.argv[1] == "publish":
try:
subprocess.check_output(["git", "push", "--follow-tags"])
subprocess.check_output(["python", "setup.py", "sdist"])
subprocess.check_output(["twine", "upload", "-r", "testpypi", "dist/*"])
subprocess.check_output(["twine", "upload", "dist/*"])
except FileNotFoundError as e:
print("Error encountered: {}.\n\n".format(e))
sys.exit()
elif sys.argv[1] == "release":
if len(sys.argv) < 3:
type_ = "patch"
else:
type_ = sys.argv[2]
try:
subprocess.check_output(
["bumpversion", "--current-version", VERSION, type_]
)
except FileNotFoundError as e:
print(
"Error encountered: {}.\n\n".format(e),
"Did you install the extra 'release' dependencies? (pip install nylas-legacy['release'])",
)
sys.exit()
setup(
name="nylas-legacy",
version=VERSION,
packages=find_packages(),
install_requires=RUN_DEPENDENCIES,
dependency_links=[],
tests_require=TEST_DEPENDENCIES,
extras_require={"test": TEST_DEPENDENCIES, "release": RELEASE_DEPENDENCIES},
cmdclass={"test": PyTest},
author="Nylas Team",
author_email="[email protected]",
description="Python bindings for the Nylas API v2 (legacy).",
license="MIT",
keywords="inbox app appserver email nylas contacts calendar",
url="https://github.com/nylas/nylas-python-legacy",
long_description_content_type="text/markdown",
long_description="""
# Nylas API v2 (Legacy) Python bindings
Python bindings for the Nylas API v2.
The Nylas APIs power applications with email, calendar, and contacts CRUD and bi-directional sync from any inbox in the world.
Nylas is compatible with 100% of email service providers, so you only have to integrate once.
No more headaches building unique integrations against archaic and outdated IMAP and SMTP protocols.""",
)
if __name__ == "__main__":
main()