File: setup.py

package info (click to toggle)
python-stomp 4.1.19-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 528 kB
  • sloc: python: 3,507; makefile: 219
file content (127 lines) | stat: -rwxr-xr-x 3,205 bytes parent folder | download | duplicates (2)
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/usr/bin/env python

from distutils.core import Command
from setuptools import setup
import platform
import logging.config
import os
import shutil
import sys
import unittest

try:
    logging.config.fileConfig('stomp.log.conf')
except:
    pass

# Import this after configuring logging
import stomp


class TestCommand(Command):
    user_options = [('test=', 't', 'specific test to run')]

    def initialize_options(self):
        self.test = '*'

    def finalize_options(self):
        pass

    def run(self):
        try:
            import coverage
            cov = coverage.coverage()
            cov.start()
        except ImportError:
            cov = None

        suite = unittest.TestSuite()
        import stomp.test
        if self.test == '*':
            print('Running all tests')
            tests = stomp.test.__all__
        else:
            tests = self.test.split(',')
        for tst in tests:
            suite.addTests(unittest.TestLoader().loadTestsFromName('stomp.test.%s' % tst))

        runner = unittest.TextTestRunner(verbosity=2)
        res = runner.run(suite)
        if len(res.errors) > 0 or len(res.failures) > 0:
            sys.exit(1)

        if cov:
            cov.stop()
            cov.save()
            cov.html_report(directory='../stomppy-docs/htmlcov')


class TestPipInstallCommand(Command):
    user_options = []

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self):
        if sys.hexversion <= 33950192 or \
            (platform.python_implementation() == 'PyPy' and sys.version_info.major == 3 and sys.version_info.minor < 3):
            # spurious failure on py2.6, so drop out here
            # also failing on pypy3 <3.2
            return
        if os.path.exists('tmp'):
            shutil.rmtree('tmp')
        os.mkdir('tmp')

        from virtualenvapi.manage import VirtualEnvironment
        env = VirtualEnvironment('tmp/scratch')
        env.install('stomp.py')


class DoxygenCommand(Command):
    user_options = []

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self):
        os.system('doxygen config.dox')


def version():
    s = []
    for num in stomp.__version__:
        s.append(str(num))
    return '.'.join(s)


setup(
    name='stomp.py',
    version=version(),
    description='Python STOMP client, supporting versions 1.0, 1.1 and 1.2 of the protocol',
    license='Apache',
    url='https://github.com/jasonrbriggs/stomp.py',
    author='Jason R Briggs',
    author_email='jasonrbriggs@gmail.com',
    platforms=['any'],
    install_requires = ['docopt>=0.6.2'],
    packages=['stomp', 'stomp.adapter'],
    cmdclass={'test': TestCommand, 'docs': DoxygenCommand, 'piptest': TestPipInstallCommand},
    entry_points={
        'console_scripts': [
            'stomp = stomp.__main__:main',
        ],
    },
    classifiers=[
         'Development Status :: 5 - Production/Stable',
         'Intended Audience :: Developers',
         'License :: OSI Approved :: Apache Software License',
         'Programming Language :: Python :: 2',
         'Programming Language :: Python :: 3'
    ]
)