-
Notifications
You must be signed in to change notification settings - Fork 233
/
setup.py
88 lines (69 loc) · 2.01 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
76
77
78
79
80
81
82
83
84
85
86
87
88
"""
setup
"""
import os
from typing import List
import semver
import setuptools
def versioning(version: str) -> str:
"""
version to specification
Author: Huan <zixia@zixia.net> (https://github.com/huan)
X.Y.Z -> X.Y.devZ
"""
sem_ver = semver.parse(version)
major = sem_ver['major']
minor = sem_ver['minor']
patch = str(sem_ver['patch'])
if minor % 2:
patch = 'dev' + patch
fin_ver = '%d.%d.%s' % (
major,
minor,
patch,
)
return fin_ver
def get_version() -> str:
"""
read version from VERSION file
"""
version = '0.0.0'
with open(
os.path.join(
os.path.dirname(__file__),
'VERSION'
)
) as version_fh:
# Get X.Y.Z
version = version_fh.read().strip()
# versioning from X.Y.Z to X.Y.devZ
version = versioning(version)
return version
def get_long_description() -> str:
"""get long_description"""
with open('README.md', 'r') as readme_fh:
return readme_fh.read()
def get_install_requires() -> List[str]:
"""get install_requires"""
with open('requirements.txt', 'r') as requirements_fh:
return requirements_fh.read().splitlines()
setuptools.setup(
name='wechaty',
version=get_version(),
author='Jingjing WU (吴京京)',
author_email='wechaty@chatie.io',
description='Wechaty is a Conversational RPA SDK for Chatbot Makers',
long_description=get_long_description(),
long_description_content_type='text/markdown',
license='Apache-2.0',
url='https://github.com/wechaty/python-wechaty',
packages=setuptools.find_packages('src', exclude=['__pycache__', '.mypy_cache']),
include_package_data=True,
package_dir={'wechaty': 'src/wechaty'},
install_requires=get_install_requires(),
classifiers=[
'Programming Language :: Python :: 3.7',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
],
)