From 53291822c0559a51ae87655a7c155831b172d0d3 Mon Sep 17 00:00:00 2001 From: snowy Date: Sun, 18 Aug 2024 03:57:15 +0800 Subject: [PATCH] =?UTF-8?q?:children=5Fcrossing:=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E5=B7=A5=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- liteyuki/version.py | 23 +++++++++++++++++++++++ pyproject.toml | 7 ++++--- 2 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 liteyuki/version.py diff --git a/liteyuki/version.py b/liteyuki/version.py new file mode 100644 index 00000000..2d77580f --- /dev/null +++ b/liteyuki/version.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +""" +Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved + +@Time : 2024/8/18 上午3:49 +@Author : snowykami +@Email : snowykami@outlook.com +@File : version.py.py +@Software: PyCharm +""" +from git import Repo +from pdm.backend.hooks.version import SCMVersion + +try: + __commit__ = Repo(".").head.commit.hexsha +except: + __commit__ = "unknown" + +__version__ = "6.3.5" + + +def format_version(version: SCMVersion) -> str: + return f"{__version__}+{__commit__[:7]}" diff --git a/pyproject.toml b/pyproject.toml index 893140fe..00a01904 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,6 +20,7 @@ dependencies = [ "PyYAML==6.0.2", "toml==0.10.2", "watchdog==4.0.1", + "GitPython~=3.1.42" ] [project.urls] @@ -29,7 +30,7 @@ Repository = "https://github.com/LiteyukiStudio/LiteyukiBot" [build-system] -requires = ["pdm-backend"] +requires = ["pdm-backend", "loguru", "pydantic", "PyYAML", "toml", "watchdog", "GitPython"] build-backend = "pdm.backend" [tool.pdm.build] @@ -38,5 +39,5 @@ excludes = ["tests/", "docs/", "src/"] [tool.pdm.version] source = "scm" -tag_filter = "test/*" -tag_regex = '^test/(?:\D*)?(?P([1-9][0-9]*!)?(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))*((a|b|c|rc)(0|[1-9][0-9]*))?(\.post(0|[1-9][0-9]*))?(\.dev(0|[1-9][0-9]*))?$)$' \ No newline at end of file +version_format = "liteyuki.version:format_version" +fallback_version = "6.0.0" \ No newline at end of file