-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
54 lines (45 loc) · 1.4 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# -*- coding: utf-8 -*-
"""
* @Date: 2022-10-13 09:49:04
* @LastEditors: hwrn [email protected]
* @LastEditTime: 2024-04-25 11:23:07
* @FilePath: /genome/setup.py
* @Description:
"""
import os
from pathlib import Path
repo_path = Path(__file__).parent
os.chdir(repo_path)
def get_version(file: str | Path):
"first try get version via versionneer, then try to get version from changelog.md"
try:
from tests.genome._version import get_versions
version = get_versions()["version"]
if version:
return version
except ImportError:
pass
with open(file) as f:
for line in f:
if line.startswith("## changelog"):
break
for line in f:
if line.strip():
break
v = line.strip().rsplit(maxsplit=1)
else:
v = ["", "0+unknown"]
version = v[1].rstrip(":")
return version
if __name__ == "__main__":
from setuptools import setup, find_packages
setup(
name="genome",
version=get_version(repo_path / "changelog.md"),
author="hwrn.aou",
author_email="[email protected]",
description="genome storage and analysis unit",
# 你要安装的包,通过 setuptools.find_packages 找到当前目录下有哪些包
packages=find_packages(include=["genome*"]),
include_package_data=True,
)