Gets the Qemu-img version.

        :param qemu_img_path: path to Qemu-img executable.
544759
def _get_qemu_img_version(qemu_img_path):
        

        try:
            output = yield from subprocess_check_output(qemu_img_path, "--version")
            match = re.search("version\s+([0-9a-z\-\.]+)", output)
            if match:
                version = match.group(1)
                return version
            else:
                raise QemuError("Could not determine the Qemu-img version for {}".format(qemu_img_path))
        except subprocess.SubprocessError as e:
            raise QemuError("Error while looking for the Qemu-img version: {}".format(e))
326360
def get_interpreter_path(version=None):
    """"""
    if version and version != str(sys.version_info[0]):
        return settings.PYTHON_INTERPRETER + version
    else:
        return sys.executable
1353967
def load_img(self, img_path):
        
        with open_file(self.uuid, img_path) as f:
            return mpimg.imread(f)
886151
def get_version(path, default="master"):
    
    version = default
    if os.path.exists(path):
        version_contents = file_to_string(path)
        if version_contents:
            version = version_contents.strip()

    return version
1315583
def image(out = nil)
      splash_start
      splash_composite
      return img unless out
      FileUtils.mkdir_p File.dirname(out)
      img.write(out)
    rescue Errno::ENOENT
      YAMG.puts_and_exit("Path not found '#{out}'")
    end
130950
def get_version_from_file(path):
    
    filename = os.path.join(path, VERSION_FILE)
    if not os.path.isfile(filename):
        # Look in the parent directory of path instead.
        filename = os.path.join(os.path.dirname(path), VERSION_FILE)
        if not os.path.isfile(filename):
            filename = ''

    if filename:
        with open(filename) as fh:
            version = fh.readline().strip()
            if version:
                return version
1079124
def __get_img(self):
        
        with self.fs.open(self.__img_path, 'rb') as fd:
            img = PIL.Image.open(fd)
            img.load()
            return img
145591
def fetch_image(self, path, dest, user='root'):
        
        self.run('test -f %s || curl -L -s -o %s %s' % (dest, dest, path),
                 user=user, ignore_error=True)
804449
def bios_image(self, bios_image):
        
        self._bios_image = self.manager.get_abs_image_path(bios_image)
        log.info('QEMU VM "{name}" [{id}] has set the QEMU bios image path to {bios_image}'.format(name=self._name,
                                                                                                   id=self._id,
                                                                                                   bios_image=self._bios_image))
978704
def get_qemu_version(qemu_path):
        

        if sys.platform.startswith("win"):
            # Qemu on Windows doesn't return anything with parameter -version
            # look for a version number in version.txt file in the same directory instead
            version_file = os.path.join(os.path.dirname(qemu_path), "version.txt")
            if os.path.isfile(version_file):
                try:
                    with open(version_file, "rb") as file:
                        version = file.read().decode("utf-8").strip()
                        match = re.search("[0-9\.]+", version)
                        if match:
                            return version
                except (UnicodeDecodeError, OSError) as e:
                    log.warn("could not read {}: {}".format(version_file, e))
            return ""
        else:
            try:
                output = yield from subprocess_check_output(qemu_path, "-version")
                match = re.search("version\s+([0-9a-z\-\.]+)", output)
                if match:
                    version = match.group(1)
                    return version
                else:
                    raise QemuError("Could not determine the Qemu version for {}".format(qemu_path))
            except subprocess.SubprocessError as e:
                raise QemuError("Error while looking for the Qemu version: {}".format(e))
674074
def get_version(exe_path='youtube-dl'):
    ''''''
    process = subprocess.Popen(
        [exe_path, '--version'],
        stdout=subprocess.PIPE
    )
    version_string = process.communicate()[0]
    version_string = version_string.decode().strip()

    assert ' ' not in version_string, version_string

    return version_string
32032
def version(path):
    
    version_file = read(path)
    version_match = re.search(r"""^__version__ = ['"]([^'"]*)['"]""",
                              version_file, re.M)
    if version_match:
        return version_match.group(1)
    raise RuntimeError("Unable to find version string.")
939584
def qemu_path(self, qemu_path):
        

        if qemu_path and os.pathsep not in qemu_path:
            if sys.platform.startswith("win") and ".exe" not in qemu_path.lower():
                qemu_path += "w.exe"
            new_qemu_path = shutil.which(qemu_path, path=os.pathsep.join(self._manager.paths_list()))
            if new_qemu_path is None:
                raise QemuError("QEMU binary path {} is not found in the path".format(qemu_path))
            qemu_path = new_qemu_path

        self._check_qemu_path(qemu_path)
        self._qemu_path = qemu_path
        self._platform = os.path.basename(qemu_path)
        if self._platform == "qemu-kvm":
            self._platform = "x86_64"
        else:
            qemu_bin = os.path.basename(qemu_path)
            qemu_bin = re.sub(r'(w)?\.(exe|EXE)$', '', qemu_bin)
            # Old version of GNS3 provide a binary named qemu.exe
            if qemu_bin == "qemu":
                self._platform = "i386"
            else:
                self._platform = re.sub(r'^qemu-system-(.*)$', r'\1', qemu_bin, re.IGNORECASE)
        if self._platform.split(".")[0] not in QEMU_PLATFORMS:
            raise QemuError("Platform {} is unknown".format(self._platform))
        log.info('QEMU VM "{name}" [{id}] has set the QEMU path to {qemu_path}'.format(name=self._name,
                                                                                       id=self._id,
                                                                                       qemu_path=qemu_path))
939294
def parse_image_name(name):
    
    name = name or ""
    if '/' in name:
        repository, other = name.split('/')
    else:
        repository, other = None, name

    if ':' in other:
        name, version = other.split(':')
    else:
        name, version = other, 'latest'

    return repository, name, version
192996
def execPath(self):
        """"""
        vers = self.version.label if self.version else None # executables in Versions folder are stored by baseVersion (modified by game data patches)
        return self.installedApp.exec_path(vers)
1065205
def import_image(image_path, os_version):
    
    image_name = os.path.basename(image_path)
    print("\nChecking if image %s exists ..." % image_name)

    image_query_info = client.send_request('image_query', imagename = image_name)
    if image_query_info['overallRC']:
        print("Importing image %s ..." % image_name)
        url = "file://" + image_path
        image_import_info = client.send_request('image_import', image_name, url, 
                                                {'os_version': os_version})
        if image_import_info['overallRC']:
            raise RuntimeError("Failed to import image %s!\n%s" % 
                               (image_name, image_import_info))
        else:
            print("Succeeded to import image %s!" % image_name)
    else:
        print("Image %s already exists!" % image_name)
37977
def get_image_hashes(image_path, version=None, levels=None):
    '''
    '''
    if levels is None:
        levels = get_levels(version=version)
    hashes = dict()
    for level_name,level_filter in levels.items():
        hashes[level_name] = get_image_hash(image_path,
                                            level_filter=level_filter)
    return hashes