mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-02-05 08:46:20 +01:00
Convert to generator
Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
parent
8873479f2a
commit
a97ed2a8ea
5 changed files with 15 additions and 12 deletions
|
@ -68,11 +68,7 @@ class BinaryInstall:
|
|||
self.msg = Msg()
|
||||
self.version = self.meta.slack_rel
|
||||
self.tmp_path = self.meta.slpkg_tmp_packages
|
||||
for fl in self.flag:
|
||||
if fl.startswith("--directory-prefix="):
|
||||
self.tmp_path = fl.split("=")[1]
|
||||
if not self.tmp_path.endswith("/"):
|
||||
self.tmp_path += "/"
|
||||
self.init_flags()
|
||||
self.dwn, self.dep_dwn = [], []
|
||||
self.install, self.dep_install = [], []
|
||||
self.comp_sum, self.dep_comp_sum = [], []
|
||||
|
@ -89,6 +85,15 @@ class BinaryInstall:
|
|||
self.blacklist = BlackList().packages(self.data[0], self.repo)
|
||||
self.matching = False
|
||||
|
||||
def init_flags(self):
|
||||
"""Flags initiliazation
|
||||
"""
|
||||
for fl in self.flag:
|
||||
if fl.startswith("--directory-prefix="):
|
||||
self.tmp_path = fl.split("=")[1]
|
||||
if not self.tmp_path.endswith("/"):
|
||||
self.tmp_path += "/"
|
||||
|
||||
def start(self, is_upgrade):
|
||||
"""
|
||||
Install packages from official Slackware distribution
|
||||
|
@ -187,7 +192,7 @@ class BinaryInstall:
|
|||
"""
|
||||
if "--case-ins" in self.flag:
|
||||
data = []
|
||||
data = Utils().package_name(self.PACKAGES_TXT)
|
||||
data = list(Utils().package_name(self.PACKAGES_TXT))
|
||||
data_dict = Utils().case_sensitive(data)
|
||||
for pkg in self.packages:
|
||||
index = self.packages.index(pkg)
|
||||
|
|
|
@ -34,7 +34,7 @@ def search_pkg(name, repo):
|
|||
and return the name.
|
||||
"""
|
||||
PACKAGES_TXT = Utils().read_file(_meta_.lib_path + f"{repo}_repo/PACKAGES.TXT")
|
||||
names = Utils().package_name(PACKAGES_TXT)
|
||||
names = list(Utils().package_name(PACKAGES_TXT))
|
||||
blacklist = BlackList().packages(pkgs=names, repo=repo)
|
||||
for line in PACKAGES_TXT.splitlines():
|
||||
status(0)
|
||||
|
|
|
@ -31,7 +31,7 @@ def searching(find_pkg, directory):
|
|||
"""Find packages
|
||||
"""
|
||||
if os.path.isdir(directory):
|
||||
installed = sorted(os.listdir(directory))
|
||||
installed = os.listdir(directory)
|
||||
blacklist = BlackList().packages(pkgs=installed, repo="local")
|
||||
if os.path.exists(directory):
|
||||
for pkg in installed:
|
||||
|
|
|
@ -125,7 +125,7 @@ class TrackingDeps:
|
|||
else:
|
||||
PACKAGES_TXT = Utils().read_file(
|
||||
self.meta.lib_path + f"{self.repo}_repo/PACKAGES.TXT")
|
||||
self.names = Utils().package_name(PACKAGES_TXT)
|
||||
self.names = list(Utils().package_name(PACKAGES_TXT))
|
||||
self.bin_case_insensitive()
|
||||
self.find_pkg = search_pkg(self.name, self.repo)
|
||||
if self.find_pkg:
|
||||
|
|
|
@ -66,11 +66,9 @@ class Utils:
|
|||
def package_name(self, PACKAGES_TXT):
|
||||
"""Returns list with all the names of packages repository
|
||||
"""
|
||||
packages = []
|
||||
for line in PACKAGES_TXT.splitlines():
|
||||
if line.startswith("PACKAGE NAME:"):
|
||||
packages.append(split_package(line[14:].strip())[0])
|
||||
return packages
|
||||
yield split_package(line[14:].strip())[0]
|
||||
|
||||
def check_downloaded(self, path, maybe_downloaded):
|
||||
"""Check if files downloaded and return downloaded
|
||||
|
|
Loading…
Add table
Reference in a new issue