chore(log): add repo git commit log
This commit is contained in:
18
main.py
18
main.py
@@ -30,6 +30,7 @@ import json
|
||||
from pathlib import Path
|
||||
from datetime import datetime, date
|
||||
from typing import Dict, Any, Optional, Tuple, List
|
||||
import git
|
||||
|
||||
import mexc_spot_v3
|
||||
|
||||
@@ -483,15 +484,32 @@ class TradingConfig:
|
||||
|
||||
return today_trades
|
||||
|
||||
def git_commit(repo_path: str = ".") -> str:
|
||||
"""获取Git仓库版本"""
|
||||
|
||||
try:
|
||||
repo = git.Repo(repo_path)
|
||||
return repo.head.commit.hexsha
|
||||
except Exception as _:
|
||||
return None
|
||||
|
||||
def main():
|
||||
"""主函数"""
|
||||
|
||||
logger.info("=" * 40)
|
||||
# 获取主程序Git仓库版本
|
||||
app_commit = git_commit(".")[:10]
|
||||
|
||||
# 确保config目录存在
|
||||
if not os.path.exists("config"):
|
||||
logger.error("配置目录 config 不存在")
|
||||
return
|
||||
|
||||
# 获取config, output仓库版本
|
||||
config_commit = git_commit("config")[:10]
|
||||
output_commit = git_commit("output")[:10]
|
||||
logger.info("主程序 %s, 配置 %s, 输出 %s", app_commit, config_commit, output_commit)
|
||||
|
||||
# 获取config目录下所有json文件
|
||||
config_files = list(Path("config").glob("*.json"))
|
||||
|
||||
|
12
requirements.txt
Normal file
12
requirements.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
certifi
|
||||
charset-normalizer
|
||||
gitdb
|
||||
GitPython
|
||||
icalendar
|
||||
idna
|
||||
python-dateutil
|
||||
requests
|
||||
six
|
||||
smmap
|
||||
tzdata
|
||||
urllib3
|
Reference in New Issue
Block a user