4
# Copyright (c) 2010 Brian E. Granger
6
# This file is part of pyzmq.
8
# pyzmq is free software; you can redistribute it and/or modify it under
9
# the terms of the Lesser GNU General Public License as published by
10
# the Free Software Foundation; either version 3 of the License, or
11
# (at your option) any later version.
13
# pyzmq is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# Lesser GNU General Public License for more details.
18
# You should have received a copy of the Lesser GNU General Public License
19
# along with this program. If not, see <http://www.gnu.org/licenses/>.
22
#-----------------------------------------------------------------------------
24
#-----------------------------------------------------------------------------
28
from distutils.core import setup, Command
29
from distutils.extension import Extension
31
from unittest import TextTestRunner, TestLoader
33
from os.path import splitext, basename, join as pjoin, walk
36
#-----------------------------------------------------------------------------
38
#-----------------------------------------------------------------------------
40
class TestCommand(Command):
41
"""Custom distutils command to run the test suite."""
45
def initialize_options(self):
46
self._dir = os.getcwd()
48
def finalize_options(self):
52
"""Finds all the tests modules in zmq/tests/, and runs them."""
54
for t in glob(pjoin(self._dir, 'zmq', 'tests', '*.py')):
55
if not t.endswith('__init__.py'):
56
testfiles.append('.'.join(
57
['zmq.tests', splitext(basename(t))[0]])
59
tests = TestLoader().loadTestsFromNames(testfiles)
60
t = TextTestRunner(verbosity = 1)
64
class CleanCommand(Command):
65
"""Custom distutils command to clean the .so and .pyc files."""
69
def initialize_options(self):
70
self._clean_me = [pjoin('zmq', '_zmq.so') ]
71
for root, dirs, files in os.walk('.'):
73
if f.endswith('.pyc'):
74
self._clean_me.append(pjoin(root, f))
76
def finalize_options(self):
80
for clean_me in self._clean_me:
86
#-----------------------------------------------------------------------------
88
#-----------------------------------------------------------------------------
90
cmdclass = {'test':TestCommand, 'clean':CleanCommand }
93
from Cython.Distutils import build_ext
95
zmq_source = os.path.join('zmq','_zmq.c')
97
zmq_source = os.path.join('zmq','_zmq.pyx')
98
cmdclass['build_ext'] = build_ext
100
if sys.platform == 'win32':
107
sources = [zmq_source],
111
#-----------------------------------------------------------------------------
113
#-----------------------------------------------------------------------------
118
packages = ['zmq', 'zmq.tests', 'zmq.eventloop'],
120
author = "Brian E. Granger",
121
author_email = "ellisonbg@gmail.com",
122
description = "Cython based Python bindings for 0MQ.",