-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
setup.py
executable file
·90 lines (79 loc) · 2.44 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
89
90
#!/usr/bin/env python
# coding=utf-8
import io
import re
from setuptools import setup
# https://packaging.python.org/single_source_version/
# CAN'T believe there is no single *clean* way of retrieving the version.
def getmeta(path, encoding = 'utf8'):
with io.open(path, encoding = encoding) as fp:
content = fp.read()
metakeys = ['title', 'version', 'desc', 'author', 'license', 'url']
metatrans = {'title': 'name', 'desc': 'description'}
meta = {}
for mk in metakeys:
match = re.search(
r"^__" + mk + r"__\s*=\s*['\"]([^'\"]*)['\"]",
content, re.M)
if match:
if mk in metatrans:
key = metatrans[mk]
else:
key = mk
meta[key] = match.group(1)
else:
raise RuntimeError("Unable to find meta key: {}".format(mk))
return meta
meta = getmeta('bypy/const.py')
long_desc = '''\
Documents:
~~~~~~~~~~
See: https://github.com/houtianze/bypy
'''
requirements = []
with open('HISTORY.rst') as f:
long_desc += f.read()
with open('requirements.txt') as f:
requirements = list(filter(lambda x: x and not x.startswith('#'), map(str.strip, f.read().splitlines())))
setup(
long_description=long_desc,
author_email = '[email protected]',
download_url = 'https://github.com/houtianze/bypy/tarball/' + meta['version'],
#packages=find_packages(),
packages = ['bypy', 'bypy.res', 'bypy.test'],
package_data = {
'bypy': ['../*.rst', '*.pem'],
'bypy.res': ['*.json']
},
entry_points = {
'console_scripts': [
'bypy = bypy.bypy:main'
],
'gui_scripts': [
'bypygui = bypy.gui:main'
]
},
test_suite = 'bypy.test',
keywords = ['bypy', 'bypy.py', 'baidu pcs', 'baidu yun', 'baidu pan', 'baidu netdisk',
'baidu cloud storage', 'baidu personal cloud storage',
'百度云', '百度云盘', '百度网盘', '百度个人云存储'],
classifiers = [
'Development Status :: 4 - Beta',
'Environment :: Console',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Operating System :: Unix',
'Programming Language :: Python',
'Topic :: Utilities',
'Topic :: Internet :: WWW/HTTP'],
install_requires = requirements,
include_package_data = True,
**meta
)
# vim: tabstop=4 noexpandtab shiftwidth=4 softtabstop=4 ff=unix fileencoding=utf-8