forked from Meituan-Dianping/lyrebird
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
75 lines (66 loc) · 2.22 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import runpy
import os
import sys
from packaging import version
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
VERSION = runpy.run_path(
os.path.join(here, "lyrebird", "version.py")
)["VERSION"]
def read_requirements(file_path):
with open(file_path, encoding='utf-8') as f:
return [
line.strip().split(';')[0].strip()
for line in f
if line.strip() and not line.startswith('#') and (
'; python_version' not in line or
check_version_condition(line.split(';')[1].strip())
)
]
def check_version_condition(condition):
if not condition.startswith('python_version'):
return True
op, ver = condition.split(' ', 1)[1].split(' ')
current_ver = version.parse('.'.join(map(str, sys.version_info[:2])))
ver = version.parse(ver.strip('"'))
return {
'>': current_ver > ver,
'>=': current_ver >= ver,
'<': current_ver < ver,
'<=': current_ver <= ver,
'==': current_ver == ver
}.get(op, False)
with open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='lyrebird',
version=VERSION,
packages=['lyrebird'],
url='https://github.com/meituan/lyrebird',
author='HBQA',
long_description=long_description,
long_description_content_type="text/markdown",
include_package_data=True,
zip_safe=False,
classifiers=[
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
],
entry_points={
'console_scripts': [
'lyrebird = lyrebird.manager:main'
]
},
install_requires=read_requirements('requirements.txt.lock'),
extras_require={
'dev': read_requirements('requirements.dev.txt')
}
)