2019-02-19 02:39:23 +00:00
|
|
|
import platform
|
2019-02-26 02:31:23 +00:00
|
|
|
import ast
|
|
|
|
import re
|
2019-02-18 09:40:15 +00:00
|
|
|
from setuptools import Extension, find_packages, setup
|
|
|
|
|
2019-02-26 02:31:23 +00:00
|
|
|
with open("vnpy/__init__.py", "rb") as f:
|
|
|
|
version_line = re.search(
|
|
|
|
r"__version__\s+=\s+(.*)", f.read().decode("utf-8")
|
|
|
|
).group(1)
|
|
|
|
version = str(ast.literal_eval(version_line))
|
|
|
|
|
2019-02-19 02:39:23 +00:00
|
|
|
if platform.uname().system == "Windows":
|
|
|
|
compiler_flags = []
|
|
|
|
else:
|
2019-02-26 02:31:23 +00:00
|
|
|
compiler_flags = ["-std=c++11", "-Wno-delete-incomplete"]
|
2019-02-19 02:39:23 +00:00
|
|
|
|
2019-02-26 02:31:23 +00:00
|
|
|
vnctpmd = Extension("vnpy.api.ctp.vnctpmd",
|
2019-02-18 09:40:15 +00:00
|
|
|
[
|
|
|
|
"vnpy/api/ctp/vnctp/vnctpmd/vnctpmd.cpp",
|
|
|
|
],
|
|
|
|
include_dirs=["vnpy/api/ctp/include", "vnpy/api/ctp/vnctp", ],
|
|
|
|
define_macros=[],
|
|
|
|
undef_macros=[],
|
|
|
|
library_dirs=["vnpy/api/ctp/libs"],
|
|
|
|
libraries=["thostmduserapi", "thosttraderapi", ],
|
2019-02-19 02:39:23 +00:00
|
|
|
extra_compile_args=compiler_flags,
|
2019-02-18 09:40:15 +00:00
|
|
|
extra_link_args=[],
|
|
|
|
depends=[],
|
|
|
|
language="cpp",
|
|
|
|
)
|
2019-02-26 02:31:23 +00:00
|
|
|
vnctptd = Extension("vnpy.api.ctp.vnctptd",
|
2019-02-18 09:40:15 +00:00
|
|
|
[
|
|
|
|
"vnpy/api/ctp/vnctp/vnctptd/vnctptd.cpp",
|
|
|
|
],
|
|
|
|
include_dirs=["vnpy/api/ctp/include", "vnpy/api/ctp/vnctp", ],
|
|
|
|
define_macros=[],
|
|
|
|
undef_macros=[],
|
|
|
|
library_dirs=["vnpy/api/ctp/libs"],
|
|
|
|
libraries=["thostmduserapi", "thosttraderapi", ],
|
2019-02-19 02:39:23 +00:00
|
|
|
extra_compile_args=compiler_flags,
|
2019-02-18 09:40:15 +00:00
|
|
|
extra_link_args=[],
|
|
|
|
depends=[],
|
|
|
|
language="cpp",
|
|
|
|
)
|
|
|
|
|
2019-02-26 02:47:19 +00:00
|
|
|
# use built in pyd for windows
|
2019-02-25 03:33:22 +00:00
|
|
|
if platform.uname().system == "Windows":
|
2019-02-26 02:47:19 +00:00
|
|
|
ext_modules = []
|
2019-02-25 03:33:22 +00:00
|
|
|
else:
|
|
|
|
ext_modules = [vnctptd, vnctpmd],
|
|
|
|
|
2019-02-19 02:39:23 +00:00
|
|
|
pkgs = find_packages()
|
|
|
|
|
|
|
|
s = setup(
|
2019-02-18 09:40:15 +00:00
|
|
|
name="vnpy",
|
2019-02-26 02:31:23 +00:00
|
|
|
version=version,
|
2019-02-19 02:39:23 +00:00
|
|
|
include_package_data=True,
|
|
|
|
packages=pkgs,
|
2019-02-26 02:31:23 +00:00
|
|
|
package_data={"": [
|
|
|
|
"*.json", "*.md", "*.ico",
|
2019-02-26 06:46:45 +00:00
|
|
|
"*.dll", "*.so", "*.pyd"
|
2019-02-19 02:39:23 +00:00
|
|
|
]},
|
2019-02-26 02:31:23 +00:00
|
|
|
install_requires=[],
|
2019-02-25 03:33:22 +00:00
|
|
|
ext_modules=ext_modules
|
2019-02-18 09:40:15 +00:00
|
|
|
)
|