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)
def __init__(self, magick_config=None, prefix=None): """Build a Convert object. magick_config -- Path to the Magick-config program. prefix -- Prefix where the suite is installed. If neither magick_config nor prefix is provided, /usr/bin/Magick-config and /usr are used respectively. If magick_config is provided, it is used to determine the Image magick suite configuration. Otherwise, or if Magick-config failed to provide the configuration (i.e., the binary does not actually exist or doesn't work), prefix is used (i.e., binaries are searched in prefix/bin, etc). Otherwise, or if the prefix isn't valid (i.e., a beacon file, prefix/bin/convert, isn't found), configuration fails and an exception is thrown. """ # Default configuration. if magick_config is None and prefix is None: magick_config = '/usr/bin/Magick-config' prefix = '/usr' # Prepare arguments if magick_config is not None: magick_config = drake.Path(magick_config) if prefix is not None: prefix = drake.Path(prefix) self.__bin = None # Try with Magick-config. if magick_config is not None: try: cmd = [str(magick_config), '--exec-prefix'] self.__bin = drake.Path(drake.cmd_output(cmd).strip()) / 'bin' except: pass # Try with the prefix. if self.__bin is None and prefix is not None: self.__bin = prefix / 'bin' # Check validity if not self.convert().exists(): raise Exception('%s does not exist' % self.convert())
def __init__(self, magick_config = None, prefix = None): """Build a Convert object. magick_config -- Path to the Magick-config program. prefix -- Prefix where the suite is installed. If neither magick_config nor prefix is provided, /usr/bin/Magick-config and /usr are used respectively. If magick_config is provided, it is used to determine the Image magick suite configuration. Otherwise, or if Magick-config failed to provide the configuration (i.e., the binary does not actually exist or doesn't work), prefix is used (i.e., binaries are searched in prefix/bin, etc). Otherwise, or if the prefix isn't valid (i.e., a beacon file, prefix/bin/convert, isn't found), configuration fails and an exception is thrown. """ # Default configuration. if magick_config is None and prefix is None: magick_config = '/usr/bin/Magick-config' prefix = '/usr' # Prepare arguments if magick_config is not None: magick_config = drake.Path(magick_config) if prefix is not None: prefix = drake.Path(prefix) self.__bin = None # Try with Magick-config. if magick_config is not None: try: cmd = [str(magick_config), '--exec-prefix'] self.__bin = drake.Path(drake.cmd_output(cmd).strip()) / 'bin' except: pass # Try with the prefix. if self.__bin is None and prefix is not None: self.__bin = prefix / 'bin' # Check validity if not self.convert().exists(): raise Exception('%s does not exist' % self.convert())
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)