mirror of
https://github.com/amix/vimrc
synced 2025-02-28 14:12:51 +08:00
bytesio
This commit is contained in:
parent
324947e2f3
commit
8c5e53faba
@ -71,15 +71,11 @@ SOURCE_DIR = path.join(path.dirname(__file__), "sources_non_forked")
|
||||
|
||||
|
||||
def download_extract_replace(plugin_name, zip_path, temp_dir, source_dir):
|
||||
temp_zip_path = path.join(temp_dir, plugin_name)
|
||||
|
||||
# Download and extract file in temp dir
|
||||
with urllib.request.urlopen(zip_path) as req:
|
||||
with open(temp_zip_path, "wb") as f:
|
||||
f.write(BytesIO(req.read()))
|
||||
zip_f = zipfile.ZipFile(temp_zip_path)
|
||||
zip_f.extractall(temp_dir)
|
||||
content_disp = req.headers.get("Content-Disposition")
|
||||
zip_f = zipfile.ZipFile(BytesIO(req.read()))
|
||||
zip_f.extractall(temp_dir)
|
||||
content_disp = req.headers.get("Content-Disposition")
|
||||
|
||||
filename = re.findall("filename=(.+).zip", content_disp)[0]
|
||||
plugin_temp_path = path.join(temp_dir, path.join(temp_dir, filename))
|
||||
|
Loading…
Reference in New Issue
Block a user