summaryrefslogtreecommitdiff
path: root/src/util.py
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2021-12-07 23:02:43 +0000
committerdavidovski <david@davidovski.xyz>2021-12-07 23:02:43 +0000
commit075149bb1c92e3dc5df9fd07feebe60a3c8e4fef (patch)
treed9a97bc49b96657629045b29c989610208d54da0 /src/util.py
parent7887f4d828c0ec15b209afc49f2671e368cb2c70 (diff)
fixed issues with getting most popular package
Diffstat (limited to 'src/util.py')
-rw-r--r--src/util.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/util.py b/src/util.py
index fcc58f4..c84d7a3 100644
--- a/src/util.py
+++ b/src/util.py
@@ -10,7 +10,12 @@ DEFAULT_BAR_COLOR = colors.BLACK + colors.BG_CYAN
DEFAULT_BAR_COLOR_RESET = colors.BG_BLACK + colors.CYAN
def extract_tar(package_path, destination):
- os.system(f"tar -h --no-overwrite-dir -xf {package_path} -C {destination}")
+ cmd = f"tar -h --no-overwrite-dir -xvf {package_path} -C {destination}"
+
+ os.popen(cmd).read()
+ with tarfile.open(package_path) as tar:
+ return "\n".join(["".join(m.name[1:]) for m in tar.getmembers() if not m.isdir()])
+
def add_path(*argv):
a = argv[0]