mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-02-07 08:46:21 +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 re
|
||||||
import tarfile
|
import tarfile
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
from metadata import Metadata
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Utilities:
|
class Utilities:
|
||||||
|
log_packages: str = Metadata.log_packages
|
||||||
|
|
||||||
def build_tag(self, path: str, name: str):
|
def build_tag(self, path: str, name: str):
|
||||||
''' Opens the .SlackBuild file and reads the BUILD TAG. '''
|
''' Opens the .SlackBuild file and reads the BUILD TAG. '''
|
||||||
|
@ -30,3 +32,9 @@ class Utilities:
|
||||||
untar = tarfile.open(tar_file)
|
untar = tarfile.open(tar_file)
|
||||||
untar.extractall(ext_path)
|
untar.extractall(ext_path)
|
||||||
untar.close()
|
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…
Add table
Reference in a new issue