fix
This commit is contained in:
@@ -10,7 +10,6 @@ import sys
|
|||||||
import tempfile
|
import tempfile
|
||||||
import tarfile
|
import tarfile
|
||||||
import zipfile
|
import zipfile
|
||||||
import requests
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
DEFAULT_SHELL = "bash"
|
DEFAULT_SHELL = "bash"
|
||||||
@@ -19,6 +18,8 @@ SIZE_PATTERN = re.compile(r"^[1-9][0-9]*[KMGkmg]?$")
|
|||||||
|
|
||||||
|
|
||||||
def download_to(url: str, dest_dir: Path) -> Path:
|
def download_to(url: str, dest_dir: Path) -> Path:
|
||||||
|
# Import when needed
|
||||||
|
import requests
|
||||||
local_filename = url.split('/')[-1]
|
local_filename = url.split('/')[-1]
|
||||||
dest_path = dest_dir / local_filename
|
dest_path = dest_dir / local_filename
|
||||||
|
|
||||||
@@ -120,7 +121,7 @@ def main():
|
|||||||
parser.add_argument("--no-cleanup", "-n", action="store_true", help="Disable cleanup (unmount and remove dir)")
|
parser.add_argument("--no-cleanup", "-n", action="store_true", help="Disable cleanup (unmount and remove dir)")
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
archive = args.archive.resolve()
|
archive = args.archive.strip()
|
||||||
|
|
||||||
if archive.suffix in ['https://', 'http://']:
|
if archive.suffix in ['https://', 'http://']:
|
||||||
archive = download_to(archive, Path.cwd())
|
archive = download_to(archive, Path.cwd())
|
||||||
|
|||||||
Reference in New Issue
Block a user