This repository has been archived by the owner on Feb 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.py
92 lines (82 loc) · 3.26 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
"""
Beaconpush is a scalable real-time messaging server.
This client helps you interact, send/receive commands and
listen for incoming events generated by the server.
It only works with the On-Site edition.
"""
import re
from setuptools import setup, Command
# Read version with regex since we cannot load/exec() the file because of yet-to-be-installed dependencies.
VERSION = re.compile("__version__\s+=\s+'(.*)'").findall(open('beaconpush/__init__.py').read())[0]
class monkeypatch_teamcity(Command):
description = "Monkeypatch unittest runner to enable TeamCity test output"
user_options = []
def initialize_options(self): pass
def finalize_options(self): pass
def run(self):
from beaconpush.tests import monkeypatch_teamcity_runner
from setuptools.command.test import test
org_run_tests = test.run_tests
def monkeypatch(*args, **kwargs):
monkeypatch_teamcity_runner()
org_run_tests(*args, **kwargs)
test.run_tests = monkeypatch
class run_audit(Command):
"""
Audits source code using PyFlakes for following issues:
- Names which are used but not defined or used before they are defined.
- Names which are redefined without having been used.
(Borrowed from Flask)
"""
description = "Audit source code with PyFlakes"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
import os, sys
try:
import pyflakes.scripts.pyflakes as flakes
except ImportError:
print "Audit requires PyFlakes installed in your system."
sys.exit(-1)
warns = 0
# Define top-level directories
dirs = ('beaconpush',)
for dir in dirs:
for root, _, files in os.walk(dir):
for file in files:
if file != '__init__.py' and file.endswith('.py') and 'generated' not in root:
warns += flakes.checkPath(os.path.join(root, file))
if warns > 0:
print "Audit finished with total %d warnings." % warns
else:
print "No problems found in sourcecode."
setup(
name='beaconpush-client',
version=VERSION,
url='http://beaconpush.com',
description="Client for Beaconpush real-time messaging server.",
long_description=__doc__,
classifiers=[
"Topic :: Software Development :: Libraries :: Python Modules",
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Intended Audience :: Developers",
],
author='ESN Social Software',
author_email='',
license='MIT',
packages=['beaconpush', 'beaconpush.generated_thrift'],
include_package_data=True,
zip_safe=True,
install_requires=['distribute', 'gevent>=0.13.0', 'thrift>=0.8.0'],
tests_require=['teamcity-messages >= 1.6'],
test_suite='beaconpush.tests',
cmdclass={'audit': run_audit, 'monkeypatch_teamcity': monkeypatch_teamcity}
)