コード例 #1
0
    def __init__(self, prefix=None, version=drake.Version(), cxx_toolkit=None):
        """Build an OpenCV object.

    prefix -- Prefix where OpenCV is installed. It must contain, among
              other things, lib/libopencv_core.so.
    """
        # Fill default arguments.
        if prefix is not None:
            prefix = [drake.Path(prefix)]
        else:
            # pkg-config opencv --variable=prefix
            prefix = [drake.Path('/usr'), drake.Path('/usr/local')]
        cxx_toolkit = cxx_toolkit or drake.cxx.Toolkit()
        # Find the prefix
        beacon = drake.Path('include/opencv2/core/version.hpp')
        prefix = self._search(beacon, prefix)
        # Fill the configuration.
        self.__config = drake.cxx.Config()
        self.__config.add_system_include_path(prefix / 'include')
        self.__config.lib_path(prefix / 'lib')
        self.__config.lib('opencv_core')
        # Check the version
        output = cxx_toolkit.preprocess(
            '# include<opencv2/core/version.hpp>\nCV_MAJOR_VERSION\nCV_MINOR_VERSION\nCV_SUBMINOR_VERSION'
        )
        eff_version = drake.Version(*map(int, output.split('\n')[-4:-1]))
        if eff_version not in version:
            raise Exception('wrong OpenCV version, expected %s, got %s' %
                            (version, eff_version))
コード例 #2
0
ファイル: valgrind.py プロジェクト: xmonader/elle
 def __init__(self, path=None):
     if path is None:
         path = drake.Path('valgrind')
     elif isinstance(path, Valgrind):
         self.__path = drake.Path(path.__path)
         self.__version = drake.Version(path.__version)
         return
     self.__path = drake.Path(path)
     try:
         output = subprocess.check_output([str(self.path), '--version'])
     except Exception as e:
         raise Exception('Unable to find %s' % self.path) from e
     output = output.decode()
     prefix = 'valgrind-'
     if not output.startswith(prefix):
         raise Exception('Unable to parse valgrind version: %s' % output)
     output = output[len(prefix):]
     self.__version = drake.Version(output)
コード例 #3
0
ファイル: __init__.py プロジェクト: xmonader/elle
 def __init__(self, prefix=None, version=drake.Version()):
     if prefix is None:
         paths = [drake.Path('/usr'), drake.Path('/usr/local')]
     else:
         paths = [drake.Path(prefix)]
     self.__prefix = self._search('bin/urbi', paths)
     v = drake.cmd_output([
         str(self.urbi()), '--quiet', '--expression',
         'System.version;shutdown;'
     ])
     v = v.decode('utf-8').split(' ')[1].strip().split('"')[1].split('.')
     v = drake.Version(*map(int, v))
     if v not in version:
         raise Exception(
             'Urbi SDK version (%s) does not match the requested version (%s).'
             % (v, version))
     self.__version = v
     self.__config = drake.cxx.Config()
     self.__config.add_system_include_path(self.__prefix / 'include')
     self.__config.lib_path(self.__prefix / 'lib')
     self.__boost = drake.cxx.boost.Boost(prefix=self.__prefix)
コード例 #4
0
def find(prefix=None,
         cxx_toolkit=None,
         version=drake.Version(),
         prefer_shared=True):
    if isinstance(prefix, Qt):
        if prefix.version not in version:
            raise Exception('given Qt %s does not fit '
                            'the requested version %s' %
                            (prefix.version, version))
        return prefix
    else:
        return Qt(prefix=prefix,
                  cxx_toolkit=cxx_toolkit,
                  version=version,
                  prefer_shared=prefer_shared)
コード例 #5
0
ファイル: command.py プロジェクト: MatheMatrix/memo
 def __init__(self, path=None):
     if isinstance(path, self.__class__):
         self.__path = drake.Path(path.__path)
         self.__version = drake.Version(path.__version)
     else:
         if path is None:
             self.__path = drake.Path(self.__class__.name)
         else:
             self.__path = drake.Path(path)
         try:
             output = self._get_version()
         except Exception as e:
             raise Exception('Unable to find %s' % self.path) from e
         try:
             self.__version = self._parse_version(output)
         except Exception as e:
             raise Exception('Unable to parse %s version from %r' % \
                             (self.__class.name, output)) from e
コード例 #6
0
ファイル: __init__.py プロジェクト: xmonader/elle
def find(python=None, version=None):
    if version is None:
        versions = (drake.Version(3, 6), drake.Version(3, 5),
                    drake.Version(3, 4), drake.Version(3,
                                                       3), drake.Version(3, 2))
    elif not isinstance(version, collections.Iterable):
        versions = (version, )
    else:  # version is already a list.
        versions = version
    tk = drake.cxx.Toolkit()
    windows = tk.os is drake.os.windows
    if python is None and drake.cxx.PkgConfig.available:

        def options():
            for v in versions:
                yield ('python', v)
                yield ('python3', v)  # CentOS
                yield ('python-%s' % v, v)  # Gentoo

        for pkg_name, version in options():
            pkg = drake.cxx.PkgConfig(pkg_name, version=version)
            if pkg.exists:
                python3 = pkg.prefix
                break
    include_dir = list(
        itertools.chain(('include', ),
                        *(('include/python%s' % v, 'include/python%sm' % v)
                          for v in versions)))
    python = drake.cxx.find_library('pyconfig.h',
                                    prefix=python,
                                    include_dir=include_dir)
    python_version = tk.preprocess('''\
#include <patchlevel.h>
PY_MAJOR_VERSION
PY_MINOR_VERSION''',
                                   config=python)
    python_version = python_version.split('\n')[-3:-1]
    python_version = drake.Version(*map(int, python_version))
    if windows:
        python_bin = 'python.exe'
    else:
        python_bin = 'bin/python%s' % python_version
    python.python_interpreter = python.prefix / python_bin
    python.version = python_version
    return python
コード例 #7
0
ファイル: command.py プロジェクト: MatheMatrix/memo
 def _parse_version(self, v):
     return drake.Version(v)
コード例 #8
0
    def __init__(self,
                 cxx_toolkit=None,
                 prefix=None,
                 version=drake.Version(),
                 version_effective=None,
                 prefer_shared=True,
                 rcc=None,
                 qmake=None,
                 uic=None,
                 moc=None):
        """Find and create a configuration for Qt.

    prefix -- Where to find Qt, should contain
              include/Qt/qglobal.h among others. /usr and
              /usr/local are searched by default. If relative, it
              is rooted in the source tree.
    version -- Requested version.
    prefer_shared -- Check dynamic libraries first.
    """
        self.__rcc = rcc
        self.__qmake = qmake
        self.__uic = uic
        self.__moc = moc
        self.__moc_cache = {}
        self.__dependencies = {}
        self.__moc_files = set()
        cxx_toolkit = cxx_toolkit or drake.cxx.Toolkit()
        self.__cxx_toolkit = cxx_toolkit
        self.__prefer_shared = prefer_shared
        include_subdirs = set(
            drake.Path(p) for p in ['include', 'include/qt5'])
        if prefix is None:
            test = [
                path.dirname() for path in cxx_toolkit.include_path
                if path.basename() in include_subdirs
            ]
        else:
            test = [drake.Path(prefix)]
        for i in range(len(test)):
            if not test[i].absolute():
                test[i] = drake.path_source() / test[i]
        token = drake.Path('QtCore/qglobal.h')
        tokens = list(map(lambda p: p / token, include_subdirs))
        prefixes = self._search_many_all(tokens, test)
        miss = []
        # Try every search path
        for path, include_subdir in prefixes:
            include_subdir = include_subdir.without_suffix(token)
            # Create basic configuration for version checking.
            cfg = drake.cxx.Config()
            cfg.pic = True
            if not path.absolute():
                path = path.without_prefix(drake.path_build())
            cfg.add_system_include_path(path / include_subdir)
            if version_effective is None:
                try:
                    version_eff = cxx_toolkit.preprocess(
                        '#include <QtCore/qglobal.h>\nQT_VERSION',
                        config=cfg).split('\n')[-2].strip()
                    version_eff = eval(version_eff, {"__builtins__": None}, {})
                    version_eff = drake.Version(
                        version_eff >> 16,
                        (version_eff >> 8) % 256,
                        version_eff % 256,
                    )
                # If the token doesn't exists, ignore.
                except Exception as e:
                    continue
            else:
                version_eff = version_effective
            if version_eff not in version:
                miss.append(version_eff)
                continue
            # Fill configuration
            self.__prefix = path
            self.__cfg = cfg
            for prop in self.__libraries:
                setattr(self, '_Qt__config_%s_dynamic' % prop, None)
                setattr(self, '_Qt__config_%s_static' % prop, None)
                setattr(self, '_Qt__config_%s_dynamic_header' % prop, None)
                setattr(self, '_Qt__config_%s_static_header' % prop, None)
                setattr(self, '_Qt__%s_dynamic' % prop, None)
                setattr(self, '_Qt__%s_static' % prop, None)
            self.__version = version_eff
            Qt.__include_dir = path / include_subdir
            return

        raise Exception(
            'no matching Qt ({}) in {}. Found versions: {}.'.format(
                pretty_listing(version, any=True),
                pretty_listing([p for p, _ in prefixes], quantifier=True),
                pretty_listing(miss)))
コード例 #9
0
ファイル: git.py プロジェクト: MatheMatrix/elle
 def _parse_version(self, v):
   return drake.Version(v.split(' ')[-1])
コード例 #10
0
ファイル: __init__.py プロジェクト: xmonader/elle
    def runtime_nodes(self):
        res = []
        res.append('bin/urbi')
        res.append('bin/urbi-launch')
        res.append('lib/gostai/engine/libuobject.so')
        res.append('lib/gostai/remote/libuobject.so')
        res.append('lib/gostai/uobjects/urbi/fusion.so')
        res.append('lib/gostai/uobjects/urbi/logger.so')
        res.append('lib/gostai/uobjects/urbi/md5.so')
        res.append('lib/gostai/uobjects/urbi/process.so')
        res.append('lib/gostai/uobjects/urbi/regexp.so')
        res.append('lib/gostai/uobjects/urbi/rtp.so')
        res.append('lib/gostai/uobjects/urbi/stream.so')
        res.append('lib/libjpeg4urbi.so')
        res.append('lib/libport.so')
        res.append('lib/libsched.so')
        res.append('lib/libserialize.so')
        res.append('lib/liburbi.so')
        res.append('lib/liburbijava.so.0.0.0')
        res.append('share/gostai/urbi/binary.u')
        res.append('share/gostai/urbi/boolean.u')
        res.append('share/gostai/urbi/call-message.u')
        res.append('share/gostai/urbi/channel.u')
        res.append('share/gostai/urbi/code.u')
        res.append('share/gostai/urbi/comparable.u')
        res.append('share/gostai/urbi/component.u')
        res.append('share/gostai/urbi/container.u')
        res.append('share/gostai/urbi/control.u')
        res.append('share/gostai/urbi/dataflow.u')
        res.append('share/gostai/urbi/date.u')
        res.append('share/gostai/urbi/dictionary.u')
        res.append('share/gostai/urbi/directory.u')
        res.append('share/gostai/urbi/duration.u')
        res.append('share/gostai/urbi/enumeration.u')
        res.append('share/gostai/urbi/event.u')
        res.append('share/gostai/urbi/exception.u')
        res.append('share/gostai/urbi/file.u')
        res.append('share/gostai/urbi/float.u')
        res.append('share/gostai/urbi/formatter.u')
        res.append('share/gostai/urbi/global.u')
        res.append('share/gostai/urbi/group.u')
        res.append('share/gostai/urbi/input-stream.u')
        res.append('share/gostai/urbi/job.u')
        res.append('share/gostai/urbi/kernel1.u')
        res.append('share/gostai/urbi/lazy.u')
        res.append('share/gostai/urbi/list.u')
        res.append('share/gostai/urbi/loadable.u')
        res.append('share/gostai/urbi/lobby.u')
        res.append('share/gostai/urbi/logger.u')
        res.append('share/gostai/urbi/math.u')
        res.append('share/gostai/urbi/mutex.u')
        res.append('share/gostai/urbi/naming-standard.u')
        res.append('share/gostai/urbi/nil.u')
        res.append('share/gostai/urbi/object.u')
        res.append('share/gostai/urbi/orderable.u')
        res.append('share/gostai/urbi/package-info.u')
        res.append('share/gostai/urbi/package-info/urbi-sdk.u')
        res.append('share/gostai/urbi/package-info/libport.u')
        res.append('share/gostai/urbi/path.u')
        res.append('share/gostai/urbi/pattern.u')
        res.append('share/gostai/urbi/platform.u')
        res.append('share/gostai/urbi/process.u')
        res.append('share/gostai/urbi/profile.u')
        res.append('share/gostai/urbi/pubsub.u')
        res.append('share/gostai/urbi/python.u')
        res.append('share/gostai/urbi/range-iterable.u')
        res.append('share/gostai/urbi/regexp.u')
        res.append('share/gostai/urbi/require-file.u')
        res.append('share/gostai/urbi/semaphore.u')
        res.append('share/gostai/urbi/singleton.u')
        res.append('share/gostai/urbi/socket.u')
        res.append('share/gostai/urbi/stack-frame.u')
        res.append('share/gostai/urbi/string.u')
        res.append('share/gostai/urbi/system.u')
        res.append('share/gostai/urbi/tag.u')
        res.append('share/gostai/urbi/test-suite.u')
        res.append('share/gostai/urbi/timeout.u')
        res.append('share/gostai/urbi/traceable.u')
        res.append('share/gostai/urbi/trajectory-generator.u')
        res.append('share/gostai/urbi/tuple.u')
        res.append('share/gostai/urbi/uobject.u')
        res.append('share/gostai/urbi/updatehook-stack.u')
        res.append('share/gostai/urbi/urbi.u')
        res.append('share/gostai/urbi/utags.u')
        res.append('share/gostai/urbi/weak-pointer.u')
        if self.__version >= drake.Version(2, 7, 4):
            res.append('lib/libboost_date_time.so.1.40.0')
            res.append('lib/libboost_filesystem.so.1.40.0')
            res.append('lib/libboost_graph.so.1.40.0')
            res.append('lib/libboost_math_c99f.so.1.40.0')
            res.append('lib/libboost_math_c99l.so.1.40.0')
            res.append('lib/libboost_math_c99.so.1.40.0')
            res.append('lib/libboost_math_tr1f.so.1.40.0')
            res.append('lib/libboost_math_tr1l.so.1.40.0')
            res.append('lib/libboost_math_tr1.so.1.40.0')
            res.append('lib/libboost_prg_exec_monitor.so.1.40.0')
            res.append('lib/libboost_program_options.so.1.40.0')
            res.append('lib/libboost_regex.so.1.40.0')
            res.append('lib/libboost_serialization.so.1.40.0')
            res.append('lib/libboost_signals.so.1.40.0')
            res.append('lib/libboost_system.so.1.40.0')
            res.append('lib/libboost_thread.so.1.40.0')
            res.append('lib/libboost_unit_test_framework.so.1.40.0')
            res.append('lib/libboost_wave.so.1.40.0')
            res.append('lib/libboost_wserialization.so.1.40.0')
            res.append('lib/libicudata.so.42')
            res.append('lib/libicui18n.so.42')
            res.append('lib/libicuuc.so.42')
        else:
            res.append('lib/libboost_date_time-gcc41-mt-1_38.so.1.38.0')
            res.append('lib/libboost_filesystem-gcc41-mt-1_38.so.1.38.0')
            res.append('lib/libboost_graph-gcc41-mt-1_38.so.1.38.0')
            res.append('lib/libboost_math_c99f-gcc41-mt-1_38.so.1.38.0')
            res.append('lib/libboost_math_c99l-gcc41-mt-1_38.so.1.38.0')
            res.append('lib/libboost_math_c99-gcc41-mt-1_38.so.1.38.0')
            res.append('lib/libboost_math_tr1f-gcc41-mt-1_38.so.1.38.0')
            res.append('lib/libboost_math_tr1l-gcc41-mt-1_38.so.1.38.0')
            res.append('lib/libboost_math_tr1-gcc41-mt-1_38.so.1.38.0')
            res.append('lib/libboost_prg_exec_monitor-gcc41-mt-1_38.so.1.38.0')
            res.append('lib/libboost_program_options-gcc41-mt-1_38.so.1.38.0')
            res.append('lib/libboost_regex-gcc41-mt-1_38.so.1.38.0')
            res.append('lib/libboost_serialization-gcc41-mt-1_38.so.1.38.0')
            res.append('lib/libboost_signals-gcc41-mt-1_38.so.1.38.0')
            res.append('lib/libboost_system-gcc41-mt-1_38.so.1.38.0')
            res.append('lib/libboost_thread-gcc41-mt-1_38.so.1.38.0')
            res.append(
                'lib/libboost_unit_test_framework-gcc41-mt-1_38.so.1.38.0')
            res.append('lib/libboost_wave-gcc41-mt-1_38.so.1.38.0')
            res.append('lib/libboost_wserialization-gcc41-mt-1_38.so.1.38.0')

        return list(
            map(lambda p: drake.Node('%s/%s' % (self.prefix(), p)), res))