Esempio n. 1
0
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(CONFIG['zmq_prefix'])
    
    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
        
        save_config('buildconf', cfg)
    
    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
Esempio n. 2
0
    def init_settings_from_config(self):
        """set up compiler settings, based on config"""
        cfg = self.config

        if cfg['libzmq_extension']:
            settings = bundled_settings(self.debug)
        else:
            settings = settings_from_prefix(cfg['zmq_prefix'],
                                            self.bundle_libzmq_dylib)

        if 'have_sys_un_h' not in cfg:
            # don't link against anything when checking for sys/un.h
            minus_zmq = copy.deepcopy(settings)
            try:
                minus_zmq['libraries'] = []
            except Exception:
                pass
            try:
                compile_and_run(self.tempdir,
                                pjoin('buildutils', 'check_sys_un.c'),
                                **minus_zmq)
            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

            self.save_config('config', cfg)

        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',
                pjoin('backend', 'cython'),
                'devices',
            )
        ]
        if sys.platform.startswith('win') and sys.version_info < (3, 3):
            settings['include_dirs'].insert(
                0, pjoin('buildutils', 'include_win32'))

        for ext in self.distribution.ext_modules:
            if ext.name.startswith('zmq.lib'):
                continue
            for attr, value in settings.items():
                setattr(ext, attr, value)

        self.compiler_settings = settings
        self.save_config('compiler', settings)
Esempio n. 3
0
File: setup.py Progetto: fwph/pyzmq
 def init_settings_from_config(self):
     """set up compiler settings, based on config"""
     cfg = self.config
     
     if cfg['libzmq_extension']:
         settings = bundled_settings(self.debug)
     else:
         settings = settings_from_prefix(cfg['zmq_prefix'], self.bundle_libzmq_dylib)
 
     if 'have_sys_un_h' not in cfg:
         # don't link against anything when checking for sys/un.h
         minus_zmq = copy.deepcopy(settings)
         try:
             minus_zmq['libraries'] = []
         except Exception:
             pass
         try:
             compile_and_run(self.tempdir,
                 pjoin('buildutils', 'check_sys_un.c'),
                 **minus_zmq
             )
         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
     
         self.save_config('config', cfg)
 
     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',
         pjoin('backend', 'cython'),
         'devices',
     )]
     if sys.platform.startswith('win') and sys.version_info < (3, 3):
         settings['include_dirs'].insert(0, pjoin('buildutils', 'include_win32'))
     
     for ext in self.distribution.ext_modules:
         if ext.name.startswith('zmq.lib'):
             continue
         for attr, value in settings.items():
             setattr(ext, attr, value)
     
     self.compiler_settings = settings
     self.save_config('compiler', settings)
Esempio n. 4
0
    def init_settings_from_config(self):
        """set up compiler settings, based on config"""
        if "PyPy" in sys.version:
            self.compiler_settings = {}
        cfg = self.config

        if cfg["libzmq_extension"]:
            settings = bundled_settings()
        else:
            settings = settings_from_prefix(cfg["zmq_prefix"], self.bundle_libzmq_dylib)

        if "have_sys_un_h" not in cfg:
            # don't link against anything when checking for sys/un.h
            minus_zmq = copy.deepcopy(settings)
            try:
                minus_zmq["libraries"] = []
            except Exception:
                pass
            try:
                compile_and_run(self.tempdir, pjoin("buildutils", "check_sys_un.c"), **minus_zmq)
            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

            self.save_config("config", cfg)

        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", pjoin("backend", "cython"), "devices")]

        for ext in self.distribution.ext_modules:
            if ext.name == "zmq.libzmq":
                continue
            for attr, value in settings.items():
                setattr(ext, attr, value)

        self.compiler_settings = settings
        self.save_config("compiler", settings)
Esempio n. 5
0
 def init_settings_from_config(self):
     """set up compiler settings, based on config"""
     if 'PyPy' in sys.version:
         self.compiler_settings = {}
     cfg = self.config
     
     if cfg['libzmq_extension']:
         settings = bundled_settings()
     else:
         settings = settings_from_prefix(cfg['zmq_prefix'], self.bundle_libzmq_dylib)
 
     if 'have_sys_un_h' not in cfg:
         try:
             compile_and_run(self.tempdir,
                 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
     
         self.save_config('config', cfg)
 
     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')]
     
     for ext in self.distribution.ext_modules:
         if ext.name == 'zmq.libzmq':
             continue
         for attr, value in settings.items():
             setattr(ext, attr, value)
     
     self.compiler_settings = settings
     self.save_config('compiler', settings)