mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-13 20:01:48 +01:00
Switch to glob module
This commit is contained in:
parent
92730ac2cc
commit
d3465166a8
1 changed files with 9 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
import glob
|
||||||
import time
|
import time
|
||||||
import shutil
|
import shutil
|
||||||
import tarfile
|
import tarfile
|
||||||
|
@ -24,10 +24,16 @@ class Utilities:
|
||||||
|
|
||||||
def is_installed(self, name: str) -> str:
|
def is_installed(self, name: str) -> str:
|
||||||
""" Returns the installed package name. """
|
""" Returns the installed package name. """
|
||||||
for package in os.listdir(self.configs.log_packages):
|
pattern = f'{str(self.configs.log_packages)}/*{self.configs.sbo_repo_tag}'
|
||||||
|
packages = glob.glob(pattern)
|
||||||
|
|
||||||
|
for package in packages:
|
||||||
|
package = package.split('/')[-1]
|
||||||
pkg = self.split_installed_pkg(package)[0]
|
pkg = self.split_installed_pkg(package)[0]
|
||||||
if pkg == name and self.configs.sbo_repo_tag in package and pkg not in self.black.get():
|
|
||||||
|
if pkg == name and pkg not in self.black.get():
|
||||||
return package
|
return package
|
||||||
|
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Reference in a new issue