def _pkgconfig_check(self, test): # Hack to by pass pkgconfig checks when just wanting to download the # source. if self.macros['_dry_run'] == '1' and self.macros['with_download'] == '1': return '0' ok = False if type(test) == str: test = test.split() if not self._cross_compile() or self.pkgconfig_crosscompile: try: pkg = pkgconfig.package(test[0], prefix = self.pkgconfig_prefix, output = self._output, src = log.trace) if len(test) != 1 and len(test) != 3: self._error('malformed check: %s' % (' '.join(test))) else: op = '>=' ver = '0' if len(test) == 3: op = test[1] ver = self.macros.expand(test[2]) ok = pkg.check(op, ver) except pkgconfig.error as pe: self._error('pkgconfig: check: %s' % (pe)) except: raise error.internal('pkgconfig failure') if ok: return '1' return '0'
def _pkgconfig_check(self, test): # Hack to by pass pkgconfig checks when just wanting to download the # source. if self.macros['_dry_run'] == '1' and self.macros[ 'with_download'] == '1': return '0' ok = False if type(test) == str: test = test.split() if not self._cross_compile() or self.pkgconfig_crosscompile: try: pkg = pkgconfig.package(test[0], prefix=self.pkgconfig_prefix, output=self._output, src=log.trace) if len(test) != 1 and len(test) != 3: self._error('malformed check: %s' % (' '.join(test))) else: op = '>=' ver = '0' if len(test) == 3: op = test[1] ver = self.macros.expand(test[2]) ok = pkg.check(op, ver) except pkgconfig.error as pe: self._error('pkgconfig: check: %s' % (pe)) except: raise error.internal('pkgconfig failure') if ok: return '1' return '0'
def _pkgconfig_flags(self, package, flags): pkg_flags = None if not self._cross_compile(): pkg = pkgconfig.package(package, output = log.output) try: pkg_flags = pkg.get(flags) except pkgconfig.error, pe: self._error('flags:%s: %s' % (flags, pe)) except:
def _pkgconfig_flags(self, package, flags): pkg_flags = None if not self._cross_compile() or self.pkgconfig_crosscompile: try: pkg = pkgconfig.package(package, prefix=self.pkgconfig_prefix, output=self._output, src=log.trace) pkg_flags = pkg.get(flags) if pkg_flags and self.pkgconfig_filter_flags: fflags = [] for f in pkg_flags.split(): if not f.startswith("-f") and not f.startswith("-W"): fflags += [f] pkg_flags = " ".join(fflags) log.trace("pkgconfig: %s: %s" % (flags, pkg_flags)) except pkgconfig.error, pe: self._error("pkgconfig: %s: %s" % (flags, pe)) except:
def _load_flags(conf, arch_bsp, path): if not os.path.exists(path): ctx.fatal('RTEMS path not found.') if os.path.exists(_pkgconfig_path(path)): pc = os.path.join(_pkgconfig_path(path), arch_bsp + '.pc') conf.to_log('Opening and load pkgconfig: ' + pc) pkg = pkgconfig.package(pc) config = None elif os.path.exists(os.path.join(path, 'rtems-config')): config = os.path.join(path, 'rtems-config') pkg = None flags = {} _log_header(conf) flags['CFLAGS'] = _load_flags_set('CFLAGS', arch_bsp, conf, config, pkg) flags['LDFLAGS'] = _load_flags_set('LDFLAGS', arch_bsp, conf, config, pkg) flags['LIB'] = _load_flags_set('LIB', arch_bsp, conf, config, pkg) return flags
def _pkgconfig_check(self, test): ok = False if type(test) == str: test = test.split() if not self._cross_compile() or self.pkgconfig_crosscompile: try: pkg = pkgconfig.package(test[0], prefix=self.pkgconfig_prefix, output=self._output, src=log.trace) if len(test) != 1 and len(test) != 3: self._error("malformed check: %s" % (" ".join(test))) else: op = ">=" ver = "0" if len(test) == 3: op = test[1] ver = self.macros.expand(test[2]) ok = pkg.check(op, ver) except pkgconfig.error, pe: self._error("pkgconfig: check: %s" % (pe)) except:
def _pkgconfig_flags(self, package, flags): pkg_flags = None if not self._cross_compile() or self.pkgconfig_crosscompile: try: pkg = pkgconfig.package(package, prefix=self.pkgconfig_prefix, output=self._output, src=log.trace) pkg_flags = pkg.get(flags) if pkg_flags and self.pkgconfig_filter_flags: fflags = [] for f in pkg_flags.split(): if not f.startswith('-f') and not f.startswith('-W'): fflags += [f] pkg_flags = ' '.join(fflags) log.trace('pkgconfig: %s: %s' % (flags, pkg_flags)) except pkgconfig.error, pe: self._error('pkgconfig: %s: %s' % (flags, pe)) except:
def _pkgconfig_check(self, test): ok = False if not self._cross_compile(): ts = test.split() pkg = pkgconfig.package(ts[0], output = log.output) if len(ts) != 1 and len(ts) != 3: self._error('malformed check') else: op = '>=' ver = '0' if len(ts) == 3: op = ts[1] ver = self.macros.expand(ts[2]) try: ok = pkg.check(op, ver) except pkgconfig.error, pe: self._error('check: %s' % (pe)) except: raise error.interal('pkgconfig failure')
def _pkgconfig_check(self, test): ok = False if type(test) == str: test = test.split() if not self._cross_compile() or self.pkgconfig_crosscompile: try: pkg = pkgconfig.package(test[0], prefix=self.pkgconfig_prefix, output=self._output, src=log.trace) if len(test) != 1 and len(test) != 3: self._error('malformed check: %s' % (' '.join(test))) else: op = '>=' ver = '0' if len(test) == 3: op = test[1] ver = self.macros.expand(test[2]) ok = pkg.check(op, ver) except pkgconfig.error, pe: self._error('pkgconfig: check: %s' % (pe)) except:
def _pkgconfig_flags(self, package, flags): pkg_flags = None if not self._cross_compile() or self.pkgconfig_crosscompile: try: pkg = pkgconfig.package(package, prefix = self.pkgconfig_prefix, output = self._output, src = log.trace) pkg_flags = pkg.get(flags) if pkg_flags and self.pkgconfig_filter_flags: fflags = [] for f in pkg_flags.split(): if not f.startswith('-W'): fflags += [f] pkg_flags = ' '.join(fflags) log.trace('pkgconfig: %s: %s' % (flags, pkg_flags)) except pkgconfig.error as pe: self._error('pkgconfig: %s: %s' % (flags, pe)) except: raise error.internal('pkgconfig failure') if pkg_flags is None: pkg_flags = '' return pkg_flags
from numpy.distutils.misc_util import get_numpy_include_dirs from pkgconfig import package from setuptools import setup, find_packages, Extension from distutils.command.install import install import sysconfig def get_build_dir(): build_dir = "lib.{platform}-{version[0]}.{version[1]}" return os.path.join("build",build_dir.format(platform = sysconfig.get_platform(), version = sys.version_info)) #----------------------------------------------------------------------------- # load pni configuration with pkg-config #----------------------------------------------------------------------------- pnicore = package('pnicore') pniio = package('pniio') #add the configuration to libraries, include directories and library #directories include_dirs = pnicore.include_dirs + pniio.include_dirs library_dirs = pnicore.library_dirs + pniio.library_dirs libraries = pnicore.libraries + pniio.libraries libraries.append('boost_python-py{version[0]}{version[1]}'.format(version=sys.version_info)) #----------------------------------------------------------------------------- # set compiler options #----------------------------------------------------------------------------- extra_compile_args = ['-std=c++11','-Wall','-Wextra', '-fdiagnostics-show-option', '-Wno-strict-prototypes']