commit
7a71f602d0
6
.gitignore
vendored
6
.gitignore
vendored
@ -59,6 +59,8 @@ build/Makefile
|
||||
.gitignore
|
||||
temp/
|
||||
|
||||
|
||||
|
||||
# setup.py install 临时文件
|
||||
dist
|
||||
*.egg
|
||||
*.egg-info
|
||||
|
||||
|
@ -39,9 +39,31 @@ $ mongod --smallfiles --config /etc/mongodb.conf
|
||||
|
||||
|
||||
|
||||
# Windows 支持
|
||||
|
||||
Windows 使用 [Xming](http://www.straightrunning.com/XmingNotes/) 作为 X11 服务器,安装配置网络连接之后启动 docker 容器。
|
||||
|
||||
|
||||
|
||||
# OS X 支持
|
||||
|
||||
// TODO
|
||||
由于 OS X 没有自带 X11 服务器,需要手动安装后并配置允许网络客户端连接.
|
||||
|
||||
* 安装 xquartz 作为 X11 服务器
|
||||
|
||||
~~~sh
|
||||
$ brew cask install xquartz
|
||||
~~~
|
||||
|
||||
* 打开 xquartz 并配置允许网络连接
|
||||
|
||||
![xquartz config](xquartz_preferences.png)
|
||||
|
||||
* 执行脚本启动 docker
|
||||
|
||||
~~~sh
|
||||
$ ./run.sh
|
||||
~~~
|
||||
|
||||
参考博客 : [docker-for-mac-and-gui-applications](https://fredrikaverpil.github.io/2016/07/31/docker-for-mac-and-gui-applications/)
|
||||
|
||||
|
@ -4,10 +4,48 @@ THIS_DIR=$(cd `dirname $0`; pwd -P)
|
||||
TOPDIR=${THIS_DIR}/../..
|
||||
|
||||
id=vnpyuser
|
||||
|
||||
display="-v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY"
|
||||
ostype=Linux
|
||||
display=
|
||||
volume="-v ${TOPDIR}:/srv/vnpy"
|
||||
|
||||
docker run -it --rm --name vnpy -u $id $display $volume vnpy /bin/bash
|
||||
timezone="-e TZ=UTC-8"
|
||||
|
||||
|
||||
function os_detect() {
|
||||
osname=`uname -s`
|
||||
case "${osname}" in
|
||||
Linux*) ostype=Linux;;
|
||||
Darwin*) ostype=Mac;;
|
||||
CYGWIN*) ostype=Cywin;;
|
||||
MINGW*) ostype=Mingw;;
|
||||
*) ostype="Unknown-${osname}"
|
||||
esac
|
||||
echo "Your system is : ${ostype}"
|
||||
}
|
||||
|
||||
function osx_ip() {
|
||||
ip=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
|
||||
|
||||
if [ -z "$ip" ]; then
|
||||
ip=$(ifconfig en1 | grep inet | awk '$1=="inet" {print $2}')
|
||||
fi
|
||||
}
|
||||
|
||||
os_detect
|
||||
if [ "${ostype}" = "Linux" ]; then
|
||||
display="-v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY"
|
||||
elif [ "${ostype}" = "Mac" ]; then
|
||||
osx_ip
|
||||
display_number=`ps -ef | grep "Xquartz :\d" | grep -v xinit | awk '{ print $9; }'`
|
||||
display="-v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=${ip}${display_number}"
|
||||
xhost + $ip
|
||||
elif [ "${ostype}" = "Cywin" ]; then
|
||||
|
||||
elif [ "${ostype}" = "Mingw" ]; then
|
||||
|
||||
fi
|
||||
|
||||
docker_args="-u $id $display $volume $timezone"
|
||||
|
||||
docker run -it -d --name vnpy $docker_args vnpy /bin/bash
|
||||
|
||||
|
||||
|
BIN
docker/gui/xquartz_preferences.png
Normal file
BIN
docker/gui/xquartz_preferences.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 61 KiB |
13
install.sh
13
install.sh
@ -1,20 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
function check_result() {
|
||||
if [ $? -ne 0 ]; then
|
||||
echo " "
|
||||
echo "do command failed for $1 !!!"
|
||||
echo " "
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
#Build ctp/lts/ib api
|
||||
pushd vnpy/api/ctp
|
||||
bash build.sh
|
||||
check_result "build api.ctp"
|
||||
popd
|
||||
|
||||
pushd vnpy/api/lts
|
||||
bash build.sh
|
||||
check_result "build api.lts"
|
||||
popd
|
||||
|
||||
pushd vnpy/api/xtp
|
||||
bash build.sh
|
||||
check_result "build api.xtp"
|
||||
popd
|
||||
|
||||
pushd vnpy/api/ib
|
||||
bash build.sh
|
||||
check_result "build api.ib"
|
||||
popd
|
||||
|
||||
#Install Python Modules
|
||||
|
15
setup.py
15
setup.py
@ -19,22 +19,11 @@ other financial markets.
|
||||
|
||||
|
||||
import os
|
||||
from setuptools import setup
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
import vnpy
|
||||
|
||||
|
||||
def getSubpackages(name):
|
||||
"""获取该模块下所有的子模块名称"""
|
||||
splist = []
|
||||
|
||||
for dirpath, _dirnames, _filenames in os.walk(name):
|
||||
if os.path.isfile(os.path.join(dirpath, '__init__.py')):
|
||||
splist.append(".".join(dirpath.split(os.sep)))
|
||||
|
||||
return splist
|
||||
|
||||
|
||||
setup(
|
||||
name='vnpy',
|
||||
version=vnpy.__version__,
|
||||
@ -55,7 +44,7 @@ setup(
|
||||
'Topic :: Office/Business :: Financial :: Investment',
|
||||
'Programming Language :: Python :: Implementation :: CPython',
|
||||
'License :: OSI Approved :: MIT License'],
|
||||
packages=getSubpackages('vnpy'),
|
||||
packages=find_packages(),
|
||||
package_data={'': ['*.json', '*.md', '*.ico',
|
||||
'*.h', '*.cpp', '*.bash', '*.txt',
|
||||
'*.dll', '*.lib', '*.so', '*.pyd',
|
||||
|
Loading…
Reference in New Issue
Block a user