forked from wenxingxing/pytdx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
78 lines (68 loc) · 1.98 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
#!/usr/bin/env python
from setuptools import setup, find_packages
import os
PYTDX_CYTHON = os.getenv("PYTDX_CYTHON", None)
if PYTDX_CYTHON:
from Cython.Build import cythonize
cythonkw = {
"ext_modules": cythonize(
["pytdx/reader/c_gbbq_reader.pyx",
'pytdx/parser/get_security_quotes.py',
'pytdx/parser/base.py',
'pytdx/helper.py',
'pytdx/hq.py',
'pytdx/base_socket_client.py',
])
}
else:
cythonkw = {}
try:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
except (IOError, ImportError):
print(30 * "*")
print("Notice, NEED TO INSTALL *pypandoc* TO get full description of package")
print(30 * "*")
long_description = ''
# try get current branch
cur_branch = 'master'
try:
from git import Repo
cur_path = os.path.abspath(os.path.dirname(__file__))
repo = Repo(cur_path)
cur_branch = repo.active_branch.name
except Exception as e:
print(30 * "*")
print("Notice, NEED TO INSTALL *GitPython* TO setup package with branch name")
print(30 * "*")
pkg_name = 'pytdx'
if cur_branch != 'master':
pkg_name = 'pytdx-' + cur_branch
print(30 * '-')
print("Current Branch is {}, so package name is {}".format(cur_branch, pkg_name))
print(30 * '-')
setup(
name=pkg_name,
version='1.72',
description='A Python Interface to TDX protocol',
long_description=long_description,
author=['RainX<Jing Xu>', 'yutiansut'],
author_email='i@rainx.cc',
url='https://github.com/rainx/pytdx',
packages=find_packages(),
install_requires=[
'click',
'pandas',
'six',
'cryptography',
],
entry_points={
'console_scripts': [
'hqget=pytdx.bin.hqget:main',
'hqreader=pytdx.bin.hqreader:main',
'get_tts=pytdx.bin.get_tdx_trader_server:main',
'hqbenchmark=pytdx.bin.hqbenchmark:main',
]
},
**cythonkw
)