-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
executable file
·71 lines (61 loc) · 2.02 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
from pathlib import Path
import re
from setuptools import setup, find_packages
here = Path(__file__).parent
def read(*parts):
""" 读取一个文件并返回内容
"""
return here.joinpath(*parts).read_text(encoding='utf8')
def find_version(*file_paths):
""" 从 __init__.py 的 __version__ 变量中提取版本号
"""
version_file = read(*file_paths)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
def find_requires(*file_paths):
""" 将提供的 requirements.txt 按行转换成 list
"""
require_file = read(*file_paths)
return require_file.splitlines()
classifiers = [
'Programming Language :: Python :: 3.11',
'Development Status :: 4 - Beta',
'Environment :: Console',
'Environment :: Web Environment',
'Operating System :: POSIX :: Linux',
'Topic :: Internet :: WWW/HTTP :: Site Management',
'Topic :: Utilities',
'License :: OSI Approved :: BSD License',
]
# 使用 flask 的扩展
entry_points = {
'console_scripts': [
'pyape=pyape.builder.command:main',
]
}
package_data = {
'pyape.tpl' : ['*.jinja2', '*.py', '*.toml', '.gitignore']
}
setup(
name = "pyape",
version=find_version('pyape', '__init__.py'),
description = "The Python Application Programming Environment.",
long_description=read('README.md'),
long_description_content_type='text/markdown',
author = "zrong",
author_email = "[email protected]",
url = "https://github.com/zrong/pyape",
license = "BSD 3",
keywords = "development zrong flask wechat",
python_requires='>=3.11, <4',
packages = find_packages(exclude=['test*', 'doc*', 'fabric']),
install_requires=find_requires('requirements', 'dev.txt'),
entry_points=entry_points,
include_package_data = True,
zip_safe=False,
classifiers = classifiers,
package_data=package_data
)