Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

progress towards more sensible config

- [x] shouldn't suppress warnings where it won't work
- [x] manual overrides for a few things
- [x] allow skipping libzmq version check
- [x] cross compilation should work
- [x] it shouldn't clean in the middle anymore, messing up bdists
  • Loading branch information...
commit 1b29b0f0da946bd1b2547da07bdcab3c07490954 1 parent ba4d372
@minrk minrk authored
View
2  buildutils/bundle.py
@@ -186,7 +186,7 @@ def copy_and_patch_libzmq(ZMQ, libzmq):
return
# copy libzmq into zmq for bdist
local = localpath('zmq',libzmq)
- if ZMQ is None and not os.path.exists(local):
+ if not ZMQ 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:
View
7 buildutils/check_sys_un.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+#include "sys/un.h"
+
+int main(int argc, char **argv) {
+ struct sockaddr_un *dummy;
+ printf("%lu\n", sizeof(dummy->sun_path) - 1);
+}
View
128 buildutils/config.py
@@ -30,15 +30,15 @@
def load_config(name):
"""Load config dict from JSON"""
- fname = pjoin('conf', name+'.json')
+ fname = pjoin('conf', name + '.json')
if not os.path.exists(fname):
- return None
+ return {}
try:
with open(fname) as f:
cfg = json.load(f)
except Exception as e:
warn("Couldn't load %s: %s" % (fname, e))
- cfg = None
+ cfg = {}
return cfg
@@ -60,73 +60,101 @@ def get_eargs():
settings = {}
- zmq = os.environ.get("ZMQ_DIR", '')
- if zmq != '':
- debug("Found environ var ZMQ_DIR=%s" % zmq)
- settings['zmq'] = zmq
+ zmq = os.environ.get("ZMQ_PREFIX", None)
+ if zmq is not None:
+ debug("Found environ var ZMQ_PREFIX=%s" % zmq)
+ settings['zmq_prefix'] = zmq
return settings
+def cfg2dict(cfg):
+ """turn a ConfigParser into a nested dict
+
+ because ConfigParser objects are dumb.
+ """
+ d = {}
+ for section in cfg.sections():
+ d[section] = dict(cfg.items(section))
+ return d
+
def get_cfg_args():
""" Look for options in setup.cfg """
- settings = {}
- zmq = ''
if not os.path.exists('setup.cfg'):
- return settings
+ return {}
cfg = ConfigParser()
cfg.read('setup.cfg')
-
- #fetch pathsep separated 'include_dirs', 'library_dirs', 'libraries' from setup.cfg build_ext
- if 'build_ext' in cfg.sections():
- for element in ['include_dirs', 'library_dirs', 'libraries']:
- if cfg.has_option('build_ext', element):
- value = cfg.get('build_ext', element)
- if len(value):
- settings[element] = value.split(os.pathsep)
-
- #detect zmq
- if settings.has_key('include_dirs') and settings['include_dirs'][0]\
- and os.path.isdir(settings['include_dirs'][0])\
- and settings['include_dirs'][0].endswith('include'):
- zmq = settings['include_dirs'][0][:-8]
-
- if zmq != '':
- debug("Found ZMQ=%s in setup.cfg" % zmq)
- settings['zmq'] = zmq
- try:
- settings['library_dirs'].remove(zmq+'/lib')
- except:
- warn("It seems first include_dirs but not first library_dirs. Linking -L is probably wong.")
-
- #fetch values 'plat-name', 'zmq-version' from setup.cfg global
- if 'global' in cfg.sections():
- for element in ['plat-name', 'zmq-version']:
- if cfg.has_option('global', element):
- value = cfg.get('global', element)
- if len(value):
- settings[element] = value
-
- return settings
+ cfg = cfg2dict(cfg)
+
+ g = cfg.setdefault('global', {})
+ # boolean keys:
+ for key in ['libzmq_extension',
+ 'bundle_libzmq_dylib',
+ 'no_libzmq_extension',
+ 'have_sys_un_h',
+ 'skip_check_zmq',
+ ]:
+ if key in g:
+ g[key] = eval(g[key])
+
+ # globals go to top level
+ cfg.update(cfg.pop('global'))
+ return cfg
def get_cargs():
""" Look for global options in the command line """
settings = load_config('buildconf')
- if settings is None: settings = {}
for arg in sys.argv[:]:
if arg.find('--zmq=') == 0:
- zmq = arg.split('=')[-1]
- if zmq.lower() in ('default', 'auto', ''):
- settings.pop('zmq', None)
+ prefix = arg.split('=', 1)[-1]
+ if prefix.lower() in ('default', 'auto', ''):
+ settings['zmq_prefix'] = ''
+ settings['libzmq_extension'] = False
+ settings['no_libzmq_extension'] = False
+ elif prefix.lower() in ('bundled', 'extension'):
+ settings['zmq_prefix'] = ''
+ settings['libzmq_extension'] = True
+ settings['no_libzmq_extension'] = False
else:
- settings['zmq'] = zmq
+ settings['zmq_prefix'] = prefix
+ settings['libzmq_extension'] = False
+ settings['no_libzmq_extension'] = True
sys.argv.remove(arg)
save_config('buildconf', settings)
return settings
+def merge(into, d):
+ """merge two containers
+
+ into is updated, d has priority
+ """
+ if isinstance(into, dict):
+ for key in d.keys():
+ if key not in into:
+ into[key] = d[key]
+ else:
+ into[key] = merge(into[key], d[key])
+ return into
+ elif isinstance(into, list):
+ return into + d
+ else:
+ return d
+
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
+ settings = {
+ 'zmq_prefix': '',
+ 'libzmq_extension': False,
+ 'no_libzmq_extension': False,
+ 'skip_check_zmq': False,
+ 'build_ext': {},
+ 'bdist_egg': {},
+ }
+ if sys.platform.startswith('win'):
+ settings['have_sys_un_h'] = False
+
+ merge(settings, get_cfg_args()) # lowest priority
+ merge(settings, get_eargs())
+ merge(settings, get_cargs()) # highest priority
+
return settings
View
86 buildutils/detect.py
@@ -28,6 +28,58 @@
# Utility functions (adapted from h5py: http://h5py.googlecode.com)
#-----------------------------------------------------------------------------
+def test_compilation(cfile, compiler=None, **compiler_attrs):
+ """Test simple compilation with given settings"""
+ if compiler is None or isinstance(compiler, str):
+ cc = ccompiler.new_compiler(compiler=compiler)
+ customize_compiler(cc)
+ if cc.compiler_type == 'mingw32':
+ customize_mingw(cc)
+ else:
+ cc = compiler
+
+ for name, val in compiler_attrs.items():
+ setattr(cc, name, val)
+
+ efile, ext = os.path.splitext(cfile)
+
+ cpreargs = lpreargs = None
+ if sys.platform == 'darwin':
+ # use appropriate arch for compiler
+ if platform.architecture()[0]=='32bit':
+ if platform.processor() == 'powerpc':
+ cpu = 'ppc'
+ else:
+ cpu = 'i386'
+ cpreargs = ['-arch', cpu]
+ lpreargs = ['-arch', cpu, '-undefined', 'dynamic_lookup']
+ else:
+ # allow for missing UB arch, since it will still work:
+ lpreargs = ['-undefined', 'dynamic_lookup']
+ extra = compiler_attrs.get('extra_compile_args', None)
+
+ objs = cc.compile([cfile],extra_preargs=cpreargs, extra_postargs=extra)
+ cc.link_executable(objs, efile, extra_preargs=lpreargs)
+ return efile
+
+def compile_and_run(basedir, src, compiler=None, **compiler_attrs):
+ if not os.path.exists(basedir):
+ os.makedirs(basedir)
+ cfile = pjoin(basedir, os.path.basename(src))
+ shutil.copy(src, cfile)
+ try:
+ efile = test_compilation(cfile, compiler=compiler, **compiler_attrs)
+ result = Popen(efile, stdout=PIPE, stderr=PIPE)
+ so, se = result.communicate()
+ # for py3k:
+ so = so.decode()
+ se = se.decode()
+ finally:
+ shutil.rmtree(basedir)
+
+ return result.returncode, so, se
+
+
def detect_zmq(basedir, compiler=None, **compiler_attrs):
"""Compile, link & execute a test program, in empty directory `basedir`.
@@ -55,39 +107,11 @@ def detect_zmq(basedir, compiler=None, **compiler_attrs):
`library_dirs`, `libs`, etc.
"""
- if compiler is None or isinstance(compiler, str):
- cc = ccompiler.new_compiler(compiler=compiler)
- customize_compiler(cc)
- if cc.compiler_type == 'mingw32':
- customize_mingw(cc)
- else:
- cc = compiler
-
- for name, val in compiler_attrs.items():
- setattr(cc, name, val)
-
cfile = pjoin(basedir, 'vers.c')
- efile = pjoin(basedir, 'vers')
-
shutil.copy(pjoin(os.path.dirname(__file__), 'vers.c'), cfile)
-
- cpreargs = lpreargs = None
- if sys.platform == 'darwin':
- # use appropriate arch for compiler
- if platform.architecture()[0]=='32bit':
- if platform.processor() == 'powerpc':
- cpu = 'ppc'
- else:
- cpu = 'i386'
- cpreargs = ['-arch', cpu]
- lpreargs = ['-arch', cpu, '-undefined', 'dynamic_lookup']
- else:
- # allow for missing UB arch, since it will still work:
- lpreargs = ['-undefined', 'dynamic_lookup']
-
- objs = cc.compile([cfile],extra_preargs=cpreargs)
- cc.link_executable(objs, efile, extra_preargs=lpreargs)
-
+
+ efile = test_compilation(cfile, compiler=compiler, **compiler_attrs)
+
result = Popen(efile, stdout=PIPE, stderr=PIPE)
so, se = result.communicate()
# for py3k:
View
5 buildutils/dummy.c
@@ -0,0 +1,5 @@
+// empty file, just to test compilation
+
+int main(int argc, char **argv){
+ return 0;
+}
View
10 setup.cfg.template
@@ -1,6 +1,14 @@
+[global]
+# zmq_prefix = /usr/local # (adds zmq_prefix/include to include_dirs and zmq_prefix/lib to library_dirs)
+# have_sys_un_h = False # does sys/un.h exist? pyzmq will try to detect it, but you can override
+# ignore_common_warnings = True #
+# skip_check_zmq = True # skip checking zmq verson (if it doesn't work for some reason)
+# libzmq_path = /full/path/to/libzmq # only necessary if pyzmq can't find the libzmq dll from the prefix
+# libzmq_extension = True # force building libzmq as an extension (same as --zmq=bundled)
+# no_libzmq_extension = True # prevent fallback on building libzmq as an extension if regular build fails
[build_ext]
-# Edit these to point to your installed zeromq library and header dirs.
+# Edit these to add any paths you need to include (e.g. where libzmq is defined)
library_dirs = /usr/local/lib
include_dirs = /usr/local/include
View
238 setup.py
@@ -70,6 +70,7 @@
warn, fatal, debug, line, copy_and_patch_libzmq, localpath,
fetch_libzmq, stage_platform_hpp,
bundled_version, customize_mingw,
+ test_compilation, compile_and_run
)
#-----------------------------------------------------------------------------
@@ -105,26 +106,35 @@
#-----------------------------------------------------------------------------
-CONFIGURATION = discover_settings()
-TARGET = CONFIGURATION['plat-name'] if CONFIGURATION.has_key('plat-name') else sys.platform
-CROSSCOMPILE = TARGET != sys.platform
-ZMQ = CONFIGURATION['zmq'] if CONFIGURATION.has_key('zmq') else None
-ZMQVER = tuple(int(v) for v in CONFIGURATION['zmq-version'].split('.')) if CONFIGURATION.has_key('zmq-version') else None
+CONFIG = discover_settings()
+CROSSCOMPILE = CONFIG['bdist_egg'].get('plat-name', sys.platform) != sys.platform
-if ZMQ is not None and ZMQ != "bundled" and not os.path.exists(ZMQ):
- warn("ZMQ directory \"%s\" does not appear to exist" % ZMQ)
+if not CONFIG['libzmq_extension'] and \
+ CONFIG['zmq_prefix'] and \
+ not os.path.exists(CONFIG['zmq_prefix']):
+ warn("ZMQ prefix %r does not appear to exist" % CONFIG['zmq_prefix'])
# bundle_libzmq_dylib flag for whether external libzmq library will be included in pyzmq:
-if sys.platform.startswith('win') or CROSSCOMPILE:
+# only relevant when not building libzmq extension
+if 'bundle_libzmq_dylib' in CONFIG:
+ bundle_libzmq_dylib = CONFIG['bundle_libzmq_dylib']
+elif (sys.platform.startswith('win') or CROSSCOMPILE) and not CONFIG['libzmq_extension']:
+ # always bundle libzmq on Windows and cross-compilation
bundle_libzmq_dylib = True
-elif ZMQ is not None and ZMQ != "bundled":
+elif CONFIG['zmq_prefix'] and not CONFIG['libzmq_extension']:
+ # only bundle for bdists in sane environments
bundle_libzmq_dylib = doing_bdist
else:
bundle_libzmq_dylib = False
# --- compiler settings -------------------------------------------------
-def bundled_settings(settings):
+def bundled_settings():
+ settings = {}
+ settings['library_dirs'] = []
+ settings['libraries'] = []
+ settings['include_dirs'] = []
+ settings['runtime_library_dirs'] = []
settings['include_dirs'].append("bundled/zeromq/include")
# add pthread on freebsd
# is this necessary?
@@ -140,30 +150,39 @@ def bundled_settings(settings):
return settings
-def settings_from_prefix(settings,zmq=None):
+def settings_from_prefix(prefix=None):
"""load appropriate library/include settings from ZMQ prefix"""
-
+ settings = {}
+ settings['library_dirs'] = []
+ settings['libraries'] = []
+ settings['include_dirs'] = []
+ settings['runtime_library_dirs'] = []
if sys.platform.startswith('win'):
settings['libraries'].append('libzmq')
- if zmq is not None:
- settings['include_dirs'] += [pjoin(zmq, 'include')]
- settings['library_dirs'] += [pjoin(zmq, 'lib')]
+ if prefix:
+ settings['include_dirs'] += [pjoin(prefix, 'include')]
+ settings['library_dirs'] += [pjoin(prefix, 'lib')]
else:
settings['libraries'].append('zmq')
-
# add pthread on freebsd
if sys.platform.startswith('freebsd'):
settings['libraries'].append('pthread')
- if zmq is not None:
- settings['include_dirs'] += [pjoin(zmq, 'include')]
+ if prefix:
+ settings['include_dirs'] += [pjoin(prefix, 'include')]
if not bundle_libzmq_dylib:
- settings['library_dirs'] += [pjoin(zmq, 'lib')]
- elif sys.platform == 'darwin' and os.path.isdir('/opt/local/lib'):
- # allow macports default
- settings['include_dirs'] += ['/opt/local/include']
- settings['library_dirs'] += ['/opt/local/lib']
+ settings['library_dirs'] += [pjoin(prefix, 'lib')]
+ else:
+ if sys.platform == 'darwin' and os.path.isdir('/opt/local/lib'):
+ # allow macports default
+ settings['include_dirs'] += ['/opt/local/include']
+ settings['library_dirs'] += ['/opt/local/lib']
+ if os.environ.get('VIRTUAL_ENV', None):
+ # find libzmq installed in virtualenv
+ env = os.environ['VIRTUAL_ENV']
+ settings['include_dirs'] += pjoin(env, 'include')
+ settings['library_dirs'] += pjoin(env, 'lib')
if bundle_libzmq_dylib:
# bdist should link against bundled libzmq
@@ -173,43 +192,67 @@ def settings_from_prefix(settings,zmq=None):
# unused rpath args for OSX:
# settings['extra_link_args'] = ['-Wl,-rpath','-Wl,$ORIGIN/..']
else:
- settings['runtime_library_dirs'] = ['$ORIGIN/..']
+ settings['runtime_library_dirs'] += ['$ORIGIN/..']
elif sys.platform != 'darwin':
- settings['runtime_library_dirs'] = [os.path.abspath(x) for x in settings['library_dirs']]
-
+ settings['runtime_library_dirs'] += [
+ os.path.abspath(x) for x in settings['library_dirs']
+ ]
+
return settings
-def init_settings(zmq=None):
- settings = {}
- for key in ['libraries', 'include_dirs', 'library_dirs', 'define_macros', 'runtime_library_dirs']:
- settings[key] = CONFIGURATION[key] if CONFIGURATION.has_key(key) else []
- if zmq == 'bundled':
- settings = bundled_settings(settings)
+def init_settings(cfg):
+ if 'PyPy' in sys.version:
+ return {}
+ settings = cfg['build_ext']
+ if cfg['libzmq_extension']:
+ settings = bundled_settings()
else:
- settings = settings_from_prefix(settings,zmq)
-
- #Windows and Android not POSIX
- if not (TARGET.startswith('win') or TARGET.startswith('linux-armv')):
- settings['define_macros'].append(('PYZMQ_POSIX', 1))
+ settings = settings_from_prefix(CONFIG['zmq_prefix'])
- # suppress common warnings
-
- extra_flags = []
+ # suppress common warnings if the compiler allows it
if ignore_common_warnings:
+ extra_flags = []
for warning in ('unused-function', 'strict-aliasing'):
- extra_flags.append('-Wno-'+warning)
+ extra_flags.append('-Wno-%s' % warning)
+ tempdir = pjoin("build", "warntest")
+ try:
+ compile_and_run(tempdir,
+ pjoin('buildutils', 'dummy.c'),
+ extra_compile_args=extra_flags,
+ **settings
+ )
+ except Exception as e:
+ warn("Skipping common warning suppression: %s" % e)
+ else:
+ # skip warnings
+ settings['extra_compile_args'] = extra_flags
+
+
+ if 'have_sys_un_h' not in cfg:
+ try:
+ compile_and_run(pjoin("build", "sock_un"),
+ pjoin('buildutils', 'check_sys_un.c'),
+ **settings
+ )
+ except Exception as e:
+ warn("No sys/un.h, IPC_PATH_MAX_LEN will be undefined: %s" % e)
+ cfg['have_sys_un_h'] = False
+ else:
+ cfg['have_sys_un_h'] = True
- settings['extra_compile_args'] = extra_flags
+ if cfg['have_sys_un_h']:
+ settings['define_macros'] = [('HAVE_SYS_UN_H', 1)]
+
+ settings.setdefault('define_macros', [])
# include internal directories
+ settings.setdefault('include_dirs', [])
settings['include_dirs'] += [pjoin('zmq', sub) for sub in ('utils','core','devices')]
return settings
-
-COMPILER_SETTINGS = init_settings(ZMQ)
-
+COMPILER_SETTINGS = init_settings(CONFIG)
#-----------------------------------------------------------------------------
# Extra commands
@@ -227,7 +270,7 @@ class Configure(Command):
boolean_options = []
def initialize_options(self):
self.compiler = None
- self.zmq = ZMQ
+ self.config = None
self.settings = copy.copy(COMPILER_SETTINGS)
def finalize_options(self):
@@ -243,11 +286,12 @@ def create_tempdir(self):
if sys.platform.startswith('win'):
# fetch libzmq.dll into local dir
local_dll = pjoin(self.tempdir, 'libzmq.dll')
- if ZMQ is None and not os.path.exists(local_dll):
- fatal("ZMQ directory must be specified on Windows via setup.cfg or 'python setup.py configure --zmq=/path/to/zeromq2'")
+ if CONFIG['zmq_prefix'] and not os.path.exists(local_dll):
+ fatal("ZMQ directory must be specified on Windows via setup.cfg"
+ " or 'python setup.py configure --zmq=/path/to/zeromq2'")
try:
- shutil.copy(pjoin(ZMQ, 'lib', 'libzmq.dll'), local_dll)
+ shutil.copy(pjoin(CONFIG['zmq_prefix'], 'lib', 'libzmq.dll'), local_dll)
except Exception:
if not os.path.exists(local_dll):
warn("Could not copy libzmq into zmq/, which is usually necessary on Windows."
@@ -277,8 +321,10 @@ def compiler_type(self):
return compiler.compiler_type
def check_zmq_version(self):
- zmq = self.zmq
- if zmq is not None and zmq != "bundled" and not os.path.isdir(zmq):
+
+ zmq = CONFIG['zmq_prefix']
+ if zmq and not os.path.exists(zmq) and \
+ not CONFIG['libzmq_extension']:
fatal("Custom zmq directory \"%s\" does not exist" % zmq)
config = self.getcached()
@@ -288,10 +334,12 @@ def check_zmq_version(self):
else:
self.config = config
line()
-
- if self.zmq == "bundled":
+
+ if CONFIG['libzmq_extension'] or CONFIG['skip_check_zmq'] or CROSSCOMPILE:
return
+ # now check the libzmq version
+
vers = tuple(config['vers'])
vs = v_str(vers)
if vers < min_zmq:
@@ -312,7 +360,7 @@ def check_zmq_version(self):
if sys.platform.startswith('win'):
# fetch libzmq.dll into local dir
local_dll = localpath('zmq','libzmq.dll')
- if zmq is None and not os.path.exists(local_dll):
+ if not zmq and not os.path.exists(local_dll):
fatal("ZMQ directory must be specified on Windows via setup.cfg or 'python setup.py configure --zmq=/path/to/zeromq2'")
try:
shutil.copy(pjoin(zmq, 'lib', 'libzmq.dll'), local_dll)
@@ -379,13 +427,14 @@ def bundle_libzmq_extension(self):
self.distribution.ext_modules.insert(0, ext)
# update other extensions, with bundled settings
- settings = init_settings("bundled")
+ CONFIG['libzmq_extension'] = True
+ settings = init_settings(CONFIG)
for ext in self.distribution.ext_modules[1:]:
for attr, value in settings.items():
setattr(ext, attr, value)
- save_config("buildconf", dict(zmq="bundled"))
+ save_config("buildconf", dict(libzmq_extension=True))
return dict(vers=bundled_version, settings=settings)
@@ -440,7 +489,7 @@ def fallback_on_bundled(self):
return self.bundle_libzmq_extension()
- def test_build(self, zmq, settings):
+ def test_build(self, prefix, settings):
self.create_tempdir()
if bundle_libzmq_dylib and not sys.platform.startswith('win'):
# rpath slightly differently here, because libzmq not in .. but ../zmq:
@@ -454,7 +503,7 @@ def test_build(self, zmq, settings):
line()
print ("Configure: Autodetecting ZMQ settings...")
- print (" Custom ZMQ dir: %s" % zmq)
+ print (" Custom ZMQ dir: %s" % prefix)
try:
config = detect_zmq(self.tempdir, compiler=self.compiler_type, **settings)
finally:
@@ -465,42 +514,44 @@ def test_build(self, zmq, settings):
return config
def run(self):
- if self.zmq == "bundled":
+ if CONFIG['libzmq_extension']:
self.config = self.bundle_libzmq_extension()
+ save_config('configure', self.config)
line()
return
- config = None
-
# When cross-compiling and zmq is given explicitly, we can't testbuild
- # (as we can't testrun the binary), we assume things are allright.
- if CROSSCOMPILE:
- self.config = dict(vers=ZMQVER)
+ # (as we can't testrun the binary), we assume things are alright.
+ if CONFIG['skip_check_zmq'] or CROSSCOMPILE:
+ warn("Skipping zmq version check")
return
+ config = None
+ zmq_prefix = CONFIG['zmq_prefix']
# There is no available default on Windows, so start with fallback unless
- # zmq was given explicitly.
- if self.zmq is None and sys.platform.startswith("win"):
+ # zmq was given explicitly, or libzmq extension was explicitly prohibited.
+ if sys.platform.startswith("win") and \
+ not CONFIG['no_libzmq_extension'] and \
+ not zmq_prefix:
config = self.fallback_on_bundled()
- self.zmq = "bundled"
if config is None:
# first try with given config or defaults
try:
- config = self.test_build(self.zmq, self.settings)
+ config = self.test_build(zmq_prefix, self.settings)
except Exception:
etype, evalue, tb = sys.exc_info()
# print the error as distutils would if we let it raise:
print ("\nerror: %s\n" % evalue)
# try fallback on /usr/local on *ix
- if config is None and self.zmq is None and not sys.platform.startswith('win'):
+ if config is None and not zmq_prefix and not sys.platform.startswith('win'):
print ("Failed with default libzmq, trying again with /usr/local")
time.sleep(1)
- zmq = '/usr/local'
- settings = init_settings(zmq)
+ zmq_prefix = CONFIG['zmq_prefix'] = '/usr/local'
+ settings = init_settings(CONFIG)
try:
- config = self.test_build(zmq, settings)
+ config = self.test_build(zmq_prefix, settings)
except Exception:
etype, evalue, tb = sys.exc_info()
# print the error as distutils would if we let it raise:
@@ -508,15 +559,18 @@ def run(self):
else:
# if we get here the second run succeeded, so we need to update compiler
# settings for the extensions with /usr/local prefix
- self.zmq = zmq
for ext in self.distribution.ext_modules:
for attr,value in settings.items():
setattr(ext, attr, value)
# finally, fallback on bundled
- if config is None and self.zmq is None:
+ if config is None and CONFIG['no_libzmq_extension']:
+ fatal("Falling back on bundled libzmq,"
+ " but setup.cfg has explicitly prohibited building the libzmq extension."
+ )
+
+ if config is None:
config = self.fallback_on_bundled()
- self.zmq = "bundled"
save_config('configure', config)
self.config = config
@@ -857,16 +911,7 @@ def extract_version():
while not line.startswith("__version__"):
line = f.readline()
exec(line, globals())
- if 'bdist_msi' in sys.argv:
- # msi has strict version requirements, which requires that
- # we strip any dev suffix, and have at most two dots
- vlist = re.findall(r'\d+', __version__)
- vs = '.'.join(vlist[:3])
- if len(vlist) > 3:
- vs = '-'.join([vs] + vlist[3:])
- return vs
- else:
- return __version__
+ return __version__
def find_packages():
"""adapted from IPython's setupbase.find_packages()"""
@@ -889,16 +934,7 @@ def find_packages():
library ZeroMQ (http://www.zeromq.org).
"""
-if 'PyPy' in sys.version:
- install_requires = [
- 'py',
- 'ctypes-configure',
- 'cffi',
- ]
-else:
- install_requires = None
-
-setup(
+setup_args = dict(
name = "pyzmq",
version = extract_version(),
packages = find_packages(),
@@ -907,12 +943,10 @@ def find_packages():
author = "Brian E. Granger, Min Ragan-Kelley",
author_email = "zeromq-dev@lists.zeromq.org",
url = 'http://github.com/zeromq/pyzmq',
- download_url = 'http://github.com/zeromq/pyzmq/downloads',
description = "Python bindings for 0MQ.",
long_description = long_desc,
license = "LGPL+BSD",
cmdclass = cmdclass,
- install_requires = install_requires,
classifiers = [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
@@ -931,6 +965,14 @@ def find_packages():
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
- ]
+ ],
)
+if 'setuptools' in sys.modules and 'PyPy' in sys.version:
+ setup_args['install_requires'] = [
+ 'py',
+ 'ctypes-configure',
+ 'cffi',
+ ]
+
+setup(**setup_args)
View
2  zmq/utils/ipcmaxlen.h
@@ -8,7 +8,7 @@ Distributed under the terms of the New BSD License. The full license is in
the file COPYING.BSD, distributed as part of this software.
*/
-#if defined(PYZMQ_POSIX)
+#if defined(HAS_SYS_UN_H)
#include "sys/un.h"
int get_ipc_path_max_len(void) {
struct sockaddr_un *dummy;
Please sign in to comment.
Something went wrong with that request. Please try again.