Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
fasiondog committed Jan 9, 2024
1 parent 184ed08 commit 28d90f9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions hikyuu_pywrap/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ target("core")
-- find python include and libs directory
local pydir = os.iorun("python -c \"import sys; print(sys.executable)\"")
pydir = path.directory(pydir)
package:add("includedirs", pydir .. "/include")
package:add("linkdirs", pydir .. "/libs")
target:add("includedirs", pydir .. "/include")
target:add("linkdirs", pydir .. "/libs")
return
end

-- get python include directory.
local pydir = try { function () return os.iorun("python3-config --includes"):trim() end }
assert(pydir, "python3-config not found!")
package:add("cxflags", pydir)
target:add("cxflags", pydir)
end)

after_build(function(target)
Expand Down
26 changes: 13 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# -*- coding:utf-8 -*-

from setuptools import setup, find_packages
import sys
Expand All @@ -10,9 +10,9 @@
import click


#------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# 前置检查
#------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
def check_xmake():
"""检查是否按照了编译工具 xmake"""
print("checking xmake ...")
Expand All @@ -25,7 +25,7 @@ def get_python_version():
py_version = platform.python_version_tuple()
min_version = int(py_version[1])
main_version = int(py_version[0])
#py_version = main_version * 10 + min_version if min_version < 10 else main_version * 100 + min_version
# py_version = main_version * 10 + min_version if min_version < 10 else main_version * 100 + min_version
py_version = f"{main_version}.{min_version}"
print(f'current python version: {py_version}')
return py_version
Expand Down Expand Up @@ -102,9 +102,9 @@ def clear_with_python_changed(mode):
shutil.rmtree(build_pywrap_dir)
#------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# 执行构建
#------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
def start_build(verbose=False, mode='release', feedback=True, worker_num=2):
""" 执行编译 """
global g_verbose
Expand All @@ -118,13 +118,13 @@ def start_build(verbose=False, mode='release', feedback=True, worker_num=2):
py_version = current_compile_info['py_version']
#如果 python版本或者编译模式发生变化,则编译依赖的 boost 库(boost.python)
# 如果 python版本或者编译模式发生变化,则编译依赖的 boost 库(boost.python)
history_compile_info = get_history_compile_info()
if py_version != history_compile_info[
'py_version'] or history_compile_info['mode'] != mode:
clear_with_python_changed(mode)
cmd = "xmake f {} -c -y -m {} --pyver={} --feedback={}".format(
"-v -D" if verbose else "", mode, py_version, feedback)
cmd = "xmake f {} -c -y -m {} --feedback={}".format(
"-v -D" if verbose else "", mode, feedback)
print(cmd)
os.system(cmd)
Expand All @@ -143,9 +143,9 @@ def start_build(verbose=False, mode='release', feedback=True, worker_num=2):
save_current_compile_info(current_compile_info)
#------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# 控制台命令
#------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
@click.group()
Expand Down Expand Up @@ -341,9 +341,9 @@ def upload():
os.system("twine upload dist/*")


#------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# 添加 click 命令
#------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
cli.add_command(build)
cli.add_command(test)
cli.add_command(clear)
Expand Down

0 comments on commit 28d90f9

Please sign in to comment.