mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-18 10:26:29 +01:00
Added is_installed method
This commit is contained in:
parent
62e6153135
commit
28e542c605
1 changed files with 8 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue