diff --git a/.gitignore b/.gitignore
index 26b3ad6..66c37b9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,6 @@
/pyzmq-0.1.20100725git18f5d06.tar.xz
+/pyzmq-2.0.8.tar.gz
+/pyzmq-2.0.10.tar.gz
+/pyzmq-2.0.10.1.tar.gz
+/pyzmq-2.1.1.tar.gz
+/pyzmq-2.1.4.tar.gz
diff --git a/buildutils.py b/buildutils.py
new file mode 100644
index 0000000..83c18a6
--- /dev/null
+++ b/buildutils.py
@@ -0,0 +1,268 @@
+"""Detect zmq version"""
+#
+# Copyright (c) 2011 Min Ragan-Kelley
+#
+# This file is part of pyzmq, copied and adapted from h5py.
+# h5py source used under the New BSD license
+#
+# h5py:
+# BSD license:
+#
+# pyzmq is free software; you can redistribute it and/or modify it under
+# the terms of the Lesser GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# pyzmq is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# Lesser GNU General Public License for more details.
+#
+# You should have received a copy of the Lesser GNU General Public License
+# along with this program. If not, see .
+
+import shutil
+import sys
+import os
+import logging
+import pickle
+from distutils import ccompiler
+from subprocess import Popen, PIPE
+
+try:
+ from configparser import ConfigParser
+except:
+ from ConfigParser import ConfigParser
+
+pjoin = os.path.join
+
+#-----------------------------------------------------------------------------
+# Logging (adapted from h5py: http://h5py.googlecode.com)
+#-----------------------------------------------------------------------------
+logger = logging.getLogger()
+logger.addHandler(logging.StreamHandler(sys.stderr))
+
+def debug(what):
+ pass
+
+def fatal(instring, code=1):
+ logger.error("Fatal: "+instring)
+ exit(code)
+
+def warn(instring):
+ logger.error("Warning: "+instring)
+
+
+#-----------------------------------------------------------------------------
+# Utility functions (adapted from h5py: http://h5py.googlecode.com)
+#-----------------------------------------------------------------------------
+
+def detect_zmq(basedir, **compiler_attrs):
+ """Compile, link & execute a test program, in empty directory `basedir`.
+
+ The C compiler will be updated with any keywords given via setattr.
+
+ Parameters
+ ----------
+
+ basedir : path
+ The location where the test program will be compiled and run
+ **compiler_attrs : dict
+ Any extra compiler attributes, which will be set via ``setattr(cc)``.
+
+ Returns
+ -------
+
+ A dict of properties for zmq compilation, with the following two keys:
+
+ vers : tuple
+ The ZMQ version as a tuple of ints, e.g. (2,2,0)
+ options : dict
+ The compiler options used to compile the test function, e.g. `include_dirs`,
+ `library_dirs`, `libs`, etc.
+ """
+
+ cc = ccompiler.new_compiler()
+ for name, val in compiler_attrs.items():
+ setattr(cc, name, val)
+
+ cfile = pjoin(basedir, 'vers.c')
+ efile = pjoin(basedir, 'vers')
+
+ f = open(cfile, 'w')
+ try:
+ f.write(
+r"""
+#include
+#include "zmq.h"
+
+int main(){
+ unsigned int major, minor, patch;
+ zmq_version(&major, &minor, &patch);
+ fprintf(stdout, "vers: %d.%d.%d\n", major, minor, patch);
+ return 0;
+}
+""")
+ finally:
+ f.close()
+
+ if sys.platform == 'darwin':
+ # allow for missing UB arch, since it will still work:
+ preargs = ['-undefined', 'dynamic_lookup']
+ else:
+ preargs = None
+
+ objs = cc.compile([cfile])
+ cc.link_executable(objs, efile, extra_preargs=preargs)
+
+ result = Popen(efile, stdout=PIPE, stderr=PIPE)
+ so, se = result.communicate()
+ # for py3k:
+ so = so.decode()
+ se = se.decode()
+ if result.returncode:
+ msg = "Error running version detection script:\n%s\n%s" % (so,se)
+ logging.error(msg)
+ raise IOError(msg)
+
+ handlers = {'vers': lambda val: tuple(int(v) for v in val.split('.'))}
+
+ props = {}
+ for line in (x for x in so.split('\n') if x):
+ key, val = line.split(':')
+ props[key] = handlers[key](val)
+
+ props['options'] = compiler_attrs
+ return props
+
+def localpath(*args):
+ plist = [os.path.dirname(__file__)]+list(args)
+ return os.path.abspath(pjoin(*plist))
+
+def loadpickle(name):
+ """ Load object from pickle file, or None if it can't be opened """
+ name = pjoin('conf', name)
+ try:
+ f = open(name,'rb')
+ except IOError:
+ # raise
+ return None
+ try:
+ return pickle.load(f)
+ except Exception:
+ # raise
+ return None
+ finally:
+ f.close()
+
+def savepickle(name, data):
+ """ Save to pickle file, exiting if it can't be written """
+ if not os.path.exists('conf'):
+ os.mkdir('conf')
+ name = pjoin('conf', name)
+ try:
+ f = open(name, 'wb')
+ except IOError:
+ fatal("Can't open pickle file \"%s\" for writing" % name)
+ try:
+ pickle.dump(data, f, 0)
+ finally:
+ f.close()
+
+def v_str(v_tuple):
+ """turn (2,0,1) into '2.0.1'."""
+ return ".".join(str(x) for x in v_tuple)
+
+def get_eargs():
+ """ Look for options in environment vars """
+
+ settings = {}
+
+ zmq = os.environ.get("ZMQ_DIR", '')
+ if zmq != '':
+ debug("Found environ var ZMQ_DIR=%s" % zmq)
+ settings['zmq'] = zmq
+
+ return settings
+
+def get_cfg_args():
+ """ Look for options in setup.cfg """
+
+ settings = {}
+ zmq = ''
+ if not os.path.exists('setup.cfg'):
+ return settings
+ cfg = ConfigParser()
+ cfg.read('setup.cfg')
+ if 'build_ext' in cfg.sections() and \
+ cfg.has_option('build_ext', 'include_dirs'):
+ includes = cfg.get('build_ext', 'include_dirs')
+ include = includes.split(os.pathsep)[0]
+ if include.endswith('include') and os.path.isdir(include):
+ zmq = include[:-8]
+ if zmq != '':
+ debug("Found ZMQ=%s in setup.cfg" % zmq)
+ settings['zmq'] = zmq
+
+ return settings
+
+def get_cargs():
+ """ Look for global options in the command line """
+ settings = loadpickle('buildconf.pickle')
+ if settings is None: settings = {}
+ for arg in sys.argv[:]:
+ if arg.find('--zmq=') == 0:
+ zmq = arg.split('=')[-1]
+ if zmq.lower() == 'default':
+ settings.pop('zmq', None)
+ else:
+ settings['zmq'] = zmq
+ sys.argv.remove(arg)
+ savepickle('buildconf.pickle', settings)
+ return settings
+
+def discover_settings():
+ """ Discover custom settings for ZMQ path"""
+ settings = get_cfg_args() # lowest priority
+ settings.update(get_eargs())
+ settings.update(get_cargs()) # highest priority
+ return settings.get('zmq')
+
+def copy_and_patch_libzmq(ZMQ, libzmq):
+ """copy libzmq into source dir, and patch it if necessary.
+
+ This command is necessary prior to running a bdist on Linux or OS X.
+ """
+ if sys.platform.startswith('win'):
+ return
+ # copy libzmq into zmq for bdist
+ local = localpath('zmq',libzmq)
+ if ZMQ is None and not os.path.exists(local):
+ fatal("Please specify zmq prefix via `setup.py configure --zmq=/path/to/zmq` "
+ "or copy libzmq into zmq/ manually prior to running bdist.")
+ try:
+ lib = pjoin(ZMQ, 'lib', libzmq)
+ print ("copying %s -> %s"%(lib, local))
+ shutil.copy(lib, local)
+ except Exception:
+ if not os.path.exists(local):
+ fatal("Could not copy libzmq into zmq/, which is necessary for bdist. "
+ "Please specify zmq prefix via `setup.py configure --zmq=/path/to/zmq` "
+ "or copy libzmq into zmq/ manually.")
+ finally:
+ # link libzmq.dylib -> libzmq.1.dylib
+ link = localpath('zmq',libzmq.replace('.1',''))
+ if not os.path.exists(link):
+ os.symlink(libzmq, link)
+
+ if sys.platform == 'darwin':
+ # patch install_name on darwin, instead of using rpath
+ cmd = ['install_name_tool', '-id', '@loader_path/../%s'%libzmq, local]
+ try:
+ p = Popen(cmd, stdout=PIPE,stderr=PIPE)
+ except OSError:
+ fatal("install_name_tool not found, cannot patch libzmq for bundling.")
+ out,err = p.communicate()
+ if p.returncode:
+ fatal("Could not patch bundled libzmq install_name: %s"%err, p.returncode)
+
diff --git a/python-zmq.spec b/python-zmq.spec
index f13ab3c..16bc7d8 100644
--- a/python-zmq.spec
+++ b/python-zmq.spec
@@ -3,16 +3,20 @@
%endif
-%global _use_internal_dependency_generator 0
-%global __find_provides %{_rpmconfigdir}/find-provides | grep -v _zmq.so
+%{?filter_setup:
+%filter_provides_in %{python_sitearch}/.*\.so$
+%filter_setup
+}
%global checkout 18f5d061558a176f5496aa8e049182c1a7da64f6
%global srcname pyzmq
+%global run_tests 1
+
Name: python-zmq
-Version: 0.1.20100725git18f5d06
-Release: 3%{?dist}
+Version: 2.1.4
+Release: 1%{?dist}
Summary: Software library for fast, message-based applications
Group: Development/Libraries
@@ -23,8 +27,9 @@ URL: http://www.zeromq.org/bindings:python
# git clone http://github.com/zeromq/pyzmq.git pyzmq.git
# cd pyzmq.git
# git archive --format=tar --prefix=pyzmq-%%{version}/ %%{checkout} | xz -z --force - > pyzmq-%%{version}.tar.xz
-Source0: %{srcname}-%{version}.tar.xz
-Patch0: python-zmq-os-walk.patch
+Source0: http://cloud.github.com/downloads/zeromq/pyzmq/pyzmq-%{version}.tar.gz
+# upstream forgot to add this file into the tarball, fetched from current git
+Source1: buildutils.py
BuildRequires: python2-devel
BuildRequires: python-setuptools
@@ -70,7 +75,6 @@ This package contains the python bindings.
%prep
%setup -q -n %{srcname}-%{version}
-%patch0 -p1
# remove shebangs
for lib in zmq/eventloop/*.py; do
sed '/\/usr\/bin\/env/d' $lib > $lib.new &&
@@ -79,17 +83,20 @@ for lib in zmq/eventloop/*.py; do
done
# remove excecutable bits
-chmod -x examples/kernel/frontend.py
chmod -x examples/pubsub/topics_pub.py
-chmod -x examples/kernel/kernel.py
chmod -x examples/pubsub/topics_sub.py
+# delete hidden files
+#find examples -name '.*' | xargs rm -v
+
+cp %{_sourcedir}/buildutils.py .
+
+
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
rm -r %{py3dir}/examples
-2to3 --write --nobackups %{py3dir}
%endif
@@ -98,7 +105,7 @@ CFLAGS="%{optflags}" %{__python} setupegg.py build
%if 0%{?with_python3}
pushd %{py3dir}
-CFLAGS="%{optflags}" %{__python3} setupegg.py build
+CFLAGS="%{optflags}" %{__python3} setup.py build
popd
%endif # with_python3
@@ -110,7 +117,7 @@ popd
# to be the default for now).
%if 0%{?with_python3}
pushd %{py3dir}
-%{__python3} setupegg.py install --skip-build --root $RPM_BUILD_ROOT
+%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
# remove tests doesn't work here, do that after running the tests
@@ -125,21 +132,21 @@ popd
%check
-rm zmq/__*
-pushd zmq
-PYTHONPATH=%{buildroot}%{python_sitearch} nosetests
-popd
-rm -r %{buildroot}%{python_sitearch}/zmq/tests
+%if 0%{?run_tests}
+ rm zmq/__*
+ PYTHONPATH=%{buildroot}%{python_sitearch} \
+ %{__python} setup.py test
+ rm -r %{buildroot}%{python_sitearch}/zmq/tests
-%if 0%{?with_python3}
-# there is no python3-nose yet
-pushd %{py3dir}
+ %if 0%{?with_python3}
+ # there is no python3-nose yet
+ pushd %{py3dir}
rm zmq/__*
- pushd zmq
- #PYTHONPATH=%{buildroot}%{python3_sitearch} nosetests
- popd
+ #PYTHONPATH=%{buildroot}%{python3_sitearch} \
+ # %{__python3} setup.py test
rm -r %{buildroot}%{python3_sitearch}/zmq/tests
-popd
+ popd
+ %endif
%endif
@@ -161,6 +168,24 @@ popd
%changelog
+* Wed Apr 6 2011 Thomas Spura - 2.1.4-1
+- update to new version (#690199)
+
+* Wed Mar 23 2011 Thomas Spura - 2.1.1-1
+- update to new version (#682201)
+
+* Wed Feb 09 2011 Fedora Release Engineering - 2.0.10.1-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
+
+* Sun Jan 30 2011 Thomas Spura - 2.0.10.1-1
+- update to new version (fixes memory leak)
+- no need to run 2to3 on python3 subpackage
+
+* Thu Jan 13 2011 Thomas Spura - 2.0.10-1
+- update to new version
+- remove patch (is upstream)
+- run tests differently
+
* Thu Aug 5 2010 Thomas Spura - 0.1.20100725git18f5d06-3
- add missing BR for 2to3
diff --git a/sources b/sources
index 652a3fa..6a9fa0f 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-c9fd5482f4103735747ecf2aa6c6ab0e pyzmq-0.1.20100725git18f5d06.tar.xz
+c43876c1726ea2f2c4e4b0bbb090951a pyzmq-2.1.4.tar.gz