mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-29 20:34:22 +01:00
update class
This commit is contained in:
parent
1c5459af79
commit
592aa1c449
1 changed files with 17 additions and 19 deletions
|
@ -56,19 +56,21 @@ class SBoInstall(object):
|
||||||
self.dependencies = []
|
self.dependencies = []
|
||||||
self.package_not_found = []
|
self.package_not_found = []
|
||||||
self.package_found = []
|
self.package_found = []
|
||||||
|
self.pkg_ver = []
|
||||||
self.deps_dict = {}
|
self.deps_dict = {}
|
||||||
self.toolbar_width, self.index = 2, 0
|
self.toolbar_width, self.index = 2, 0
|
||||||
self.answer = ''
|
self.answer = ''
|
||||||
|
self.match = False
|
||||||
Msg().reading()
|
Msg().reading()
|
||||||
|
|
||||||
def start(self, if_upgrade):
|
def start(self, if_upgrade):
|
||||||
try:
|
try:
|
||||||
self.if_upgrade, self.pkg_ver = if_upgrade, []
|
self.if_upgrade = if_upgrade
|
||||||
self.view_version()
|
self.view_version()
|
||||||
if self.if_upgrade:
|
if self.if_upgrade:
|
||||||
self.slackbuilds, self.pkg_ver = (self.slackbuilds[0],
|
self.slackbuilds, self.pkg_ver = (self.slackbuilds[0],
|
||||||
self.slackbuilds[1])
|
self.slackbuilds[1])
|
||||||
tagc, match = '', False
|
tagc = ''
|
||||||
count_ins = count_upg = count_uni = 0
|
count_ins = count_upg = count_uni = 0
|
||||||
self._remove_blacklist()
|
self._remove_blacklist()
|
||||||
for _sbo in self.slackbuilds:
|
for _sbo in self.slackbuilds:
|
||||||
|
@ -82,8 +84,8 @@ class SBoInstall(object):
|
||||||
else:
|
else:
|
||||||
self.package_not_found.append(_sbo)
|
self.package_not_found.append(_sbo)
|
||||||
if not self.package_found:
|
if not self.package_found:
|
||||||
match = True
|
self.match = True
|
||||||
self.package_found = self.matching(self.package_not_found)
|
self.matching()
|
||||||
self.pkg_ver = [''] * len(self.package_found)
|
self.pkg_ver = [''] * len(self.package_found)
|
||||||
self.master_packages, mas_src = self.sbo_version_source(
|
self.master_packages, mas_src = self.sbo_version_source(
|
||||||
self.package_found)
|
self.package_found)
|
||||||
|
@ -92,7 +94,7 @@ class SBoInstall(object):
|
||||||
self.dependencies, dep_src = self.sbo_version_source(
|
self.dependencies, dep_src = self.sbo_version_source(
|
||||||
self.one_for_all(self.deps))
|
self.one_for_all(self.deps))
|
||||||
Msg().done()
|
Msg().done()
|
||||||
self.master_packages, self.pkg_ver = self.clear_masters()
|
self.clear_masters()
|
||||||
if self.package_found:
|
if self.package_found:
|
||||||
print("\nThe following packages will be automatically "
|
print("\nThe following packages will be automatically "
|
||||||
"installed or upgraded \nwith new version:\n")
|
"installed or upgraded \nwith new version:\n")
|
||||||
|
@ -108,7 +110,7 @@ class SBoInstall(object):
|
||||||
name = '-'.join(sbo.split('-')[:-1])
|
name = '-'.join(sbo.split('-')[:-1])
|
||||||
self.view_packages(tagc, name, sbo.split('-')[-1],
|
self.view_packages(tagc, name, sbo.split('-')[-1],
|
||||||
self.select_arch(ar))
|
self.select_arch(ar))
|
||||||
self._view_installing_for_deps(match)
|
self._view_installing_for_deps()
|
||||||
# view dependencies
|
# view dependencies
|
||||||
for dep, ar in zip(self.dependencies, dep_src):
|
for dep, ar in zip(self.dependencies, dep_src):
|
||||||
tagc, count_ins, count_upg, count_uni = self.tag(
|
tagc, count_ins, count_upg, count_uni = self.tag(
|
||||||
|
@ -148,16 +150,16 @@ class SBoInstall(object):
|
||||||
Continue to install
|
Continue to install
|
||||||
'''
|
'''
|
||||||
if self.master_packages and Msg().answer() in ['y', 'Y']:
|
if self.master_packages and Msg().answer() in ['y', 'Y']:
|
||||||
b_ins = self.build_install()
|
installs, upgraded = self.build_install()
|
||||||
Msg().reference(b_ins[0], b_ins[1])
|
Msg().reference(installs, upgraded)
|
||||||
write_deps(self.deps_dict)
|
write_deps(self.deps_dict)
|
||||||
delete(self.build_folder)
|
delete(self.build_folder)
|
||||||
|
|
||||||
def _view_installing_for_deps(self, match):
|
def _view_installing_for_deps(self):
|
||||||
'''
|
'''
|
||||||
View installing for dependencies message
|
View installing for dependencies message
|
||||||
'''
|
'''
|
||||||
if not match and self.dependencies:
|
if not self.match and self.dependencies:
|
||||||
print("Installing for dependencies:")
|
print("Installing for dependencies:")
|
||||||
|
|
||||||
def clear_masters(self):
|
def clear_masters(self):
|
||||||
|
@ -165,27 +167,23 @@ class SBoInstall(object):
|
||||||
Clear master slackbuilds if already exist in dependencies
|
Clear master slackbuilds if already exist in dependencies
|
||||||
or if added to install two or more times
|
or if added to install two or more times
|
||||||
'''
|
'''
|
||||||
slackbuilds, version = [], []
|
|
||||||
for mas, ver in zip(Utils().remove_dbs(self.master_packages),
|
for mas, ver in zip(Utils().remove_dbs(self.master_packages),
|
||||||
self.pkg_ver):
|
self.pkg_ver):
|
||||||
if mas not in self.dependencies:
|
if mas not in self.dependencies:
|
||||||
slackbuilds.append(mas)
|
self.master_packages.append(mas)
|
||||||
version.append(ver)
|
self.pkg_ver.append(ver)
|
||||||
return slackbuilds, version
|
|
||||||
|
|
||||||
def matching(self, sbo_not_found):
|
def matching(self):
|
||||||
'''
|
'''
|
||||||
Return matching SBo
|
Return matching SBo
|
||||||
'''
|
'''
|
||||||
sbo_matching = []
|
|
||||||
f = open(_m.lib_path + "sbo_repo/SLACKBUILDS.TXT", "r")
|
f = open(_m.lib_path + "sbo_repo/SLACKBUILDS.TXT", "r")
|
||||||
SLACKBUILDS_TXT = f.read()
|
SLACKBUILDS_TXT = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
for sbo in sbo_not_found:
|
for sbo in self.package_not_found:
|
||||||
for line in SLACKBUILDS_TXT.splitlines():
|
for line in SLACKBUILDS_TXT.splitlines():
|
||||||
if line.startswith("SLACKBUILD NAME: ") and sbo in line[17:]:
|
if line.startswith("SLACKBUILD NAME: ") and sbo in line[17:]:
|
||||||
sbo_matching.append(line[17:])
|
self.package_found.append(line[17:])
|
||||||
return sbo_matching
|
|
||||||
|
|
||||||
def sbo_version_source(self, slackbuilds):
|
def sbo_version_source(self, slackbuilds):
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Add table
Reference in a new issue