generated from CuriBio/python-github-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0aa402f
commit d0afc8e
Showing
3 changed files
with
18 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,25 @@ | ||
# -*- coding: utf-8 -*- | ||
import os | ||
import shutil | ||
import zipfile | ||
|
||
import requests | ||
import boto3 | ||
|
||
s3_resource = boto3.resource("s3") | ||
bucket = s3_resource.Bucket("downloads.curibio.com") | ||
|
||
# assuming this is being run from controller/ | ||
controller_folder_path = os.path.join("src", "mantarray_desktop_app") | ||
zlib_folder_path = os.path.join(controller_folder_path, "zlib") | ||
|
||
r = requests.get("https://www.zlib.net/zlib13.zip", allow_redirects=True) | ||
with open(zlib_folder_path + ".zip", "wb") as zlib_zip: | ||
zlib_zip.write(r.content) | ||
filename = "zlib-1.3.zip" | ||
zlib_zip_path = os.path.join(controller_folder_path, filename) | ||
bucket.download_file(f"software/{filename}", zlib_zip_path) | ||
|
||
with zipfile.ZipFile(zlib_folder_path + ".zip", "r") as zip_ref: | ||
zlib_folder_path = os.path.join(controller_folder_path, "zlib") | ||
with zipfile.ZipFile(zlib_zip_path, "r") as zip_ref: | ||
zip_ref.extractall(controller_folder_path) | ||
|
||
os.rename(f"{zlib_folder_path}-1.3", zlib_folder_path) | ||
|
||
if "__MACOSX" in os.listdir(controller_folder_path): | ||
shutil.rmtree(os.path.join(controller_folder_path, "__MACOSX")) |