1
|
|
|
#!/usr/bin/env python |
2
|
|
|
from __future__ import with_statement, print_function |
3
|
|
|
|
4
|
|
|
try: |
5
|
|
|
# python setup.py test |
6
|
|
|
import multiprocessing # NOQA |
7
|
|
|
except ImportError: |
8
|
|
|
pass |
9
|
|
|
|
10
|
|
|
import os |
11
|
|
|
import sys |
12
|
|
|
|
13
|
|
|
from setuptools import setup, find_packages |
14
|
|
|
from setuptools.command.test import test as TestCommand |
15
|
|
|
|
16
|
|
|
|
17
|
|
|
class PyTest(TestCommand): |
18
|
|
|
user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")] |
19
|
|
|
|
20
|
|
|
def initialize_options(self): |
21
|
|
|
TestCommand.initialize_options(self) |
22
|
|
|
self.pytest_args = [] |
23
|
|
|
|
24
|
|
|
def finalize_options(self): |
25
|
|
|
TestCommand.finalize_options(self) |
26
|
|
|
self.test_args = [] |
27
|
|
|
self.test_suite = True |
28
|
|
|
|
29
|
|
|
def run_tests(self): |
30
|
|
|
import pytest |
31
|
|
|
errno = pytest.main(self.pytest_args) |
32
|
|
|
sys.exit(errno) |
33
|
|
|
|
34
|
|
|
|
35
|
|
|
cmdclass = {} |
36
|
|
|
cmdclass['test'] = PyTest |
37
|
|
|
|
38
|
|
|
# patch bdist_wheel |
39
|
|
|
try: |
40
|
|
|
from wheel.bdist_wheel import bdist_wheel |
41
|
|
|
|
42
|
|
|
REPLACE = ( |
43
|
|
|
'macosx_10_6_intel.' |
44
|
|
|
'macosx_10_9_intel.' |
45
|
|
|
'macosx_10_9_x86_64.' |
46
|
|
|
'macosx_10_10_intel.' |
47
|
|
|
'macosx_10_10_x86_64' |
48
|
|
|
) |
49
|
|
|
|
50
|
|
|
class _bdist_wheel(bdist_wheel): |
51
|
|
|
def get_tag(self): |
52
|
|
|
tag = bdist_wheel.get_tag(self) |
53
|
|
|
if tag[2] == 'macosx_10_6_intel': |
54
|
|
|
tag = (tag[0], tag[1], REPLACE) |
55
|
|
|
return tag |
56
|
|
|
|
57
|
|
|
cmdclass['bdist_wheel'] = _bdist_wheel |
58
|
|
|
except ImportError: |
59
|
|
|
pass |
60
|
|
|
|
61
|
|
|
readme = 'README.md' |
62
|
|
|
if os.path.exists('README.rst'): |
63
|
|
|
readme = 'README.rst' |
64
|
|
|
with open(readme, 'rb') as f: |
65
|
|
|
long_description = f.read().decode('utf-8') |
66
|
|
|
|
67
|
|
|
with open('requirements.txt') as f: |
68
|
|
|
requirements = [l for l in f.read().splitlines() if l] |
69
|
|
|
|
70
|
|
|
setup( |
71
|
|
|
name='wechatpy', |
72
|
|
|
version='1.2.8', |
73
|
|
|
author='messense', |
74
|
|
|
author_email='[email protected]', |
75
|
|
|
url='https://github.com/messense/wechatpy', |
76
|
|
|
packages=find_packages(), |
77
|
|
|
keywords='WeChat, wexin, SDK', |
78
|
|
|
description='wechatpy: WeChat SDK for Python', |
79
|
|
|
long_description=long_description, |
80
|
|
|
install_requires=requirements, |
81
|
|
|
include_package_data=True, |
82
|
|
|
# namespace_packages=['wechatpy'], |
83
|
|
|
tests_require=[ |
84
|
|
|
'pytest', |
85
|
|
|
'httmock', |
86
|
|
|
'redis', |
87
|
|
|
'pymemcache', |
88
|
|
|
'shove', |
89
|
|
|
], |
90
|
|
|
cmdclass=cmdclass, |
91
|
|
|
classifiers=[ |
92
|
|
|
'Development Status :: 5 - Production/Stable', |
93
|
|
|
'License :: OSI Approved :: MIT License', |
94
|
|
|
'Operating System :: MacOS', |
95
|
|
|
'Operating System :: POSIX', |
96
|
|
|
'Operating System :: POSIX :: Linux', |
97
|
|
|
'Programming Language :: Python', |
98
|
|
|
'Programming Language :: Python :: 2.6', |
99
|
|
|
'Programming Language :: Python :: 2.7', |
100
|
|
|
'Programming Language :: Python :: 3.3', |
101
|
|
|
'Programming Language :: Python :: 3.4', |
102
|
|
|
'Programming Language :: Python :: 3.5', |
103
|
|
|
'Programming Language :: Python :: Implementation :: CPython', |
104
|
|
|
'Programming Language :: Python :: Implementation :: PyPy', |
105
|
|
|
'Intended Audience :: Developers', |
106
|
|
|
'Topic :: Software Development :: Libraries', |
107
|
|
|
'Topic :: Software Development :: Libraries :: Python Modules', |
108
|
|
|
'Topic :: Utilities', |
109
|
|
|
], |
110
|
|
|
extras_require={ |
111
|
|
|
'cryptography': ['cryptography'], |
112
|
|
|
'pycrypto': ['pycrypto'], |
113
|
|
|
} |
114
|
|
|
) |
115
|
|
|
|