Added is_installed method

This commit is contained in:
Dimitris Zlatanidis 2022-06-18 00:24:43 +03:00
parent 62e6153135
commit 28e542c605

View file

@ -6,10 +6,12 @@ import os
import re
import tarfile
from dataclasses import dataclass
from metadata import Metadata
@dataclass
class Utilities:
log_packages: str = Metadata.log_packages
def build_tag(self, path: str, name: str):
''' Opens the .SlackBuild file and reads the BUILD TAG. '''
@ -30,3 +32,9 @@ class Utilities:
untar = tarfile.open(tar_file)
untar.extractall(ext_path)
untar.close()
def is_installed(self, package: str):
''' Returns True if a package is installed. '''
for pkg in os.listdir(self.log_packages):
if package in pkg:
return True