Skip to content

Commit

Permalink
Merge pull request #17 from claws/add_czmq_version_checking
Browse files Browse the repository at this point in the history
Add CZMQ version check to installer
  • Loading branch information
michelp committed Dec 18, 2013
2 parents 7e4a5dd + 3547abd commit 30d6f21
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions pyczmq/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from . import (
zmq,
zsys,
zctx,
zsocket,
zstr,
Expand Down
18 changes: 18 additions & 0 deletions pyczmq/zsys.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from pyczmq._cffi import C, ffi, cdef

__doc__ = """
The zsys class provides miscellaneous functions. Only a limited set of
functions are exposed from the czmq zsys module as many duplicate
functionality of built-in python types or libraries.
"""

@cdef('void zsys_version (int *major, int *minor, int *patch);')
def zsys_version():
"""
Returns the tuple (major, minor, patch) of the current czmq version.
"""
major = ffi.new('int*')
minor= ffi.new('int*')
patch = ffi.new('int*')
C.zsys_version(major, minor, patch)
return (major[0], minor[0], patch[0])
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
======
"""
from pyczmq.zmq import version as zmq_version
from pyczmq.zsys import zsys_version as czmq_version
from setuptools import setup, find_packages
import sys


if zmq_version() < (4,0,0):
print "ERROR: pyczmq requires libzmq 4.0.0 or later."
if zmq_version() < (4,0,0) or czmq_version() < (2, 1, 0):
print "ERROR: pyczmq requires libzmq 4.0.0 or later and libczmq 2.1.0 or later"
sys.exit(1)


Expand Down

0 comments on commit 30d6f21

Please sign in to comment.