hikyuu2/sub_setup.py

130 lines
4.3 KiB
Python
Raw Permalink Normal View History

2019-07-27 16:17:28 +08:00
#!/usr/bin/env python
# -*- coding:utf-8 -*-
2019-07-27 16:17:28 +08:00
2020-08-02 18:48:29 +08:00
import platform
2024-01-31 00:27:50 +08:00
import os
try:
from setuptools import find_packages, setup
except ImportError:
from distutils.core import find_packages, setup
def parse_requirements(filename):
line_iter = (line.strip() for line in open(filename))
return [line for line in line_iter if line and not line.startswith('#')]
requirements = parse_requirements('requirements.txt')
2019-07-27 16:17:28 +08:00
hku_version = ''
2020-01-14 23:47:24 +08:00
with open('xmake.lua', 'r', encoding='utf-8') as f:
2019-07-27 16:17:28 +08:00
for line in f:
if len(line) > 15 and line[:11] == 'set_version':
pre_pos = line.find('"') + 1
end_pos = line.find('"', pre_pos)
2020-08-02 18:48:29 +08:00
hku_version = line[pre_pos:end_pos]
2019-07-27 16:17:28 +08:00
break
2020-08-02 18:48:29 +08:00
2019-07-27 16:17:28 +08:00
if not hku_version:
print("无法在 xmake.lua 中找到 set_version 语句,获取版本号失败!")
exit(0)
print('current hikyuu version:', hku_version)
2020-08-02 18:48:29 +08:00
py_version = platform.python_version_tuple()
py_version = int(py_version[0]) * 10 + int(py_version[1])
2019-11-30 23:26:39 +08:00
hku_name = "hikyuu"
# hku_version = "1.0.9"
2019-07-27 16:17:28 +08:00
hku_author = "fasiondog"
hku_author_email = "fasiondog@sina.com"
hku_license = "MIT"
2021-03-23 01:08:56 +08:00
hku_keywords = [
"quant", "trade", "System Trading", "backtester", "量化", "程序化交易", "量化交易",
"系统交易"
]
2019-07-27 16:17:28 +08:00
hku_platforms = "Independant"
hku_url = "http://hikyuu.org/"
hku_description = "Hikyuu Quant Framework for System Trading Analysis and backtester"
2024-08-07 16:15:20 +08:00
with open("./readme.md", encoding='utf-8') as f:
2019-07-27 16:17:28 +08:00
hku_long_description = f.read()
hku_data_files = []
2024-01-31 00:27:50 +08:00
packages = ['hikyuu']
for root, dirs, files in os.walk('hikyuu'):
for p in dirs:
2024-04-03 11:19:09 +08:00
if p.find('__pycache__') < 0 and p.find('ipynb_checkpoints') < 0 \
and p.find('virtual_documents') < 0 and p.find('idea') < 0 and p.find('venv') < 0:
2024-01-31 00:27:50 +08:00
packages.append(f'{root}/{p}')
2019-07-27 16:17:28 +08:00
setup(
2020-08-02 18:48:29 +08:00
name=hku_name,
version=hku_version,
description=hku_description,
2024-08-07 16:15:20 +08:00
# long_description_content_type="text/x-rst",
long_description_content_type='text/markdown',
2020-08-02 18:48:29 +08:00
long_description=hku_long_description,
author=hku_author,
author_email=hku_author_email,
license=hku_license,
keywords=hku_keywords,
platforms=hku_platforms,
url=hku_url,
packages=packages, # find_packages(),
2020-08-02 18:48:29 +08:00
zip_safe=False,
include_package_data=True,
package_data={
'': [
'*.rst', '*.pyd', '*.png', '*.md', '*.ipynb', '*.ini', '*.sql', '*.properties', '*.xml',
2024-12-01 17:07:57 +08:00
'LICENSE.txt', '*.dll', '*.exe', '*.ico', '*.so', '*.dylib', '*.h', '*.lib',
'*.so.*', '*.qm', 'libboost_serialization*',
2021-04-18 01:59:48 +08:00
'libboost_python{}*'.format(py_version)
2019-07-27 16:17:28 +08:00
],
2020-08-02 18:48:29 +08:00
},
data_files=hku_data_files,
classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
2024-10-28 23:05:32 +08:00
'Development Status :: 5 - Production/Stable',
2020-08-02 18:48:29 +08:00
# Indicate who your project is intended for
'Intended Audience :: Developers',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Office/Business :: Financial',
'Topic :: Office/Business :: Financial :: Investment',
'Topic :: Scientific/Engineering :: Mathematics',
# Pick your license as you wish (should match "license" above)
'License :: OSI Approved :: MIT License',
'Operating System :: Microsoft :: Windows',
2024-11-20 17:01:15 +08:00
'Operating System :: POSIX :: Linux',
'Operating System :: MacOS :: MacOS X',
2020-08-02 18:48:29 +08:00
# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
'Programming Language :: Python :: 3',
2022-02-02 18:10:31 +08:00
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
2024-05-06 02:31:01 +08:00
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
2024-10-28 23:05:32 +08:00
'Programming Language :: Python :: 3.13',
2020-08-02 18:48:29 +08:00
],
entry_points={
# win11下使用 GUI 方式,会立刻 timeout导致无法下载
# 'gui_scripts': [
# 'HikyuuTDX=hikyuu.gui.HikyuuTDX:start',
# ],
2020-08-02 18:48:29 +08:00
'console_scripts': [
'HikyuuTDX=hikyuu.gui.HikyuuTDX:start',
2020-08-02 18:48:29 +08:00
'importdata=hikyuu.gui.importdata:main',
]
},
install_requires=requirements,
)