mirror of https://github.com/kendryte/nncase.git
GNNE-1909 remove date in version (#1038)
* remove date in version * remove date in new tag * fix windows * set env for cibuildwheel * Apply code-format changes * test git * use gitpython to confirm tag with data * add build-backend and requires * fix branch without tag --------- Co-authored-by: yanghaoqi <yanghaoqi_intern@canaan-creative.com> Co-authored-by: curioyang <curioyang@users.noreply.github.com>pull/1047/head
parent
ec47028cf2
commit
8d1b273472
|
@ -24,7 +24,8 @@ dependencies = ["numpy"]
|
|||
homepage = "https://github.com/kendryte/nncase"
|
||||
|
||||
[build-system]
|
||||
requires = ["setuptools>=42", "wheel", "conan<=1.59", "ninja"]
|
||||
requires = ["setuptools>=42", "wheel", "conan<=1.59", "ninja", "gitpython"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[tool.cibuildwheel]
|
||||
build = ["cp37*", "cp38*", "cp39*", "cp310*"]
|
||||
|
|
|
@ -17,4 +17,4 @@ pytest-xdist
|
|||
pyyaml
|
||||
pythonnet==3.0.1
|
||||
clr_loader==0.2.4
|
||||
toml==0.10.2
|
||||
toml==0.10.2
|
14
setup.py
14
setup.py
|
@ -12,7 +12,8 @@ import sys
|
|||
import io
|
||||
import re
|
||||
import time
|
||||
|
||||
import subprocess
|
||||
from git.repo import Repo
|
||||
# See ref: https://stackoverflow.com/a/51575996
|
||||
|
||||
|
||||
|
@ -277,8 +278,19 @@ def find_version():
|
|||
version_prefix = re.findall(r"NNCASE_VERSION \"(.+)\"", version_file)
|
||||
|
||||
if version_prefix:
|
||||
repo_path = os.getcwd()
|
||||
repo = Repo(repo_path)
|
||||
if repo.tags:
|
||||
latest_commit = subprocess.check_output(
|
||||
['git', 'rev-parse', 'HEAD']).decode('utf-8').strip()
|
||||
tagged_commit = subprocess.check_output(
|
||||
['git', 'rev-list', '-n', '1', repo.tags[-1].name]).decode('utf-8').strip()
|
||||
if latest_commit == tagged_commit:
|
||||
return version_prefix[0]
|
||||
|
||||
version_suffix = time.strftime("%Y%m%d", time.localtime())
|
||||
return version_prefix[0] + "." + version_suffix
|
||||
|
||||
raise RuntimeError("Unable to find version string.")
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue