-
Notifications
You must be signed in to change notification settings - Fork 35
/
setup.py
75 lines (64 loc) · 2.26 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 re
import os
import time
# 设置时区
os.environ['TZ'] = 'Asia/Shanghai'
def get_version(package):
"""
Return package version as listed in `__version__` in `__init__.py`.
"""
init_py = open(os.path.join(package, '__init__.py'), encoding="utf-8").read()
mth = re.search("__version__\s?=\s?['\"]([^'\"]+)['\"]", init_py)
if mth:
print("Version:", mth.group(1))
return mth.group(1)
return mth.group(1) + "." + time.strftime("%Y%m%d.%H%M", time.localtime())
else:
raise RuntimeError("Cannot find version!")
def install_requires():
"""
Return requires in requirements.txt
:return:
"""
try:
with open("requirements.txt", encoding='utf-8') as f:
return [line.strip() for line in f.readlines() if line.strip()]
except OSError:
return []
def parse_description():
"""
Parse the description in the README file
CommandLine:
pandoc --from=markdown --to=rst --output=README.rst README.md
python -c "import setup; print(setup.parse_description())"
"""
from os.path import dirname, join, exists
readme_fpath = join(dirname(__file__), 'README.rst')
# This breaks on pip install, so check that it exists.
if exists(readme_fpath):
with open(readme_fpath, 'r', encoding="utf-8") as f:
text = f.read()
return text
return ''
from setuptools import setup, find_packages
setup(
name="pyefun",
version=get_version('pyefun'),
packages=find_packages('.'),
# scripts = ['say_hello.py'],
# Project uses reStructuredText, so ensure that the docutils get
# installed or upgraded on the target machine
install_requires=install_requires(),
package_data={
'': ['*.txt', '*.rst', '*.md'],
},
# metadata for upload to PyPI
author="duolabmeng",
author_email="1715109585@qq.com",
description="pyefun 为python提供强大且易用的中文函数库,完整的封装了易语言核心支持库所有功能,以及易语言中简单易用的函数",
license="Apache 2",
keywords="pyefun 易语言",
url="https://github.com/duolabmeng6/pyefun", # project home page, if any
long_description=parse_description(),
long_description_content_type='text/markdown',
)