forked from zerodha/pykiteconnect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
127 lines (108 loc) · 4.18 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
import io
import os
import sys
import warnings
import distutils.util
from codecs import open
from setuptools import setup, Command
from setuptools.command.install import install as _install
current_dir = os.path.abspath(os.path.dirname(__file__))
about = {}
with open(os.path.join(current_dir, "kiteconnect", "__version__.py"), "r", "utf-8") as f:
exec(f.read(), about)
# Public URL to download windows wheel
public_wheels_path = "https://raw.githubusercontent.com/zerodhatech/python-wheels/master/{wheel_name}"
# Twisted package wheel name
twisted_wheel_name = "Twisted-19.2.0-cp{version}-cp{version}m-{platform}.whl"
# Available python versions for Twisted package
twisted_py_versions = ["35", "36", "37"]
# Install package using pip
def pip_install(pkg):
os.system("pip install " + pkg)
class install(_install):
def run(self):
# Service identity has to be installed before twisted.
pip_install("service-identity>=17.0.0")
py_version = "{}{}".format(sys.version_info.major, sys.version_info.minor)
# Check if platform is Windows and package for Python version is available
# Currently python version with enable unicode UCS4 is not supported
if os.name == "nt" and sys.version_info.major > 2 and py_version in twisted_py_versions:
# Install twisted wheels for windows
platform = distutils.util.get_platform().replace("-", "_")
wheel_name = twisted_wheel_name.format(version=py_version, platform=platform)
pip_install(public_wheels_path.format(wheel_name=wheel_name))
else:
# Install from Pypi for other platforms
pip_install("Twisted>=17.9.0")
_install.run(self)
class FakeBdist(Command):
"""Fake bdist wheel class for ignoring bdist_wheel build
"""
user_options = [(
"dist-dir=",
"d",
"directory to put final built distributions in [default: dist]"
), (
"python-tag=",
None,
"Python tag (cp32|cp33|cpNN) for abi3 wheel tag (default:false)"
)]
def initialize_options(self):
self.dist_dir = None
self.python_tag = None
def finalize_options(self):
pass
def run(self):
warnings.warn(
"{name}{version} does not support building wheels".format(
name=about["__title__"],
version=about["__version__"]
)
)
with io.open('README.md', 'rt', encoding='utf8') as f:
readme = f.read()
setup(
name=about["__title__"],
version=about["__version__"],
description=about["__description__"],
long_description=readme,
long_description_content_type='text/markdown',
author=about["__author__"],
author_email=about["__author_email__"],
url=about["__url__"],
download_url=about["__download_url__"],
license=about["__license__"],
packages=["kiteconnect"],
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Financial and Insurance Industry",
"Programming Language :: Python",
"Natural Language :: English",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Topic :: Office/Business :: Financial :: Investment",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Libraries"
],
install_requires=[
"requests>=2.18.4",
"six>=1.11.0",
"pyOpenSSL>=17.5.0",
"enum34>=1.1.6",
"python-dateutil>=2.6.1",
"autobahn[twisted]>=17.10.1"
],
tests_require=["pytest", "responses", "pytest-cov", "mock", "flake8"],
test_suite="tests",
setup_requires=["pytest-runner"],
extras_require={
"doc": ["pdoc"],
':sys_platform=="win32"': ["pywin32"]
},
cmdclass={"install": install, "bdist_wheel": FakeBdist}
)