forked from SimplyY/zhihu-rss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·96 lines (74 loc) · 2.46 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
91
92
93
94
95
96
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys
import os
import re
import ast
from setuptools import setup, find_packages
if sys.argv[-1] == 'publish':
os.system('py setup.py sdist upload')
sys.exit()
def extract_requirements(filename='requirements.txt'):
with open(filename, 'rb') as f_require:
lines = f_require.read().decode('utf-8').split('\n')
# ignore comments and empty lines
require_lines = [
line
for line in lines
if line and not line.strip().startswith('#')
]
# separate dependency links from in-PyPI deps
links, reqs = [], []
for line in require_lines:
(links if '/' in line else reqs).append(line)
return links, reqs
def extract_version():
with open('zhihurss/__init__.py', 'rb') as f_version:
ast_tree = re.search(
r'__version__ = (.*)',
f_version.read().decode('utf-8')
).group(1)
if ast_tree is None:
raise RuntimeError('Cannot find version information')
return str(ast.literal_eval(ast_tree))
return version
with open('README.md', 'rb') as f_readme:
readme = f_readme.read().decode('utf-8')
version = extract_version()
dep_links, requires = extract_requirements()
setup(
name='zhihurss',
version=version,
description='zhihurss',
long_description=readme,
author='SimplyY',
author_email='[email protected]',
license='GPLv3+',
url='https://github.com/SimplyY/zhihu_rss',
download_url='https://github.com/SimplyY/zhihu-py3/releases',
install_requires=requires,
dependency_links=dep_links,
packages=find_packages(),
entry_points={
'gui_scripts': [
'zhihurss = zhihurss.main:run',
],
},
include_package_data=True,
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Environment :: MacOS X',
'Environment :: Win32 (MS Windows)',
'Environment :: X11 Applications :: Qt',
'Intended Audience :: End Users/Desktop',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Natural Language :: Chinese (Simplified)',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Internet :: WWW/HTTP',
]
)