11#!/usr/bin/env python
22# -*- coding: utf-8 -*-
33"""
4+ Python packaging for wxpusher.
5+
46File: setup.py
57Author: huxuan
68Email: i(at)huxuan.org
7- Description: Python packaging for wxpusher.
89"""
10+ from pkg_resources import DistributionNotFound
11+ from pkg_resources import get_distribution
12+
913from setuptools import setup
1014
15+ NAME = 'wxpusher'
16+
1117CLASSIFIERS = [
1218 'Development Status :: 4 - Beta' ,
1319 'Intended Audience :: Developers' ,
1420 'License :: OSI Approved :: Apache Software License' ,
1521 'Programming Language :: Python :: 3' ,
1622 'Programming Language :: Python :: 3 :: Only' ,
17- 'Topic :: Utilities'
23+ 'Topic :: Utilities' ,
1824]
1925
2026INSTALL_REQUIRES = [
21- 'requests'
27+ 'requests' ,
2228]
2329
24- DEV_REQUIRES = [
25- 'pycodestyle' ,
26- 'pyflakes' ,
27- 'pylint'
28- ]
29-
30- TEST_REQUIRES = [
31- 'coverage' ,
32- 'nose'
33- ]
34-
35- EXTRAS_REQUIRE = {
36- 'dev' : DEV_REQUIRES ,
37- 'test' : TEST_REQUIRES
38- }
39-
4030DESCRIPTION = (
4131 'WxPusher Python SDK.'
4232)
4333
44- VERSION = open ('VERSION' ).read ().strip ()
34+ KEYWORDS = [
35+ 'wxpusher' ,
36+ 'wechat' ,
37+ 'weixin' ,
38+ 'notification' ,
39+ 'push-notification' ,
40+ 'python-sdk' ,
41+ ]
42+
43+ try :
44+ VERSION = f'v{ get_distribution (NAME ).version } '
45+ except DistributionNotFound :
46+ VERSION = 'master'
47+
4548PROJECT_URL = 'https://github.com/wxpusher/wxpusher-sdk-python'
46- BASE_URL = f'{ PROJECT_URL } /blob/v { VERSION } '
49+ BASE_URL = f'{ PROJECT_URL } /blob/{ VERSION } '
4750
4851
4952def readme ():
@@ -54,19 +57,19 @@ def readme():
5457 return content
5558
5659
57- setup (name = 'wxpusher' ,
58- version = VERSION ,
60+ setup (name = NAME ,
5961 description = DESCRIPTION ,
6062 long_description = readme (),
6163 long_description_content_type = 'text/markdown' ,
6264 classifiers = CLASSIFIERS ,
63- keywords = 'wxpusher wechat push-notification' ,
64- url = 'https://github.com/wxpusher/wxpusher-sdk-python' ,
65+ keywords = ' ' . join ( KEYWORDS ) ,
66+ url = PROJECT_URL ,
6567 author = 'Xuan (Sean) Hu' ,
6668 author_email = 'i+wxpusher@huxuan.org' ,
6769 license = 'Apache License 2.0' ,
6870 packages = ['wxpusher' ],
71+ use_scm_version = True ,
72+ setup_requires = ['setuptools_scm' ],
6973 install_requires = INSTALL_REQUIRES ,
70- extras_require = EXTRAS_REQUIRE ,
7174 python_requires = '>=3' ,
7275 include_package_data = True )
0 commit comments