unzips and makes path.txt point at the correct executable
167583
function extractFile (err, zipPath) {
  if (err) return onerror(err)
  extract(zipPath, { dir: path.join(__dirname, 'dist') }, function (err) {
    if (err) return onerror(err)
    fs.writeFile(path.join(__dirname, 'path.txt'), platformPath, function (err) {
      if (err) return onerror(err)
    })
  })
}
1190359
def unzip(self, directory):
        
        if not os.path.exists(directory):
            os.makedirs(directory)
        shutil.copytree(self.src_dir, directory)
1314118
def _normalize_path(path):
        
        if isinstance(path, FileInfo):
            path = path.path
        if len(path) == 0:
            return '/'
        if not path.startswith('/'):
            path = '/' + path
        return path
1176070
def __find_executables(path):
    

    success = False
    progs = {
        "dot": "",
        "twopi": "",
        "neato": "",
        "circo": "",
        "fdp": "",
        "sfdp": "",
    }

    was_quoted = False
    path = path.strip()
    if path.startswith('"') and path.endswith('"'):
        path = path[1:-1]
        was_quoted = True

    if not os.path.isdir(path):
        return None

    for prg in progs:
        if progs[prg]:
            continue

        prg_path = os.path.join(path, prg)
        prg_exe_path = prg_path + ".exe"

        if os.path.exists(prg_path):
            if was_quoted:
                prg_path = "\"{}\"".format(prg_path)
            progs[prg] = prg_path
            success = True

        elif os.path.exists(prg_exe_path):
            if was_quoted:
                prg_exe_path = "\"{}\"".format(prg_exe_path)
            progs[prg] = prg_exe_path
            success = True

    if success:
        return progs

    return None
1054195
def rmfile(path):
    """"""
    if osp.isfile(path):
        if is_win:
            os.chmod(path, 0o777)
        os.remove(path)
20923
function mustUnzip(file, mode){
  if (mode){
    return mode === 'tgz';
  }
  var extension = path.extname(file);
  return contains(['.tgz', '.gz'], extension);
}
1104862
def _extract(self, path, outdir, filter_func=None):
    """"""
    with open_zip(path) as archive_file:
      for name in archive_file.namelist():
        # While we're at it, we also perform this safety test.
        if name.startswith('/') or name.startswith('..'):
          raise ValueError('Zip file contains unsafe path: {}'.format(name))
        if (not filter_func or filter_func(name)):
          archive_file.extract(name, outdir)
1199302
function extractFile (err, zipPath) {
  if (err) return onerror(err)
  fs.writeFile(path.join(__dirname, 'path.txt'), paths[platform], function (err) {
    if (err) return onerror(err)
    extract(zipPath, {dir: path.join(__dirname, 'dist')}, function (err) {
      if (err) return onerror(err)
    })
  })
}
1250016
def unzip_file(filename, location, flatten=True):
    """"""
    if not os.path.exists(location):
        os.makedirs(location)
    zipfp = open(filename, 'rb')
    try:
        zip = zipfile.ZipFile(zipfp)
        leading = has_leading_dir(zip.namelist()) and flatten
        for name in zip.namelist():
            data = zip.read(name)
            fn = name
            if leading:
                fn = split_leading_dir(name)[1]
            fn = os.path.join(location, fn)
            dir = os.path.dirname(fn)
            if not os.path.exists(dir):
                os.makedirs(dir)
            if fn.endswith('/') or fn.endswith('\\'):
                # A directory
                if not os.path.exists(fn):
                    os.makedirs(fn)
            else:
                fp = open(fn, 'wb')
                try:
                    fp.write(data)
                finally:
                    fp.close()
    finally:
        zipfp.close()
645133
def file_xext(filepath):
    
    ext = os.path.splitext(filepath)[1]
    if ext == '.gz':
        xext = os.path.splitext(os.path.splitext(filepath)[0])[1]
        if xext == '.tar':
            ext = xext + ext
    elif ext == '.tar':
        pass # ext is already .tar
    else:
        ext = ''
    return ext
1235053
def extract_zipped_paths(path):
    
    if os.path.exists(path):
        # this is already a valid path, no need to do anything further
        return path

    # find the first valid part of the provided path and treat that as a zip archive
    # assume the rest of the path is the name of a member in the archive
    archive, member = os.path.split(path)
    while archive and not os.path.exists(archive):
        archive, prefix = os.path.split(archive)
        member = '/'.join([prefix, member])

    if not zipfile.is_zipfile(archive):
        return path

    zip_file = zipfile.ZipFile(archive)
    if member not in zip_file.namelist():
        return path

    # we have a valid zip archive and a valid member of that archive
    tmp = tempfile.gettempdir()
    extracted_path = os.path.join(tmp, *member.split('/'))
    if not os.path.exists(extracted_path):
        extracted_path = zip_file.extract(member, path=tmp)

    return extracted_path
271719
def open(self, path, binary=False):
        """"""
        if binary:
            return open(path, "rb")
        return open(path, encoding="utf-8")
21787
def unzip(source_file, destination_dir):
    
    with zipfile.ZipFile(source_file) as zf:
        zf.extractall(destination_dir)
661646
function unzipWorker(unzipTask, workerCb) {
  var zipfile = unzipTask.zipfile;
  var entry = unzipTask.entry;
  var workingDir = unzipTask.workingDir;
  if (/\/$/.test(entry.fileName)) {
    // directory file names end with '/'
    makeExportDirectory({
      entry: entry,
      zipfile: zipfile,
      workingDir: workingDir
    }, workerCb);
  } else {
    // file entry
    streamFileEntry({
      zipfile: zipfile,
      entry: entry,
      workingDir: workingDir
    }, workerCb);
  }
}
1195807
static function unzip($path, $toPath) {
        $zip = new \ZipArchive();
        $res = $zip->open($path);
        if ($res) {
            $zip->extractTo($toPath);
        }
        $zip->close();
    }
346596
def _clean_path(p):
    

    np = os.path.expanduser(p)
    np = os.path.abspath(np)

    return np
238297
def decompress(self, image_path, quiet=True):
    ''''''

    if not os.path.exists(image_path):
        bot.exit("Cannot find image %s" %image_path)
        
    extracted_file = image_path.replace('.gz','')
    cmd = ['gzip','-d','-f', image_path]
    result = self.run_command(cmd, quiet=quiet) # exits if return code != 0
    return extracted_file