From: Tim 'mithro' Ansell Date: Tue, 7 Apr 2020 00:45:55 +0000 (-0700) Subject: Use shutil.unpack_archive. X-Git-Tag: 24jan2021_ls180~493^2~3 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7f0ecddfb2505d89e72850b935ec4e3b24bf3131;p=litex.git Use shutil.unpack_archive. --- diff --git a/litex_setup.py b/litex_setup.py index 61a556a8..fa33fb99 100755 --- a/litex_setup.py +++ b/litex_setup.py @@ -3,6 +3,7 @@ import os import sys import subprocess +import shutil from collections import OrderedDict import urllib.request @@ -59,14 +60,7 @@ def sifive_riscv_download(): print("Using existing file", fn) print("Extracting", fn) - if fn.endswith(".tar.gz"): - import tarfile - with tarfile.open(fn) as t: - t.extractall() - elif fn.endswith(".zip"): - import zipfile - with zipfile.open(fn) as z: - z.extractall() + shutil.unpack_archive(fn) if "--user" in sys.argv[1:] and not is_windows: print("Linking compiler into ~/.local/bin")