mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-16 03:41:11 +01:00
fix if..else
This commit is contained in:
parent
beaf7a8270
commit
3f036e3231
1 changed files with 50 additions and 45 deletions
|
@ -25,14 +25,13 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from pkg.find import find_package
|
|
||||||
from pkg.build import build_package
|
from pkg.build import build_package
|
||||||
from pkg.manager import pkg_upgrade
|
from pkg.manager import pkg_upgrade
|
||||||
|
|
||||||
from colors import colors
|
from colors import colors
|
||||||
from functions import get_file
|
from functions import get_file
|
||||||
from messages import pkg_not_found, template
|
from messages import template
|
||||||
from __metadata__ import tmp, pkg_path, sp
|
from __metadata__ import tmp, pkg_path
|
||||||
from __metadata__ import sbo_arch, sbo_tag, sbo_filetype, build_path
|
from __metadata__ import sbo_arch, sbo_tag, sbo_filetype, build_path
|
||||||
|
|
||||||
from search import sbo_search_pkg
|
from search import sbo_search_pkg
|
||||||
|
@ -48,9 +47,12 @@ def sbo_check():
|
||||||
sys.stdout.write("Reading package lists ...")
|
sys.stdout.write("Reading package lists ...")
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
index, toolbar_width = 0, 3
|
index, toolbar_width = 0, 3
|
||||||
pkg_name, sbo_ver, pkg_for_upg = [], [], []
|
pkg_name, sbo_ver, pkg_for_upg, sbo_list = [], [], [], []
|
||||||
for pkg in os.listdir(pkg_path):
|
for pkg in os.listdir(pkg_path):
|
||||||
if "_SBo" in pkg:
|
if "_SBo" in pkg:
|
||||||
|
sbo_list.append(pkg)
|
||||||
|
if sbo_list:
|
||||||
|
for pkg in sbo_list:
|
||||||
index += 1
|
index += 1
|
||||||
if index == toolbar_width:
|
if index == toolbar_width:
|
||||||
sys.stdout.write(".")
|
sys.stdout.write(".")
|
||||||
|
@ -74,48 +76,51 @@ def sbo_check():
|
||||||
pkg_name.append(name)
|
pkg_name.append(name)
|
||||||
pkg_for_upg.append(name + "-" + pkg_version)
|
pkg_for_upg.append(name + "-" + pkg_version)
|
||||||
sbo_ver.append(sbo_version)
|
sbo_ver.append(sbo_version)
|
||||||
sys.stdout.write("Done\n")
|
sys.stdout.write("Done\n")
|
||||||
if pkg_for_upg:
|
if pkg_for_upg:
|
||||||
print("\nThese packages need upgrading:\n")
|
print("\nThese packages need upgrading:\n")
|
||||||
template(78)
|
template(78)
|
||||||
print "| Package", " "*27, "New version", " "*5, "Arch", " "*7, "Repository"
|
print "| Package", " "*27, "New version", " "*5, "Arch", " "*7, "Repository"
|
||||||
template(78)
|
template(78)
|
||||||
print("Upgrading:")
|
print("Upgrading:")
|
||||||
for upg, ver in zip(pkg_for_upg, sbo_ver):
|
for upg, ver in zip(pkg_for_upg, sbo_ver):
|
||||||
print " ", upg, " "*(34-len(upg)), ver, " "*(
|
print " ", upg, " "*(34-len(upg)), ver, " "*(
|
||||||
16-len(ver)), arch, " "*(11-len(arch)), "SBo"
|
16-len(ver)), arch, " "*(11-len(arch)), "SBo"
|
||||||
msg_pkg = "package"
|
msg_pkg = "package"
|
||||||
if len(pkg_for_upg) > 1:
|
if len(pkg_for_upg) > 1:
|
||||||
msg_pkg = msg_pkg + "s"
|
msg_pkg = msg_pkg + "s"
|
||||||
print("\nInstalling summary")
|
print("\nInstalling summary")
|
||||||
print("=" * 79)
|
print("=" * 79)
|
||||||
print("Total {0} {1} will be upgraded.\n".format(len(pkg_for_upg), msg_pkg))
|
print("Total {0} {1} will be upgraded.\n".format(len(pkg_for_upg), msg_pkg))
|
||||||
read = raw_input("Would you like to upgrade [Y/n]? ")
|
read = raw_input("Would you like to upgrade [Y/n]? ")
|
||||||
if read == "Y" or read == "y":
|
if read == "Y" or read == "y":
|
||||||
if not os.path.exists(build_path):
|
if not os.path.exists(build_path):
|
||||||
os.mkdir(build_path)
|
os.mkdir(build_path)
|
||||||
os.chdir(build_path)
|
os.chdir(build_path)
|
||||||
for name, version in zip(pkg_name, sbo_ver):
|
for name, version in zip(pkg_name, sbo_ver):
|
||||||
pkg_for_install = ("{0}-{1}".format(name, version))
|
pkg_for_install = ("{0}-{1}".format(name, version))
|
||||||
sbo_url = sbo_search_pkg(name)
|
sbo_url = sbo_search_pkg(name)
|
||||||
sbo_dwn = sbo_slackbuild_dwn(sbo_url, name)
|
sbo_dwn = sbo_slackbuild_dwn(sbo_url, name)
|
||||||
src_dwn = sbo_source_dwn(name).split()
|
src_dwn = sbo_source_dwn(name).split()
|
||||||
script = get_file(sbo_dwn, "/")
|
script = get_file(sbo_dwn, "/")
|
||||||
print("\n{0}Start -->{1} {2}\n".format(colors.GREEN, colors.ENDC, name))
|
print("\n{0}Start -->{1} {2}\n".format(colors.GREEN, colors.ENDC, name))
|
||||||
subprocess.call("wget -N {0}".format(sbo_dwn), shell=True)
|
subprocess.call("wget -N {0}".format(sbo_dwn), shell=True)
|
||||||
sources = []
|
sources = []
|
||||||
for src in src_dwn:
|
for src in src_dwn:
|
||||||
subprocess.call("wget -N {0}".format(src), shell=True)
|
subprocess.call("wget -N {0}".format(src), shell=True)
|
||||||
sources.append(get_file(src, "/"))
|
sources.append(get_file(src, "/"))
|
||||||
build_package(script, sources, build_path)
|
build_package(script, sources, build_path)
|
||||||
binary = ("{0}{1}{2}{3}{4}".format(
|
binary = ("{0}{1}{2}{3}{4}".format(
|
||||||
tmp, pkg_for_install, sbo_arch, sbo_tag, sbo_filetype).split())
|
tmp, pkg_for_install, sbo_arch, sbo_tag, sbo_filetype).split())
|
||||||
print("{0}[ Upgrading ] --> {1}{2}".format(
|
print("{0}[ Upgrading ] --> {1}{2}".format(
|
||||||
colors.GREEN, colors.ENDC, name))
|
colors.GREEN, colors.ENDC, name))
|
||||||
pkg_upgrade(binary)
|
pkg_upgrade(binary)
|
||||||
print("Completed!\n")
|
print("Completed!\n")
|
||||||
|
else:
|
||||||
|
print("\nAll SBo packages are up to date\n")
|
||||||
else:
|
else:
|
||||||
print("\nAll packages are up to date\n")
|
print("\nNo SBo packages found\n")
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print # new line at exit
|
print # new line at exit
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
Loading…
Reference in a new issue