diff --git a/.gitignore b/.gitignore
index e3b020ca..3c3f0898 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@ __pycache__
.pipy
*.egg-info/
/slpkg_Build
+.ropeproject/
diff --git a/bin/slpkg b/bin/slpkg
index 24d2b575..5b068213 100755
--- a/bin/slpkg
+++ b/bin/slpkg
@@ -21,16 +21,16 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-'''
- _ _
- ___| |_ __ | | ____ _
+'''
+ _ _
+ ___| |_ __ | | ____ _
/ __| | '_ \| |/ / _` |
\__ \ | |_) | < (_| |
|___/_| .__/|_|\_\__, |
- |_| |___/
+ |_| |___/
Slpkg is a terminal tool in order to easy use
-Slackware packages.It's a quick and easy way
+Slackware packages.It's a quick and easy way
to manage your packages in slackware to a command.
'''
@@ -38,4 +38,3 @@ from slpkg import main
if __name__ == "__main__":
main()
-
diff --git a/setup.py b/setup.py
index 184ae12d..5c0c1b41 100755
--- a/setup.py
+++ b/setup.py
@@ -40,7 +40,7 @@ setup(
version=__version__,
description="Python tool to manage Slackware packages",
keywords=["slackware", "slpkg", "upgrade", "install", "remove",
- "view", "slackpkg", "tool", "build"],
+ "view", "slackpkg", "tool", "build"],
author=__author__,
author_email=__email__,
url="https://github.com/dslackw/slpkg",
@@ -62,7 +62,7 @@ setup(
long_description=open("README.rst").read()
)
-# install man page and blacklist configuration
+# install man page and blacklist configuration
# file if not exists.
if "install" in sys.argv:
man_path = "/usr/man/man8/"
diff --git a/slpkg/blacklist.py b/slpkg/blacklist.py
index f4db251d..2a652c22 100755
--- a/slpkg/blacklist.py
+++ b/slpkg/blacklist.py
@@ -23,11 +23,12 @@
import os
-from colors import *
+from colors import RED, GREEN, ENDC
from __metadata__ import bls_path
class BlackList(object):
+
'''
Blacklist class to add, remove or listed packages
in blacklist file.
@@ -38,37 +39,37 @@ class BlackList(object):
create it by default.
'''
blacklist_conf = [
- "# This is the blacklist file. Each package listed here may not be\n",
- "# installed be upgraded be find or deleted.\n",
- "# NOTE: The settings here affect all repositories.\n",
- "#\n",
- "# An example syntax is as follows:\n",
- "# add a package from SBo repository:\n",
- "# brasero\n",
- "#\n",
- "# Add package from slackware repository:\n",
- "# example add package 'wicd-1.7.2.4-x86_64-4.txz':\n",
- "# wicd\n",
- "#\n",
- "# Sometimes the automatic kernel update creates problems because you\n",
- "# may need to file intervention 'lilo'. The slpkg automatically detects\n",
- "# if the core has been upgraded and running 'lilo'. If you want to avoid\n",
- "# any problems uncomment the lines below.\n",
- "#\n",
- "# kernel-firmware\n",
- "# kernel-generic\n",
- "# kernel-generic-smp\n",
- "# kernel-headers\n",
- "# kernel-huge\n",
- "# kernel-huge-smp\n",
- "# kernel-modules\n",
- "# kernel-modules-smp\n",
- "# kernel-source\n"
- "#\n",
- "#\n",
- "# aaa_elflibs can't be updated.\n",
- "aaa_elflibs\n"
- ]
+ "# This is the blacklist file. Each package listed here may not be\n",
+ "# installed be upgraded be find or deleted.\n",
+ "# NOTE: The settings here affect all repositories.\n",
+ "#\n",
+ "# An example syntax is as follows:\n",
+ "# add a package from SBo repository:\n",
+ "# brasero\n",
+ "#\n",
+ "# Add package from slackware repository:\n",
+ "# example add package 'wicd-1.7.2.4-x86_64-4.txz':\n",
+ "# wicd\n",
+ "#\n",
+ "# Sometimes the automatic kernel update creates problems because you\n",
+ "# may need to file intervention 'lilo'. The slpkg automatically detects\n",
+ "# if the core has been upgraded and running 'lilo'. If you want to avoid\n",
+ "# any problems uncomment the lines below.\n",
+ "#\n",
+ "# kernel-firmware\n",
+ "# kernel-generic\n",
+ "# kernel-generic-smp\n",
+ "# kernel-headers\n",
+ "# kernel-huge\n",
+ "# kernel-huge-smp\n",
+ "# kernel-modules\n",
+ "# kernel-modules-smp\n",
+ "# kernel-source\n"
+ "#\n",
+ "#\n",
+ "# aaa_elflibs can't be updated.\n",
+ "aaa_elflibs\n"
+ ]
self.blackfile = bls_path + "blacklist"
if not os.path.exists(bls_path):
os.mkdir(bls_path)
@@ -77,10 +78,10 @@ class BlackList(object):
for line in blacklist_conf:
conf.write(line)
conf.close()
-
+
def packages(self):
'''
- Return blacklist packages from /etc/slpkg/blacklist
+ Return blacklist packages from /etc/slpkg/blacklist
configuration file.
'''
blacklist = []
@@ -88,7 +89,7 @@ class BlackList(object):
for read in black_conf:
read = read.lstrip()
if not read.startswith("#"):
- blacklist.append(read.replace("\n", ""))
+ blacklist.append(read.replace("\n", ""))
black_conf.close()
return blacklist
@@ -103,7 +104,7 @@ class BlackList(object):
print("{0}{1}{2}".format(GREEN, black, ENDC))
exit = 1
if exit == 1:
- print # new line at exit
+ print # new line at exit
def add(self, pkgs):
'''
@@ -121,7 +122,7 @@ class BlackList(object):
exit = 1
black_conf.close()
if exit == 1:
- print # new line at exit
+ print # new line at exit
def remove(self, pkgs):
'''
@@ -129,7 +130,6 @@ class BlackList(object):
'''
exit = 0
print("\nRemove packages from blacklist:\n")
-
with open(self.blackfile, "r") as black_conf:
lines = black_conf.read()
black_conf.close()
@@ -142,4 +142,4 @@ class BlackList(object):
exit = 1
black_conf.close()
if exit == 1:
- print # new line at exit
+ print # new line at exit
diff --git a/slpkg/checksum.py b/slpkg/checksum.py
index c3c5fe48..561995af 100755
--- a/slpkg/checksum.py
+++ b/slpkg/checksum.py
@@ -23,10 +23,11 @@
import hashlib
+
def md5sum(source):
'''
Calculate the md5 checksum
'''
with open(source) as file_to_check:
- data = file_to_check.read()
+ data = file_to_check.read()
return hashlib.md5(data).hexdigest()
diff --git a/slpkg/colors.py b/slpkg/colors.py
index 9eef7094..3cce2b40 100755
--- a/slpkg/colors.py
+++ b/slpkg/colors.py
@@ -21,6 +21,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+
'''
Foreground colors
'''
diff --git a/slpkg/downloader.py b/slpkg/downloader.py
index 3409804b..0fc9e883 100755
--- a/slpkg/downloader.py
+++ b/slpkg/downloader.py
@@ -21,11 +21,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-import os
import sys
import subprocess
-from colors import *
+from colors import GREEN, ENDC
class Download(object):
@@ -41,10 +40,11 @@ class Download(object):
Check if file already download the skip or continue
download if before stoped.
'''
- print("\n{0}[ Download ] -->{1} {2}\n".format(GREEN, ENDC, self.file_name))
+ print("\n{0}[ Download ] -->{1} {2}\n".format(GREEN, ENDC,
+ self.file_name))
try:
subprocess.call("wget -c -N --directory-prefix={0} {1}".format(
self.path, self.url), shell=True)
except KeyboardInterrupt:
- print # new line at cancel
+ print # new line at cancel
sys.exit()
diff --git a/slpkg/file_size.py b/slpkg/file_size.py
index 1e9fb5da..b0f3ba97 100755
--- a/slpkg/file_size.py
+++ b/slpkg/file_size.py
@@ -30,7 +30,7 @@ class FileSize(object):
def __init__(self, registry):
self.registry = registry
-
+
def server(self):
'''
Returns the size of remote files
@@ -43,7 +43,7 @@ class FileSize(object):
print("\nError: connection refused\n")
sys.exit()
except KeyboardInterrupt:
- print # new line at exit
+ print # new line at cancle
sys.exit()
def local(self):
diff --git a/slpkg/init.py b/slpkg/init.py
index 5022cdb5..e73e2019 100755
--- a/slpkg/init.py
+++ b/slpkg/init.py
@@ -23,10 +23,8 @@
import os
import sys
-import getpass
-from file_size import *
-from messages import s_user
+from file_size import FileSize
from url_read import url_read
from __metadata__ import log_path, lib_path
@@ -35,7 +33,7 @@ from slack.slack_version import slack_ver
def initialization():
'''
- Slpkg initialization, creating directories and SLACKBUILDS.TXT in
+ Slpkg initialization, creating directories and SLACKBUILDS.TXT in
/var/lib/slpkg/sbo_repo/ and ChangeLog.txt in /var/log/slpkg/ from
slackbuilds.org.
'''
@@ -53,14 +51,15 @@ def initialization():
if not os.path.exists(pkg_que):
os.mkdir(pkg_que)
sbo_url = ("http://slackbuilds.org/slackbuilds/{0}/".format(slack_ver()))
- # Read SLACKBUILDS.TXT from slackbuilds.org and write in /var/lib/slpkg/sbo_repo/
- # directory if not exist
+ # Read SLACKBUILDS.TXT from slackbuilds.org and write in
+ # /var/lib/slpkg/sbo_repo directory if not exist
if not os.path.isfile(sbo_lib + "SLACKBUILDS.TXT"):
print("\nslpkg ...initialization")
sys.stdout.write("SLACKBUILDS.TXT read ...")
sys.stdout.flush()
SLACKBUILDS_TXT = url_read((
- "http://slackbuilds.org/slackbuilds/{0}/SLACKBUILDS.TXT".format(slack_ver())))
+ "http://slackbuilds.org/slackbuilds/{0}/SLACKBUILDS.TXT".format(
+ slack_ver())))
sys.stdout.write("Done\n")
with open("{0}SLACKBUILDS.TXT".format(sbo_lib), "w") as sbo:
sbo.write(SLACKBUILDS_TXT)
@@ -73,7 +72,8 @@ def initialization():
sys.stdout.write("ChangeLog.txt read ...")
sys.stdout.flush()
ChangeLog_txt = url_read((
- "http://slackbuilds.org/slackbuilds/{0}/ChangeLog.txt".format(slack_ver())))
+ "http://slackbuilds.org/slackbuilds/{0}/ChangeLog.txt".format(
+ slack_ver())))
sys.stdout.write("Done\n")
with open("{0}ChangeLog.txt".format(sbo_log), "w") as log:
log.write(ChangeLog_txt)
@@ -91,9 +91,11 @@ def initialization():
sys.stdout.write("Files re-created ...")
sys.stdout.flush()
SLACKBUILDS_TXT = url_read((
- "http://slackbuilds.org/slackbuilds/{0}/SLACKBUILDS.TXT".format(slack_ver())))
+ "http://slackbuilds.org/slackbuilds/{0}/SLACKBUILDS.TXT".format(
+ slack_ver())))
ChangeLog_txt = url_read((
- "http://slackbuilds.org/slackbuilds/{0}/ChangeLog.txt".format(slack_ver())))
+ "http://slackbuilds.org/slackbuilds/{0}/ChangeLog.txt".format(
+ slack_ver())))
with open("{0}SLACKBUILDS.TXT".format(sbo_lib), "w") as sbo:
sbo.write(SLACKBUILDS_TXT)
sbo.close()
diff --git a/slpkg/main.py b/slpkg/main.py
index e211d84b..b650a4ac 100755
--- a/slpkg/main.py
+++ b/slpkg/main.py
@@ -24,7 +24,6 @@
import sys
import getpass
-from colors import *
from queue import QueuePkgs
from messages import s_user
from blacklist import BlackList
@@ -32,7 +31,7 @@ from version import prog_version
from __metadata__ import path, __version__
from pkg.build import build_package
-from pkg.manager import PackageManager
+from pkg.manager import PackageManager
from sbo.check import sbo_check
from sbo.views import sbo_network
@@ -44,56 +43,61 @@ from slack.install import install
def main():
- # root privileges required
+
+ # root privileges required
s_user(getpass.getuser())
arguments = [
- "slpkg - version {0}\n".format(__version__),
- "Utility for easy management packages in Slackware\n",
- "Optional arguments:",
- " -h, --help show this help message and exit",
- " -v, --version print version and exit",
- " -a, script [source...] auto build packages",
- " -b, --list, [package...] --add, --remove add, remove packages in blacklist",
- " -q, --list, [package...] --add, --remove add, remove packages in queue",
- " --build, --install, --build-install build or install from queue",
- " -l, all, sbo, slack, noarch list of installed packages",
- " -c, --upgrade --current check for updated packages",
- " -s, --current download, build & install",
- " -f, find installed packages",
- " -t, tracking dependencies from SBo",
- " -n, view packages from SBo",
- " -i, [package...] install binary packages",
- " -u, [package...] upgrade binary packages",
- " -o, [package...] reinstall binary packages",
- " -r, [package...] remove binary packages",
- " -d, [package...] display the contents\n",
- "Repositories:",
- " SlackBuilds = sbo",
- " Slackware = slack '--current'\n",
- ]
+ "slpkg - version {0}\n".format(__version__),
+ "Utility for easy management packages in Slackware\n",
+ "Optional arguments:",
+ " -h, --help show this help message and exit",
+ " -v, --version print version and exit",
+ " -a, script [source...] auto build packages",
+ " -b, --list, [package...] --add, --remove add, remove packages in blacklist",
+ " -q, --list, [package...] --add, --remove add, remove packages in queue",
+ " --build, --install, --build-install build or install from queue",
+ " -l, all, sbo, slack, noarch list of installed packages",
+ " -c, --upgrade --current check for updated packages",
+ " -s, --current download, build & install",
+ " -f, find installed packages",
+ " -t, tracking dependencies from SBo",
+ " -n, view packages from SBo",
+ " -i, [package...] install binary packages",
+ " -u, [package...] upgrade binary packages",
+ " -o, [package...] reinstall binary packages",
+ " -r, [package...] remove binary packages",
+ " -d, [package...] display the contents\n",
+ "Repositories:",
+ " SlackBuilds = sbo",
+ " Slackware = slack '--current'\n",
+ ]
usage = [
- "slpkg - version {0}\n".format(__version__),
- "Usage: slpkg [-h] [-v] [-a script [sources...]]",
- " [-b --list, [...] --add, --remove]",
- " [-q --list, [...] --add, --remove]",
- " [-q --build, --install, --build-install]",
- " [-l all, sbo, slack, noarch]",
- " [-c --upgrade --current]",
- " [-s --current]",
- " [-f] [-t] [-n] [-i [...]] [-u [...]]",
- " [-o [...]] [-r [...]] [-d [...]]\n",
- "For more information try 'slpkg --help'\n"
- ]
+ "slpkg - version {0}\n".format(__version__),
+ "Usage: slpkg [-h] [-v] [-a script [sources...]]",
+ " [-b --list, [...] --add, --remove]",
+ " [-q --list, [...] --add, --remove]",
+ " [-q --build, --install, --build-install]",
+ " [-l all, sbo, slack, noarch]",
+ " [-c --upgrade --current]",
+ " [-s --current]",
+ " [-f] [-t] [-n] [-i [...]] [-u [...]]",
+ " [-o [...]] [-r [...]] [-d [...]]\n",
+ "For more information try 'slpkg --help'\n"
+ ]
args = sys.argv
args.pop(0)
repository = ["sbo", "slack"]
blacklist = BlackList()
queue = QueuePkgs()
if len(args) == 0:
- for opt in usage: print(opt)
- elif len(args) == 1 and args[0] == "-h" or args[0] == "--help" and args[1:] == []:
- for opt in arguments: print(opt)
- elif len(args) == 1 and args[0] == "-v" or args[0] == "--version" and args[1:] == []:
+ for opt in usage:
+ print(opt)
+ elif (len(args) == 1 and args[0] == "-h" or
+ args[0] == "--help" and args[1:] == []):
+ for opt in arguments:
+ print(opt)
+ elif (len(args) == 1 and args[0] == "-v" or
+ args[0] == "--version" and args[1:] == []):
prog_version()
elif len(args) == 3 and args[0] == "-a":
build_package(args[1], args[2:], path)
@@ -102,7 +106,8 @@ def main():
if args[1] in sbo_list:
PackageManager(None).list(args[1])
else:
- for opt in usage: print(opt)
+ for opt in usage:
+ print(opt)
elif len(args) == 3 and args[0] == "-c":
if args[1] == repository[0] and args[2] == "--upgrade":
sbo_check()
@@ -110,46 +115,49 @@ def main():
version = "stable"
patches(version)
else:
- for opt in usage: print(opt)
+ for opt in usage:
+ print(opt)
elif len(args) == 4 and args[0] == "-c":
if args[1] == repository[1] and args[3] == "--current":
version = "current"
- patches(version)
+ patches(version)
else:
- for opt in usage: print(opt)
+ for opt in usage:
+ print(opt)
elif len(args) == 3 and args[0] == "-s":
if args[1] == repository[0]:
sbo_build(args[2])
elif args[1] == repository[1]:
- version = "stable"
- install(args[2], version)
+ version = "stable"
+ install(args[2], version)
elif len(args) == 4 and args[0] == "-s":
if args[1] == repository[1] and args[3] == "--current":
version = "current"
- install(args[2], version)
+ install(args[2], version)
else:
- for opt in usage: print(opt)
+ for opt in usage:
+ print(opt)
elif len(args) == 2 and args[0] == "-t":
track_dep(args[1])
elif len(args) == 2 and args[0] == "-n":
sbo_network(args[1])
elif len(args) == 2 and args[0] == "-b" and args[1] == "--list":
- blacklist.listed()
+ blacklist.listed()
elif len(args) > 2 and args[0] == "-b" and args[-1] == "--add":
blacklist.add(args[1:-1])
elif len(args) > 2 and args[0] == "-b" and args[-1] == "--remove":
blacklist.remove(args[1:-1])
elif len(args) == 2 and args[0] == "-q" and args[1] == "--list":
- queue.listed()
+ queue.listed()
elif len(args) > 2 and args[0] == "-q" and args[-1] == "--add":
queue.add(args[1:-1])
elif len(args) > 2 and args[0] == "-q" and args[-1] == "--remove":
queue.remove(args[1:-1])
- elif len(args) == 2 and args[0] =="-q" and args[1] == "--build":
+ elif len(args) == 2 and args[0] == "-q" and args[1] == "--build":
queue.build()
- elif len(args) == 2 and args[0] =="-q" and args[1] == "--install":
+ elif len(args) == 2 and args[0] == "-q" and args[1] == "--install":
queue.install()
- elif len(args) == 2 and args[0] =="-q" and args[1] == "--build-install":
+ elif len(args) == 2 and args[0] == "-q" and args[1] == "--build-install":
queue.build()
queue.install()
elif len(args) > 1 and args[0] == "-i":
@@ -165,7 +173,8 @@ def main():
elif len(args) > 1 and args[0] == "-d":
PackageManager(args[1:]).display()
else:
- for opt in usage: print(opt)
+ for opt in usage:
+ print(opt)
if __name__ == "__main__":
- main()
+ main()
diff --git a/slpkg/messages.py b/slpkg/messages.py
index 7f3149f5..624720d8 100755
--- a/slpkg/messages.py
+++ b/slpkg/messages.py
@@ -22,8 +22,7 @@
# along with this program. If not, see .
import sys
-from colors import *
-from __metadata__ import __all__
+from colors import RED, GREEN, CYAN, YELLOW, ENDC
def pkg_not_found(bol, pkg, message, eol):
@@ -32,18 +31,21 @@ def pkg_not_found(bol, pkg, message, eol):
'''
print("{0}No such package {1}: {2}{3}".format(bol, pkg, message, eol))
+
def pkg_found(pkg, version):
'''
Print message when package found
'''
print("| Package {0}-{1} is already installed".format(pkg, version))
+
def pkg_installed(pkg):
'''
Print message when package installed
'''
print("| Package {0} installed".format(pkg))
+
def s_user(user):
'''
Check for root user
@@ -52,15 +54,17 @@ def s_user(user):
print("\nslpkg: error: must have root privileges\n")
sys.exit()
+
def build_FAILED(sbo_url, prgnam):
template(78)
print("| Build package {0} [ {1}FAILED{2} ]".format(prgnam, RED, ENDC))
template(78)
- print("| See log file in {0}/var/log/slpkg/sbo/build_logs{1} directory or read README file:".format(
- CYAN, ENDC))
+ print("| See log file in {0}/var/log/slpkg/sbo/build_logs{1} directory or \
+ read README file:".format(CYAN, ENDC))
print("| {0}{1}".format(sbo_url, "README"))
template(78)
- print # new line at end
+ print # new line at end
+
def template(max):
'''
@@ -68,32 +72,35 @@ def template(max):
'''
print("+" + "=" * max)
+
def view_sbo(pkg, sbo_url, sbo_desc, sbo_dwn, source_dwn, sbo_req):
- print # new line at start
+ print # new line at start
template(78)
- print("| {0}Package {1}{2}{3} --> {4}".format(GREEN,
- CYAN, pkg, GREEN, ENDC + sbo_url))
+ print("| {0}Package {1}{2}{3} --> {4}".format(GREEN, CYAN, pkg, GREEN,
+ ENDC + sbo_url))
template(78)
print("| {0}Description : {1}{2}".format(GREEN, ENDC, sbo_desc))
print("| {0}SlackBuild : {1}{2}".format(GREEN, ENDC, sbo_dwn))
print("| {0}Sources : {1}{2}".format(GREEN, ENDC, source_dwn))
- print("| {0}Requirements : {1}{2}".format(YELLOW, ENDC,
- ", ".join(sbo_req)))
+ print("| {0}Requirements : {1}{2}".format(YELLOW, ENDC, ", ".join(sbo_req)))
template(78)
print(" {0}R{1}EADME View the README file".format(RED, ENDC))
- print(" {0}S{1}lackBuild View the SlackBuild file".format(RED, ENDC))
+ print(" {0}S{1}lackBuild View the SlackBuild file".format(
+ RED, ENDC))
print(" In{0}f{1}o View the Info file".format(RED, ENDC))
print(" {0}D{1}ownload Download this package".format(RED, ENDC))
print(" {0}B{1}uild Download and build".format(RED, ENDC))
- print(" {0}I{1}nstall Download/Build/Install".format(RED, ENDC))
+ print(" {0}I{1}nstall Download/Build/Install".format(
+ RED, ENDC))
print(" {0}Q{1}uit Quit\n".format(RED, ENDC))
+
def sbo_packages_view(PKG_COLOR, package, version, ARCH_COLOR, arch):
'''
View slackbuild packages with version and arch
'''
- print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(PKG_COLOR, package, ENDC, \
- " " * (38-len(package)), version, \
- " " * (17-len(version)), ARCH_COLOR, arch, ENDC, \
- " " * (13-len(arch)), "SBo"))
-
+ print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
+ PKG_COLOR, package, ENDC,
+ " " * (38-len(package)), version,
+ " " * (17-len(version)), ARCH_COLOR, arch, ENDC,
+ " " * (13-len(arch)), "SBo"))
diff --git a/slpkg/pkg/build.py b/slpkg/pkg/build.py
index 6edbac6a..138aa0e9 100755
--- a/slpkg/pkg/build.py
+++ b/slpkg/pkg/build.py
@@ -29,9 +29,9 @@ import shutil
import tarfile
import subprocess
-from colors import *
from checksum import md5sum
from __metadata__ import log_path
+from colors import RED, GREEN, ENDC
from messages import pkg_not_found, template
from sbo.greps import SBoGrep
@@ -39,11 +39,11 @@ from sbo.greps import SBoGrep
def build_package(script, sources, path):
'''
- Build package from source and create log
+ Build package from source and create log
file in path /var/log/slpkg/sbo/build_logs/.
Also check md5sum calculates.
'''
- prgnam = script.replace(".tar.gz", "")
+ prgnam = script[:-7] # remove .tar.gz
log_file = ("build_{0}_log".format(prgnam))
sbo_logs = log_path + "sbo/"
build_logs = sbo_logs + "build_logs/"
@@ -86,11 +86,12 @@ def build_package(script, sources, path):
print("| MD5SUM check for {0} [ {1}PASSED{2} ]".format(
src, GREEN, ENDC))
template(78)
- print # new line after pass checksum
- shutil.copy2(src, prgnam)
+ print # new line after pass checksum
+ shutil.copy2(src, prgnam)
os.chdir(path + prgnam)
subprocess.call("chmod +x {0}.SlackBuild".format(prgnam), shell=True)
- with open(build_logs + log_file, "w") as log: # write headers to log file
+ # write headers to log file
+ with open(build_logs + log_file, "w") as log:
log.write(log_line)
log.write("File : " + log_file + "\n")
log.write("Path : " + build_logs + "\n")
@@ -99,8 +100,8 @@ def build_package(script, sources, path):
log.write(log_line)
log.close()
subprocess.Popen("./{0}.SlackBuild 2>&1 | tee -a {1}{2}".format(
- prgnam, build_logs, log_file), \
- shell=True, stdout=sys.stdout).communicate()
+ prgnam, build_logs, log_file),
+ shell=True, stdout=sys.stdout).communicate()
end_log_time = time.strftime("%H:%M:%S")
end_time = time.time()
diff_time = round(end_time - start_time, 2)
@@ -109,14 +110,17 @@ def build_package(script, sources, path):
sum_time = str(diff_time) + " Sec"
elif diff_time > 59.99 and diff_time <= 3599.99:
sum_time = round(diff_time / 60, 2)
- sum_time_list = re.findall(r"\d+", str(sum_time))
- sum_time = ("{0} Min {1} Sec".format(sum_time_list[0], sum_time_list[1]))
+ sum_time_list = re.findall(r"\d+", str(sum_time))
+ sum_time = ("{0} Min {1} Sec".format(sum_time_list[0],
+ sum_time_list[1]))
elif diff_time > 3599.99:
sum_time = round(diff_time / 3600, 2)
- sum_time_list = re.findall(r"\d+", str(sum_time))
- sum_time = ("{0} Hours {1} Min".format(sum_time_list[0], sum_time_list[1]))
- with open(build_logs + log_file, "a") as log: # append END tag to a log file
- log.seek(2) # EOF
+ sum_time_list = re.findall(r"\d+", str(sum_time))
+ sum_time = ("{0} Hours {1} Min".format(sum_time_list[0],
+ sum_time_list[1]))
+ # append END tag to a log file
+ with open(build_logs + log_file, "a") as log:
+ log.seek(2)
log.write(log_line)
log.write("Time : " + end_log_time + "\n")
log.write("Total build time : {0}\n".format(sum_time))
@@ -124,10 +128,11 @@ def build_package(script, sources, path):
log.write(log_line)
log.close()
os.chdir(path)
- print("Total build time for package {0} : {1}\n".format(prgnam, sum_time))
+ print("Total build time for package {0} : {1}\n".format(prgnam,
+ sum_time))
except (OSError, IOError):
message = "Wrong file"
pkg_not_found("\n", prgnam, message, "\n")
except KeyboardInterrupt:
- print # new line at exit
+ print # new line at exit
sys.exit()
diff --git a/slpkg/pkg/find.py b/slpkg/pkg/find.py
index 1c666911..560c257a 100755
--- a/slpkg/pkg/find.py
+++ b/slpkg/pkg/find.py
@@ -35,6 +35,7 @@ def find_package(find_pkg, directory):
pkgs = []
blacklist = BlackList().packages()
for pkg in sorted(os.listdir(directory)):
- if pkg.startswith(find_pkg) and split_package(pkg + ".???")[0] not in blacklist:
+ name = split_package(pkg + ".???")[0]
+ if pkg.startswith(find_pkg) and name not in blacklist:
pkgs.append(pkg)
return pkgs
diff --git a/slpkg/pkg/manager.py b/slpkg/pkg/manager.py
index 106907e5..99f3b200 100755
--- a/slpkg/pkg/manager.py
+++ b/slpkg/pkg/manager.py
@@ -25,9 +25,8 @@ import os
import sys
import subprocess
-from colors import *
-from blacklist import BlackList
from messages import pkg_not_found, template
+from colors import RED, GREEN, CYAN, GREY, ENDC
from __metadata__ import pkg_path, sp, log_path
from find import find_package
@@ -37,9 +36,9 @@ class PackageManager(object):
'''
Package manager class for install, upgrade,
reinstall, remove, find and display packages.
- '''
+ '''
def __init__(self, binary):
- self.binary = binary
+ self.binary = binary
def install(self):
'''
@@ -81,8 +80,9 @@ class PackageManager(object):
'''
for pkg in self.binary:
try:
- print(subprocess.check_output("upgradepkg --reinstall {0}".format(
- pkg), shell=True))
+ print(
+ subprocess.check_output("upgradepkg --reinstall {0}".format(
+ pkg), shell=True))
print("Completed!\n")
except subprocess.CalledProcessError:
message = "Can't reinstall"
@@ -108,22 +108,25 @@ class PackageManager(object):
for pkg in self.binary:
pkgs = find_package(pkg + sp, pkg_path)
if pkgs:
- print(RED + "[ delete ] --> " + ENDC + "\n ".join(pkgs))
+ print("{0}[ delete ]{1} --> {2}".format(RED, ENDC,
+ "\n ".join(pkgs)))
+
removed.append(pkg)
else:
message = "Can't remove"
pkg_not_found("", pkg, message, "")
if removed == []:
- print # new line at end
+ print # new line at end
else:
msg = "package"
if len(removed) > 1:
msg = msg + "s"
try:
- remove_pkg = raw_input("\nAre you sure to remove {0} {1} [Y/n]? ".format(
- str(len(removed)), msg))
+ remove_pkg = raw_input(
+ "\nAre you sure to remove {0} {1} [Y/n]? ".format(
+ str(len(removed)), msg))
except KeyboardInterrupt:
- print # new line at exit
+ print # new line at exit
sys.exit()
if remove_pkg == "y" or remove_pkg == "Y":
for rmv in removed:
@@ -134,40 +137,45 @@ class PackageManager(object):
with open(dep_path + rmv, "r") as f:
dependencies = f.read().split()
f.close()
- print # new line at start
+ print # new line at start
template(78)
- print("| Found dependencies for package {0}:".format(rmv))
+ print("| Found dependencies for package {0}:".format(
+ rmv))
template(78)
- # Prints dependecies before removed except master package
- # because referred as master package
+ # Prints dependecies before removed except master
+ # package because referred as master package
for dep in dependencies[:-1]:
print("| {0}{1}{2}".format(RED, dep, ENDC))
template(78)
try:
remove_dep = raw_input(
- "\nRemove dependencies (maybe used by other packages) [Y/n]? ")
+ "\nRemove dependencies (maybe used by other packages) [Y/n]? ")
except KeyboardInterrupt:
- print # new line at exit
+ print # new line at exit
+
sys.exit()
if remove_dep == "y" or remove_dep == "Y":
for dep in dependencies:
if find_package(dep + sp, pkg_path):
- print(subprocess.check_output("removepkg {0}".format(
- dep), shell=True))
+ print(subprocess.check_output(
+ "removepkg {0}".format(dep),
+ shell=True))
rmv_list.append(dep)
os.remove(dep_path + rmv)
rmv_dependencies += dependencies[:-1]
else:
if find_package(rmv + sp, pkg_path):
- print(subprocess.check_output("removepkg {0}".format(
- rmv), shell=True))
+ print(subprocess.check_output(
+ "removepkg {0}".format(rmv),
+ shell=True))
rmv_list.append(rmv)
f.close()
os.remove(dep_path + rmv)
else:
if find_package(rmv + sp, pkg_path):
- print(subprocess.check_output("removepkg {0}".format(
- rmv), shell=True))
+ print(subprocess.check_output(
+ "removepkg {0}".format(rmv),
+ shell=True))
rmv_list.append(rmv)
# Prints all removed packages
if len(rmv_list) > 1:
@@ -180,7 +188,7 @@ class PackageManager(object):
else:
print("| Package {0} not found".format(pkg))
template(78)
- print # new line at end
+ print # new line at end
def find(self):
'''
@@ -188,23 +196,23 @@ class PackageManager(object):
'''
self.binary = "".join(self.binary)
matching = size = int()
- print("\nInstalled packages with name begin matching [ {0}{1}{2} ]\n".format(
+ print("\nPackages with matching name [ {0}{1}{2} ]\n".format(
CYAN, self.binary, ENDC))
for match in find_package(self.binary, pkg_path):
- if self.binary in match:
- matching += 1
- print("[ {0}installed{1} ] - {2}".format(
- GREEN, ENDC, match))
- with open(pkg_path + match, "r") as f:
- data = f.read()
- f.close()
- for line in data.splitlines():
- if line.startswith("UNCOMPRESSED PACKAGE SIZE:"):
- if "M" in line[26:]:
+ if self.binary in match:
+ matching += 1
+ print("[ {0}installed{1} ] - {2}".format(
+ GREEN, ENDC, match))
+ with open(pkg_path + match, "r") as f:
+ data = f.read()
+ f.close()
+ for line in data.splitlines():
+ if line.startswith("UNCOMPRESSED PACKAGE SIZE:"):
+ if "M" in line[26:]:
size += float(line[26:-1]) * 1024
- else:
+ else:
size += float(line[26:-1])
- break
+ break
if matching == 0:
message = "Can't find"
pkg_not_found("", self.binary, message, "\n")
@@ -223,10 +231,12 @@ class PackageManager(object):
Print the Slackware packages contents
'''
for pkg in self.binary:
- if find_package(pkg + sp, pkg_path):
- print(subprocess.check_output("cat {0}{1}".format(pkg_path,
- " /var/log/packages/".join(find_package(
- pkg + sp, pkg_path))), shell=True))
+ find = find_package(pkg + sp, pkg_path)
+ if find:
+ with open(pkg_path + "".join(find), "r") as package:
+ for line in package:
+ print(line).strip()
+ print # new line per file
else:
message = "Can't dislpay"
if len(self.binary) > 1:
@@ -254,10 +264,11 @@ class PackageManager(object):
index += 1
print("{0}{1}:{2} {3}".format(GREY, index, ENDC, pkg))
if index == page:
- key = raw_input("\nPress [ {0}Enter{1} ] >> Next page ".format(
- CYAN, ENDC))
+ print # new line at start
+ raw_input("Press [ {0}Enter{1} ] >> Next page ".format(
+ CYAN, ENDC))
page += 50
- print # new line at end
+ print # new line at end
except KeyboardInterrupt:
- print # new line at exit
+ print # new line at exit
sys.exit()
diff --git a/slpkg/queue.py b/slpkg/queue.py
index 9f7ecd3d..8fcf95ed 100755
--- a/slpkg/queue.py
+++ b/slpkg/queue.py
@@ -22,10 +22,9 @@
# along with this program. If not, see .
import os
-import sys
-from colors import *
from downloader import Download
+from colors import GREEN, RED, ENDC
from __metadata__ import lib_path, build_path, tmp
from sbo.greps import SBoGrep
@@ -43,10 +42,10 @@ class QueuePkgs(object):
'''
def __init__(self):
queue_file = [
- "# In this file you can create a list of\n",
- "# packages you want to build or install.\n",
- "#\n"
- ]
+ "# In this file you can create a list of\n",
+ "# packages you want to build or install.\n",
+ "#\n"
+ ]
self.queue = lib_path + "queue/"
self.queue_list = self.queue + "queue_list"
if not os.path.exists(lib_path):
@@ -58,10 +57,10 @@ class QueuePkgs(object):
for line in queue_file:
queue.write(line)
queue.close()
-
+
def packages(self):
'''
- Return queue list from /var/lib/queue/queue_list
+ Return queue list from /var/lib/queue/queue_list
file.
'''
queue_list = []
@@ -69,7 +68,7 @@ class QueuePkgs(object):
for read in queue:
read = read.lstrip()
if not read.startswith("#"):
- queue_list.append(read.replace("\n", ""))
+ queue_list.append(read.replace("\n", ""))
queue.close()
return queue_list
@@ -84,7 +83,7 @@ class QueuePkgs(object):
print("{0}{1}{2}".format(GREEN, pkg, ENDC))
exit = 1
if exit == 1:
- print # new line at exit
+ print # new line at exit
def add(self, pkgs):
'''
@@ -106,7 +105,7 @@ class QueuePkgs(object):
exit = 1
queue.close()
if exit == 1:
- print # new line at exit
+ print # new line at exit
def remove(self, pkgs):
'''
@@ -117,7 +116,8 @@ class QueuePkgs(object):
with open(self.queue_list, "r") as queue:
lines = queue.read()
queue.close()
- if pkgs == ["all"]: pkgs = self.packages()
+ if pkgs == ["all"]:
+ pkgs = self.packages()
with open(self.queue_list, "w") as queue:
for line in lines.splitlines():
if line not in pkgs:
@@ -127,7 +127,7 @@ class QueuePkgs(object):
exit = 1
queue.close()
if exit == 1:
- print # new line at exit
+ print # new line at exit
def build(self):
'''
@@ -143,11 +143,11 @@ class QueuePkgs(object):
source_dwn = SBoGrep(pkg).source().split()
sources = []
os.chdir(build_path)
- script = sbo_dwn.split("/")[-1] # get file from script link
+ script = sbo_dwn.split("/")[-1]
Download(build_path, sbo_dwn).start()
for src in source_dwn:
Download(build_path, src).start()
- sources.append(src.split("/")[-1]) # get file from source link
+ sources.append(src.split("/")[-1])
build_package(script, sources, build_path)
else:
print("\nPackages not found in the queue for building\n")
@@ -155,15 +155,15 @@ class QueuePkgs(object):
def install(self):
packages = self.packages()
if packages:
- print # new line at start
+ # new line at start
+ print
for pkg in packages:
# check if package exist in repository
find = find_package(pkg, tmp)
try:
find = max(find)
except ValueError:
- print("Package '{0}' not found in /tmp\n".format(pkg))
- pass
+ print("Package '{0}' not found in /tmp\n".format(pkg))
if pkg in find:
binary = "{0}{1}".format(tmp, find)
PackageManager(binary.split()).install()
diff --git a/slpkg/sbo/check.py b/slpkg/sbo/check.py
index 3b74be18..d99c89e2 100755
--- a/slpkg/sbo/check.py
+++ b/slpkg/sbo/check.py
@@ -28,10 +28,10 @@ from pkg.find import find_package
from pkg.build import build_package
from pkg.manager import PackageManager
-from colors import *
from init import initialization
from downloader import Download
from messages import template, build_FAILED
+from colors import RED, GREEN, GREY, YELLOW, ENDC
from __metadata__ import tmp, pkg_path, build_path, sp
from greps import SBoGrep
@@ -46,15 +46,15 @@ def sbo_check():
repository.
NOTE: This functions check packages by version not by build
tag because build tag not reported the SLACKBUILDS.TXT file,
- but install the package with maximum build tag if find the
+ but install the package with maximum build tag if find the
some version in /tmp directory.
'''
-
+
done = "{0}Done{1}\n".format(GREY, ENDC)
reading_lists = "{0}Reading package lists ...{1}".format(GREY, ENDC)
sys.stdout.write(reading_lists)
sys.stdout.flush()
- init = initialization()
+ initialization()
arches = ["-x86_64-", "-i486-", "-arm-", "-noarch-"]
index, toolbar_width = int(), 3
[
@@ -69,11 +69,11 @@ def sbo_check():
upg_ver,
upg_arch
] = ([] for i in range(10))
- try:
+ try:
for pkg in os.listdir(pkg_path):
if pkg.endswith("_SBo"):
sbo_list.append(pkg)
- if sbo_list:
+ if sbo_list:
for pkg in sbo_list:
index += 1
if index == toolbar_width:
@@ -88,13 +88,14 @@ def sbo_check():
if arch.startswith("i") and arch.endswith("86"):
arch = "i486"
package = pkg[:-(len(arch) + len("_SBo") + 3)]
- pkg_version = package.split("-")[-1]
+ pkg_version = package.split("-")[-1]
name = package[:-(len(pkg_version) + 1)]
if sbo_search_pkg(name):
# search packages if exists in the repository
# and it gets to avoidable modified packages
# from the user with the tag _SBo
- sbo_package = ("{0}-{1}".format(name, SBoGrep(name).version()))
+ sbo_package = ("{0}-{1}".format(name,
+ SBoGrep(name).version()))
if sbo_package > package:
upg_name.append(name)
sys.stdout.write(done)
@@ -103,26 +104,27 @@ def sbo_check():
GREY, ENDC))
sys.stdout.flush()
# Of the packages found to need upgrading,
- # stored in a series such as reading from the
+ # stored in a series such as reading from the
# file .info.
for upg in upg_name:
dependencies = sbo_dependencies_pkg(upg)
- # Because there are dependencies that depend on other
- # dependencies are created lists into other lists.
+ # Because there are dependencies that depend on other
+ # dependencies are created lists into other lists.
# Thus creating this loop create one-dimensional list.
for dep in dependencies:
requires += dep
- requires.reverse() # Inverting the list brings the
- # dependencies in order to be installed.
- # Many packages use the same dependencies, in this loop
- # creates a new list by removing duplicate dependencies but
+ # Inverting the list brings the
+ # dependencies in order to be installed.
+ requires.reverse()
+ # Many packages use the same dependencies, in this loop
+ # creates a new list by removing duplicate dependencies but
# without spoiling the line must be installed.
for duplicate in requires:
if duplicate not in dependencies_list:
dependencies_list.append(duplicate)
- # Last and after the list is created with the correct number
- # of dependencies that must be installed, and add the particular
- # packages that need to be upgraded if they are not already on
+ # Last and after the list is created with the correct number
+ # of dependencies that must be installed, and add the particular
+ # packages that need to be upgraded if they are not already on
# the list in end to list.
for upg in upg_name:
if upg not in dependencies_list:
@@ -132,14 +134,16 @@ def sbo_check():
for pkg in dependencies_list:
ver = SBoGrep(pkg).version()
prgnam = ("{0}-{1}".format(pkg, ver))
- pkg_version = ver # if package not installed
- # take version from repository
+ # if package not installed
+ # take version from repository
+ pkg_version = ver
arch = os.uname()[4]
if arch.startswith("i") and arch.endswith("86"):
arch = "i486"
if find_package(prgnam, pkg_path) == []:
for sbo in os.listdir(pkg_path):
- if sbo.startswith(pkg + sp) and sbo.endswith("_SBo"):
+ if (sbo.startswith(pkg + sp) and
+ sbo.endswith("_SBo")):
# search if packages installed
# if yes grab package name,
# version and arch
@@ -156,8 +160,9 @@ def sbo_check():
if pkg_for_upg:
print("\nThese packages need upgrading:\n")
template(78)
- print("{0}{1}{2}{3}{4}{5}{6}".format("| Package", " " * 30, "New version", \
- " " * 6 , "Arch", " " * 9, "Repository"))
+ print("{0}{1}{2}{3}{4}{5}{6}".format(
+ "| Package", " " * 30, "New version", " " * 6,
+ "Arch", " " * 9, "Repository"))
template(78)
print("Upgrading:")
count_upgraded = count_installed = int()
@@ -168,9 +173,10 @@ def sbo_check():
else:
COLOR = RED
count_installed += 1
- print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(COLOR, upg, ENDC, \
- " " * (38-len(upg)), GREEN, ver, ENDC, \
- " " * (17-len(ver)), arch, " " * (13-len(arch)), "SBo"))
+ print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
+ COLOR, upg, ENDC, " " * (38-len(upg)), GREEN,
+ ver, ENDC, " " * (17-len(ver)), arch,
+ " " * (13-len(arch)), "SBo"))
msg_upg = "package"
msg_ins = msg_upg
if count_upgraded > 1:
@@ -180,7 +186,8 @@ def sbo_check():
print("\nInstalling summary")
print("=" * 79)
print("{0}Total {1} {2} will be upgraded and {3} {4} will be installed.{5}\n".format(
- GREY, count_upgraded, msg_upg, count_installed, msg_ins, ENDC))
+ GREY, count_upgraded, msg_upg,
+ count_installed, msg_ins, ENDC))
read = raw_input("Would you like to upgrade [Y/n]? ")
if read == "Y" or read == "y":
if not os.path.exists(build_path):
@@ -191,15 +198,16 @@ def sbo_check():
sbo_url = sbo_search_pkg(name)
sbo_dwn = sbo_slackbuild_dwn(sbo_url)
src_dwn = SBoGrep(name).source().split()
- script = sbo_dwn.split("/")[-1] # keep file from script link
+ script = sbo_dwn.split("/")[-1]
Download(build_path, sbo_dwn).start()
sources = []
for src in src_dwn:
Download(build_path, src).start()
- sources.append(src.split("/")[-1]) # keep file from source link
+ # keep file from source link
+ sources.append(src.split("/")[-1])
build_package(script, sources, build_path)
- # Searches the package name and version in /tmp to install.
- # If find two or more packages e.g. to build tag
+ # Searches the package name and version in /tmp to
+ # install.If find two or more packages e.g. to build tag
# 2 or 3 will fit most.
binary_list = []
for search in find_package(prgnam, tmp):
@@ -211,32 +219,35 @@ def sbo_check():
build_FAILED(sbo_url, prgnam)
sys.exit()
if find_package(name + sp, pkg_path):
- print("{0}[ Upgrading ] --> {1}{2}".format(GREEN, ENDC, name))
+ print("{0}[ Upgrading ] --> {1}{2}".format(
+ GREEN, ENDC, name))
else:
- print("{0}[ Installing ] --> {1}{2}".format(GREEN, ENDC, name))
- # Use this list to pick out what
+ print("{0}[ Installing ] --> {1}{2}".format(
+ GREEN, ENDC, name))
+ # Use this list to pick out what
# packages will be installed
installed.append(name)
PackageManager(binary).upgrade()
if len(pkg_for_upg) > 1:
template(78)
print("| Total {0} {1} upgraded and {2} {3} installed".format(
- count_upgraded, msg_upg, count_installed, msg_ins))
+ count_upgraded, msg_upg, count_installed, msg_ins))
template(78)
for pkg, upg, ver in zip(pkg_for_upg, upgrade, upg_ver):
upgraded = ("{0}-{1}".format(upg, ver))
if find_package(upgraded, pkg_path):
if upg in installed:
print("| Package {0} installed".format(pkg))
- else:
+ else:
print("| Package {0} upgraded with new package {1}-{2}".format(
pkg, upg, ver))
template(78)
else:
- print("\nTotal {0} SBo packages are up to date\n".format(len(sbo_list)))
+ print("\nTotal {0} SBo packages are up to date\n".format(
+ len(sbo_list)))
else:
sys.stdout.write(done)
print("\nNo SBo packages found\n")
except KeyboardInterrupt:
- print # new line at exit
+ print # new line at exit
sys.exit()
diff --git a/slpkg/sbo/dependency.py b/slpkg/sbo/dependency.py
index fa57baa8..c78e5420 100755
--- a/slpkg/sbo/dependency.py
+++ b/slpkg/sbo/dependency.py
@@ -23,7 +23,7 @@
import sys
-from colors import *
+from colors import GREY, ENDC
from blacklist import BlackList
from greps import SBoGrep
@@ -32,13 +32,14 @@ from search import sbo_search_pkg
dep_results = []
+
def sbo_dependencies_pkg(name):
'''
Build all dependencies of a package
'''
try:
dependencies = []
- blacklist = BlackList().packages()
+ blacklist = BlackList().packages()
sbo_url = sbo_search_pkg(name)
if sbo_url:
requires = SBoGrep(name).requires()
@@ -56,5 +57,5 @@ def sbo_dependencies_pkg(name):
sbo_dependencies_pkg(dep)
return dep_results
except KeyboardInterrupt:
- print # new line at exit
+ print # new line at exit
sys.exit()
diff --git a/slpkg/sbo/greps.py b/slpkg/sbo/greps.py
index 4569acc1..350588ea 100755
--- a/slpkg/sbo/greps.py
+++ b/slpkg/sbo/greps.py
@@ -21,13 +21,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-import os
-
-from url_read import url_read
from __metadata__ import arch, lib_path
-from search import sbo_search_pkg
-
class SBoGrep(object):
'''
@@ -67,8 +62,8 @@ class SBoGrep(object):
if line.startswith(self.line_down):
if sbo_name == self.name:
SLACKBUILDS_TXT.close()
- return line[21:].strip()
-
+ return line[21:].strip()
+
def requires(self):
'''
Grab package requirements
@@ -117,7 +112,7 @@ class SBoGrep(object):
if sbo_name == self.name:
SLACKBUILDS_TXT.close()
return line[19:].strip()
-
+
def description(self):
'''
Grab package verion
diff --git a/slpkg/sbo/read.py b/slpkg/sbo/read.py
index 505af82f..711b2121 100755
--- a/slpkg/sbo/read.py
+++ b/slpkg/sbo/read.py
@@ -21,8 +21,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-import os
-
from url_read import url_read
@@ -32,6 +30,7 @@ def read_readme(sbo_url, sbo_readme):
'''
return url_read(sbo_url + sbo_readme)
+
def read_info_slackbuild(sbo_url, name, sbo_file):
'''
Read info and SlackBuild file
diff --git a/slpkg/sbo/search.py b/slpkg/sbo/search.py
index bc429756..4956b9f2 100755
--- a/slpkg/sbo/search.py
+++ b/slpkg/sbo/search.py
@@ -21,8 +21,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-import os
-import re
import sys
from __metadata__ import lib_path
@@ -37,14 +35,17 @@ def sbo_search_pkg(name):
'''
try:
blacklist = BlackList().packages()
- sbo_url = ("http://slackbuilds.org/slackbuilds/{0}/".format(slack_ver()))
- with open(lib_path + "sbo_repo/SLACKBUILDS.TXT", "r") as SLACKBUILDS_TXT:
+ sbo_url = ("http://slackbuilds.org/slackbuilds/{0}/".format(
+ slack_ver()))
+ with open(lib_path + "sbo_repo/SLACKBUILDS.TXT",
+ "r") as SLACKBUILDS_TXT:
for line in SLACKBUILDS_TXT:
if line.startswith("SLACKBUILD LOCATION"):
- sbo_name = (line[23:].split("/")[-1].replace("\n", "")).strip()
+ sbo_name = (line[23:].split("/")[-1].replace("\n",
+ "")).strip()
if name == sbo_name and name not in blacklist:
SLACKBUILDS_TXT.close()
return (sbo_url + line[23:].strip() + "/")
except KeyboardInterrupt:
- print # new line at exit
+ print # new line at exit
sys.exit()
diff --git a/slpkg/sbo/slackbuild.py b/slpkg/sbo/slackbuild.py
index d0d16729..f4e6b47a 100755
--- a/slpkg/sbo/slackbuild.py
+++ b/slpkg/sbo/slackbuild.py
@@ -24,15 +24,16 @@
import os
import sys
-from colors import *
from init import initialization
-from downloader import Download
-from __metadata__ import (tmp, pkg_path, build_path,
- log_path, lib_path, sp)
+from downloader import Download
+from __metadata__ import (tmp, pkg_path, build_path,
+ log_path, lib_path, sp)
+from colors import RED, GREEN, GREY, YELLOW, CYAN, ENDC
from messages import (pkg_found, template, build_FAILED,
- pkg_not_found, sbo_packages_view)
+ pkg_not_found, sbo_packages_view)
-from pkg.find import find_package
+
+from pkg.find import find_package
from pkg.build import build_package
from pkg.manager import PackageManager
@@ -44,7 +45,7 @@ from dependency import sbo_dependencies_pkg
def sbo_build(name):
'''
- Download, build and install or upgrade packages
+ Download, build and install or upgrade packages
with all dependencies if version is greater than
that established.
'''
@@ -52,7 +53,7 @@ def sbo_build(name):
reading_lists = "{0}Reading package lists ...{1}".format(GREY, ENDC)
sys.stdout.write(reading_lists)
sys.stdout.flush()
- init = initialization()
+ initialization()
[
sbo_ver,
pkg_arch,
@@ -67,7 +68,7 @@ def sbo_build(name):
try:
if dependencies_list is not None or sbo_search_pkg(name) is not None:
pkg_sum = count_upgraded = count_installed = int()
- # Insert master package in list to
+ # Insert master package in list to
# install it after dependencies
requires.append(name)
# Create one list for all packages
@@ -90,7 +91,7 @@ def sbo_build(name):
pkg_sum += 1
sys.stdout.write(done)
# Tag with color green if package already installed,
- # color yellow for packages to upgrade and color red
+ # color yellow for packages to upgrade and color red
# if not installed. Also if package arch is UNSUPPORTED
# tag with color red and if UNTESTED with color yellow.
master_pkg = ("{0}-{1}".format(name, sbo_ver[-1]))
@@ -98,7 +99,7 @@ def sbo_build(name):
PKG_COLOR = GREEN
elif find_package(name + sp, pkg_path):
PKG_COLOR = YELLOW
- count_upgraded += 1
+ count_upgraded += 1
else:
PKG_COLOR = RED
count_installed += 1
@@ -109,14 +110,17 @@ def sbo_build(name):
print("\nThe following packages will be automatically installed or upgraded")
print("with new version:\n")
template(78)
- print("{0}{1}{2}{3}{4}{5}{6}".format("| Package", " " * 30, "Version", \
- " " * 10, "Arch", " " * 9, "Repository"))
+ print("{0}{1}{2}{3}{4}{5}{6}".format(
+ "| Package", " " * 30, "Version",
+ " " * 10, "Arch", " " * 9, "Repository"))
template(78)
print("Installing:")
- sbo_packages_view(PKG_COLOR, name, sbo_ver[-1], ARCH_COLOR, pkg_arch[-1])
+ sbo_packages_view(PKG_COLOR, name, sbo_ver[-1], ARCH_COLOR,
+ pkg_arch[-1])
print("Installing for dependencies:")
- ARCH_COLOR = "" # reset arch color for dependencies packages
- for dep, ver, dep_arch in zip(dependencies[:-1], sbo_ver[:-1], pkg_arch[:-1]):
+ ARCH_COLOR = "" # reset arch color for dependencies packages
+ for dep, ver, dep_arch in zip(dependencies[:-1], sbo_ver[:-1],
+ pkg_arch[:-1]):
dep_pkg = ("{0}-{1}".format(dep, ver))
if find_package(dep_pkg, pkg_path):
DEP_COLOR = GREEN
@@ -168,17 +172,18 @@ def sbo_build(name):
else:
sbo_url = sbo_search_pkg(pkg)
sbo_link = sbo_slackbuild_dwn(sbo_url)
- src_link = SBoGrep(pkg).source().split()
- script = sbo_link.split("/")[-1] # get file from script
+ src_link = SBoGrep(pkg).source().split()
+ script = sbo_link.split("/")[-1]
Download(build_path, sbo_link).start()
sources = []
for src in src_link:
- sources.append(src.split("/")[-1]) # get file from source
+ # get file from source
+ sources.append(src.split("/")[-1])
Download(build_path, src).start()
build_package(script, sources, build_path)
- # Searches the package name and version in /tmp to install.
- # If find two or more packages e.g. to build tag
- # 2 or 3 will fit most.
+ # Searches the package name and version in /tmp to
+ # install. If find two or more packages e.g. to build
+ # tag 2 or 3 will fit most.
binary_list = []
for search in find_package(prgnam, tmp):
if "_SBo" in search:
@@ -209,19 +214,22 @@ def sbo_build(name):
installed = ("{0}-{1}".format(pkg, ver))
if find_package(installed, pkg_path):
if pkg in upgraded:
- print("| Package {0} upgraded successfully".format(installed))
+ print("| Package {0} upgraded successfully".format(
+ installed))
else:
- print("| Package {0} installed successfully".format(installed))
+ print("| Package {0} installed successfully".format(
+ installed))
else:
- print("| Package {0} NOT installed".format(installed))
+ print("| Package {0} NOT installed".format(
+ installed))
template(78)
- # Write dependencies in a log file
+ # Write dependencies in a log file
# into directory `/var/log/slpkg/dep/`
if find_package(name + sp, pkg_path):
dep_path = log_path + "dep/"
if not os.path.exists(dep_path):
os.mkdir(dep_path)
- if os.path.isfile(dep_path + name):
+ if os.path.isfile(dep_path + name):
os.remove(dep_path + name)
if len(dependencies) > 1:
with open(dep_path + name, "w") as f:
@@ -232,7 +240,8 @@ def sbo_build(name):
ins = uns = int()
sbo_matching = []
index, toolbar_width = int(), 3
- with open(lib_path + "sbo_repo/SLACKBUILDS.TXT", "r") as SLACKBUILDS_TXT:
+ with open(lib_path + "sbo_repo/SLACKBUILDS.TXT",
+ "r") as SLACKBUILDS_TXT:
for line in SLACKBUILDS_TXT:
if line.startswith("SLACKBUILD NAME: "):
sbo_name = line[17:].strip()
@@ -252,8 +261,9 @@ def sbo_build(name):
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
CYAN, name, ENDC))
template(78)
- print("{0}{1}{2}{3}{4}{5}{6}".format("| Package", " " * 30, "Version", \
- " " * 10, "Arch", " " * 9, "Repository"))
+ print("{0}{1}{2}{3}{4}{5}{6}".format(
+ "| Package", " " * 30, "Version",
+ " " * 10, "Arch", " " * 9, "Repository"))
template(78)
print("Matching:")
ARCH_COLOR = str()
@@ -281,9 +291,10 @@ def sbo_build(name):
message = "No matching"
pkg_not_found("\n", name, message, "\n")
except KeyboardInterrupt:
- print # new line at exit
+ print # new line at exit
sys.exit()
+
def select_arch(src):
'''
Looks if sources unsupported or untested
diff --git a/slpkg/sbo/tracking.py b/slpkg/sbo/tracking.py
index 5e2a2573..c422624a 100755
--- a/slpkg/sbo/tracking.py
+++ b/slpkg/sbo/tracking.py
@@ -23,10 +23,10 @@
import sys
-from colors import *
from messages import template
from init import initialization
from __metadata__ import pkg_path, sp
+from colors import RED, GREEN, GREY, YELLOW, CYAN, ENDC
from dependency import sbo_dependencies_pkg
@@ -36,7 +36,7 @@ from pkg.find import find_package
def track_dep(name):
'''
View tree of dependencies and also
- highlight packages with color green
+ highlight packages with color green
if allready installed and color red
if not installed.
'''
@@ -44,7 +44,7 @@ def track_dep(name):
reading_lists = "{0}Reading package lists ...{1}".format(GREY, ENDC)
sys.stdout.write(reading_lists)
sys.stdout.flush()
- init = initialization()
+ initialization()
dependencies_list = sbo_dependencies_pkg(name)
if dependencies_list is not None:
sys.stdout.write(done)
@@ -60,7 +60,7 @@ def track_dep(name):
if dependencies == []:
dependencies = ["No dependencies"]
pkg_len = len(name) + 24
- print # new line at start
+ print # new line at start
template(pkg_len)
print("| Package {0}{1}{2} dependencies :".format(CYAN, name, ENDC))
template(pkg_len)
@@ -71,11 +71,12 @@ def track_dep(name):
index += 1
if find_package(pkg + sp, pkg_path):
print(" |")
- print(" {0}{1}: {2}{3}{4}".format("+--", index, GREEN, pkg, ENDC))
+ print(" {0}{1}: {2}{3}{4}".format("+--", index, GREEN, pkg,
+ ENDC))
else:
print(" |")
print(" {0}{1}: {2}{3}{4}".format("+--", index, RED, pkg, ENDC))
- print # new line at end
+ print # new line at end
else:
sys.stdout.write(done)
print("\nNo package was found to match\n")
diff --git a/slpkg/sbo/views.py b/slpkg/sbo/views.py
index 1351bf2f..1e0648b5 100755
--- a/slpkg/sbo/views.py
+++ b/slpkg/sbo/views.py
@@ -25,33 +25,33 @@ import os
import sys
import pydoc
-from colors import *
+from colors import RED, GREEN, GREY, ENDC
from init import initialization
from downloader import Download
from __metadata__ import tmp, build_path, pkg_path, sp
-from messages import (pkg_found, view_sbo, pkg_not_found,
- template, build_FAILED)
+from messages import (pkg_found, view_sbo, pkg_not_found,
+ template, build_FAILED)
from pkg.build import build_package
from pkg.find import find_package
from pkg.manager import PackageManager
-from read import *
-from greps import SBoGrep
+from greps import SBoGrep
from search import sbo_search_pkg
from download import sbo_slackbuild_dwn
+from read import read_readme, read_info_slackbuild
def sbo_network(name):
'''
- View SlackBuild package, read or install them
+ View SlackBuild package, read or install them
from slackbuilds.org
'''
done = "{0}Done{1}\n".format(GREY, ENDC)
reading_lists = "{0}Reading package lists ...{1}".format(GREY, ENDC)
sys.stdout.write(reading_lists)
sys.stdout.flush()
- init = initialization()
+ initialization()
sbo_url = sbo_search_pkg(name)
if sbo_url:
sbo_desc = SBoGrep(name).description()[len(name) + 2:-1]
@@ -59,8 +59,8 @@ def sbo_network(name):
sbo_dwn = sbo_slackbuild_dwn(sbo_url)
source_dwn = SBoGrep(name).source().split()
sys.stdout.write(done)
- view_sbo(name, sbo_url, sbo_desc, sbo_dwn.split("/")[-1], \
- ", ".join([src.split("/")[-1] for src in source_dwn]), \
+ view_sbo(name, sbo_url, sbo_desc, sbo_dwn.split("/")[-1],
+ ", ".join([src.split("/")[-1] for src in source_dwn]),
sbo_req)
# Check if package supported by arch
# before proceed to install
@@ -72,7 +72,7 @@ def sbo_network(name):
try:
read = raw_input(" {0}Choose an option: {1}".format(GREY, ENDC))
except KeyboardInterrupt:
- print # new line at exit
+ print # new line at exit
break
if read == "D" or read == "d":
path = ""
@@ -97,11 +97,11 @@ def sbo_network(name):
os.mkdir(build_path)
sources = []
os.chdir(build_path)
- script = sbo_dwn.split("/")[-1] # get file from script link
+ script = sbo_dwn.split("/")[-1]
Download(build_path, sbo_dwn).start()
for src in source_dwn:
Download(build_path, src).start()
- sources.append(src.split("/")[-1]) # get file from source link
+ sources.append(src.split("/")[-1])
build_package(script, sources, build_path)
break
elif read == "I" or read == "i":
@@ -116,13 +116,13 @@ def sbo_network(name):
sources = []
os.chdir(build_path)
Download(build_path, sbo_dwn).start()
- script = sbo_dwn.split("/")[-1] # get file from script link
+ script = sbo_dwn.split("/")[-1]
for src in source_dwn:
Download(build_path, src).start()
- sources.append(src.split("/")[-1]) # get file from source link
- build_package(script, sources, build_path)
+ sources.append(src.split("/")[-1])
+ build_package(script, sources, build_path)
# Searches the package name and version in /tmp to install.
- # If find two or more packages e.g. to build tag
+ # If find two or more packages e.g. to build tag
# 2 or 3 will fit most.
binary_list = []
for search in find_package(prgnam, tmp):
@@ -133,7 +133,8 @@ def sbo_network(name):
except ValueError:
build_FAILED(sbo_url, prgnam)
sys.exit()
- print("{0}[ Installing ] --> {1} {2}".format(GREEN, ENDC, name))
+ print("{0}[ Installing ] --> {1} {2}".format(GREEN, ENDC,
+ name))
PackageManager(binary).upgrade()
break
else:
diff --git a/slpkg/slack/install.py b/slpkg/slack/install.py
index f65ae2f2..810dd67a 100755
--- a/slpkg/slack/install.py
+++ b/slpkg/slack/install.py
@@ -25,12 +25,12 @@ import os
import sys
import time
-from colors import *
from url_read import url_read
from downloader import Download
from blacklist import BlackList
from messages import pkg_not_found, template
-from __metadata__ import slpkg_tmp, pkg_path, slack_archs
+from __metadata__ import slpkg_tmp, pkg_path
+from colors import RED, GREEN, CYAN, YELLOW, GREY, ENDC
from pkg.find import find_package
from pkg.manager import PackageManager
@@ -49,7 +49,8 @@ def install(slack_pkg, version):
[
comp_sum,
uncomp_sum,
- names, dwn_list,
+ names,
+ dwn_list,
comp_size,
uncomp_size,
install_all,
@@ -65,7 +66,7 @@ def install(slack_pkg, version):
if not os.path.exists(tmp_path):
os.mkdir(tmp_path)
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
- CYAN, slack_pkg, ENDC))
+ CYAN, slack_pkg, ENDC))
sys.stdout.write(reading_lists)
sys.stdout.flush()
blacklist = BlackList().packages()
@@ -89,9 +90,11 @@ def install(slack_pkg, version):
comp_size.append(line[28:-2].strip())
if line.startswith("PACKAGE SIZE (uncompressed): "):
uncomp_size.append(line[30:-2].strip())
- for loc, name, comp, uncomp in zip(package_location, package_name, comp_size, uncomp_size):
+ for loc, name, comp, uncomp in zip(package_location, package_name,
+ comp_size, uncomp_size):
if slack_pkg in name and slack_pkg not in blacklist:
- dwn_list.append("{0}{1}/{2}".format(mirrors("","", version), loc, name))
+ dwn_list.append("{0}{1}/{2}".format(mirrors("", "", version),
+ loc, name))
install_all.append(name)
comp_sum.append(comp)
uncomp_sum.append(uncomp)
@@ -99,8 +102,12 @@ def install(slack_pkg, version):
if install_all:
template(78)
print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
- "| Package", " " * 17, "Version", " " * 12, "Arch", " " * 4, \
- "Build", " " * 2, "Repos", " " * 10, "Size"))
+ "| Package", " " * 17,
+ "Version", " " * 12,
+ "Arch", " " * 4,
+ "Build", " " * 2,
+ "Repos", " " * 10,
+ "Size"))
template(78)
print("Installing:")
for pkg, comp in zip(install_all, comp_sum):
@@ -120,12 +127,12 @@ def install(slack_pkg, version):
COLOR = RED
uni_sum += 1
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11:>12}{12}".format(
- COLOR, name, ENDC, \
- " " * (25-len(name)), ver, \
- " " * (19-len(ver)), arch, \
- " " * (8-len(arch)), build, \
- " " * (7-len(build)), "Slack", \
- comp, " K"))
+ COLOR, name, ENDC,
+ " " * (25-len(name)), ver,
+ " " * (19-len(ver)), arch,
+ " " * (8-len(arch)), build,
+ " " * (7-len(build)), "Slack",
+ comp, " K"))
comp_unit = uncomp_unit = "Mb"
compressed = round((sum(map(float, comp_sum)) / 1024), 2)
uncompressed = round((sum(map(float, uncomp_sum)) / 1024), 2)
@@ -151,8 +158,9 @@ def install(slack_pkg, version):
print("=" * 79)
print("{0}Total {1} {2}.".format(GREY, len(install_all), msg_pkg))
print("{0} {1} will be installed, {2} will be upgraded and {3} will be resettled.".format(
- uni_sum, msg_2_pkg, upg_sum, pkg_sum))
- print("Need to get {0} {1} of archives.".format(compressed, comp_unit))
+ uni_sum, msg_2_pkg, upg_sum, pkg_sum))
+ print("Need to get {0} {1} of archives.".format(compressed,
+ comp_unit))
print("After this process, {0} {1} of additional disk space will be used.{2}".format(
uncompressed, uncomp_unit, ENDC))
read = raw_input("\nWould you like to install [Y/n]? ")
@@ -182,12 +190,14 @@ def install(slack_pkg, version):
if os.listdir(tmp_path) == []:
print("Packages removed")
else:
- print("\nThere are packages in directory {0}\n".format(tmp_path))
+ print("\nThere are packages in directory {0}\n".format(
+ tmp_path))
else:
- print("\nThere are packages in directory {0}\n".format(tmp_path))
+ print("\nThere are packages in directory {0}\n".format(
+ tmp_path))
else:
message = "No matching"
pkg_not_found("\n", slack_pkg, message, "\n")
except KeyboardInterrupt:
- print # new line at exit
+ print # new line at exit
sys.exit()
diff --git a/slpkg/slack/mirrors.py b/slpkg/slack/mirrors.py
index 5f2e21aa..2887a009 100755
--- a/slpkg/slack/mirrors.py
+++ b/slpkg/slack/mirrors.py
@@ -34,7 +34,7 @@ def mirrors(name, location, version):
if version == "stable":
http = "http://mirrors.slackware.com/slackware/slackware64-{0}/{1}{2}".format(
slack_ver(), location, name)
- else:
+ else:
http = "http://mirrors.slackware.com/slackware/slackware64-{0}/{1}{2}".format(
version, location, name)
else:
diff --git a/slpkg/slack/patches.py b/slpkg/slack/patches.py
index 152821bc..560e48fe 100755
--- a/slpkg/slack/patches.py
+++ b/slpkg/slack/patches.py
@@ -26,7 +26,7 @@ import sys
import time
import subprocess
-from colors import *
+from colors import GREEN, GREY, YELLOW, ENDC
from url_read import url_read
from messages import template
from downloader import Download
@@ -55,7 +55,7 @@ def patches(version):
uncomp_size,
upgrade_all,
package_name,
- package_location
+ package_location
] = ([] for i in range(8))
slack_arch = str()
patch_path = slpkg_tmp + "patches/"
@@ -63,7 +63,7 @@ def patches(version):
os.mkdir(slpkg_tmp)
if not os.path.exists(patch_path):
os.mkdir(patch_path)
- sys.stdout.write (reading_lists)
+ sys.stdout.write(reading_lists)
sys.stdout.flush()
blacklist = BlackList().packages()
if version == "stable":
@@ -81,38 +81,41 @@ def patches(version):
toolbar_width += step
time.sleep(0.05)
if line.startswith("PACKAGE NAME"):
- package_name.append(line[15:].strip())
+ package_name.append(line[15:].strip())
if line.startswith("PACKAGE LOCATION"):
- package_location.append(line[21:].strip())
+ package_location.append(line[21:].strip())
if line.startswith("PACKAGE SIZE (compressed): "):
comp_size.append(line[28:-2].strip())
if line.startswith("PACKAGE SIZE (uncompressed): "):
uncomp_size.append(line[30:-2].strip())
- if version == "stable": # stables versions upgrade
- for loc, name, comp, uncomp in zip(package_location, package_name, \
+ if version == "stable": # stables versions upgrade
+ for loc, name, comp, uncomp in zip(package_location, package_name,
comp_size, uncomp_size):
- if not os.path.isfile(pkg_path + name[:-4]) and split_package(
- name)[0] not in blacklist:
- dwn_patches.append("{0}{1}/{2}".format(mirrors("","", version), loc, name))
+ if (not os.path.isfile(pkg_path + name[:-4]) and split_package(
+ name)[0] not in blacklist):
+ dwn_patches.append("{0}{1}/{2}".format(
+ mirrors("", "", version), loc, name))
comp_sum.append(comp)
uncomp_sum.append(uncomp)
upgrade_all.append(name)
- else: # current version upgrade
+ else: # current version upgrade
installed = []
# get all installed packages and store the package name.
for pkg in os.listdir(pkg_path):
installed.append(split_package(pkg + ".???")[0])
- for loc, name, comp, uncomp in zip(package_location, package_name, \
+ for loc, name, comp, uncomp in zip(package_location, package_name,
comp_size, uncomp_size):
# If the package from the current repository is installed
- # (check with the name) but not is in the path (check with all package
- # like 'apr-1.5.0-x86_64-1') then add to list for upgrade.
- # etc. 'apr' in list 'installed' ?? if yes 'apr-1.5.0-x86_64-1' exist
- # in /var/log/packages ?? if no add to upgrade.
+ # (check with the name) but not is in the path (check with
+ # all package like 'apr-1.5.0-x86_64-1') then add to list for
+ # upgrade.
+ # etc. 'apr' in list 'installed' ?? if yes 'apr-1.5.0-x86_64-1'
+ # exist in /var/log/packages ?? if no add to upgrade.
if split_package(name)[0] in installed:
- if not os.path.isfile(pkg_path + name[:-4]) and split_package(
- name)[0] not in blacklist:
- dwn_patches.append("{0}{1}/{2}".format(mirrors("","", version), loc, name))
+ if (not os.path.isfile(pkg_path + name[:-4]) and
+ split_package(name)[0] not in blacklist):
+ dwn_patches.append("{0}{1}/{2}".format(
+ mirrors("", "", version), loc, name))
comp_sum.append(comp)
uncomp_sum.append(uncomp)
upgrade_all.append(name)
@@ -121,8 +124,12 @@ def patches(version):
print("\nThese packages need upgrading:\n")
template(78)
print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
- "| Package", " " * 17, "Version", " " * 12, "Arch", " " * 4, \
- "Build", " " * 2, "Repos", " " * 10, "Size"))
+ "| Package", " " * 17,
+ "Version", " " * 12,
+ "Arch", " " * 4,
+ "Build", " " * 2,
+ "Repos", " " * 10,
+ "Size"))
template(78)
print("Upgrading:")
for upgrade, size in zip(upgrade_all, comp_sum):
@@ -132,12 +139,12 @@ def patches(version):
arch = pkg_split[2]
build = pkg_split[3]
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11:>12}{12}".format(
- YELLOW, name, ENDC, \
- " " * (25-len(name)), ver, \
- " " * (19-len(ver)), arch, \
- " " * (8-len(arch)), build, \
- " " * (7-len(build)), "Slack", \
- size, " K"))
+ YELLOW, name, ENDC,
+ " " * (25-len(name)), ver,
+ " " * (19-len(ver)), arch,
+ " " * (8-len(arch)), build,
+ " " * (7-len(build)), "Slack",
+ size, " K"))
comp_unit = uncomp_unit = "Mb"
compressed = round((sum(map(float, comp_sum)) / 1024), 2)
uncompressed = round((sum(map(float, uncomp_sum)) / 1024), 2)
@@ -158,8 +165,11 @@ def patches(version):
msg_pkg = msg_pkg + "s"
print("\nInstalling summary")
print("=" * 79)
- print("{0}Total {1} {2} will be upgraded.".format(GREY, len(upgrade_all), msg_pkg))
- print("Need to get {0} {1} of archives.".format(compressed, comp_unit))
+ print("{0}Total {1} {2} will be upgraded.".format(GREY,
+ len(upgrade_all),
+ msg_pkg))
+ print("Need to get {0} {1} of archives.".format(compressed,
+ comp_unit))
print("After this process, {0} {1} of additional disk space will be used.{2}".format(
uncompressed, uncomp_unit, ENDC))
read = raw_input("\nWould you like to upgrade [Y/n]? ")
@@ -168,7 +178,8 @@ def patches(version):
Download(patch_path, dwn).start()
Download(patch_path, dwn + ".asc").start()
for pkg in upgrade_all:
- print("{0}[ upgrading ] --> {1}{2}".format(GREEN, ENDC, pkg[:-4]))
+ print("{0}[ upgrading ] --> {1}{2}".format(GREEN, ENDC,
+ pkg[:-4]))
PackageManager((patch_path + pkg).split()).upgrade()
for kernel in upgrade_all:
if "kernel" in kernel:
@@ -183,14 +194,17 @@ def patches(version):
if os.listdir(patch_path) == []:
print("Packages removed")
else:
- print("\nThere are packages in direcrory {0}\n".format(patch_path))
+ print("\nThere are packages in direcrory {0}\n".format(
+ patch_path))
else:
- print("\nThere are packages in directory {0}\n".format(patch_path))
+ print("\nThere are packages in directory {0}\n".format(
+ patch_path))
else:
if os.uname()[4] == "x86_64":
slack_arch = 64
- print("\nSlackware{0} '{1}' v{2} distribution is up to date\n".format(
- slack_arch, version, slack_ver()))
+ print(
+ "\nSlackware{0} '{1}' v{2} distribution is up to date\n".format(
+ slack_arch, version, slack_ver()))
except KeyboardInterrupt:
- print # new line at exit
+ print # new line at exit
sys.exit()
diff --git a/slpkg/slack/splitting.py b/slpkg/slack/splitting.py
index 87293b2b..984453f7 100755
--- a/slpkg/slack/splitting.py
+++ b/slpkg/slack/splitting.py
@@ -38,7 +38,7 @@ def split_package(package):
if "_slack" in package:
slack = "_slack" + slack_ver()
pkg = package[:-(len(slack) + 4)]
- build = pkg.split("-")[-1]
+ build = pkg.split("-")[-1]
pkg_ver = pkg[:-(len(arch) + len(build))]
ver = pkg_ver.split("-")[-1]
name = pkg_ver[:-(len(ver) + 1)]
diff --git a/slpkg/url_read.py b/slpkg/url_read.py
index f612540b..2c2fbf7f 100755
--- a/slpkg/url_read.py
+++ b/slpkg/url_read.py
@@ -36,5 +36,5 @@ def url_read(link):
print ("\nslpkg: error: connection refused\n")
sys.exit()
except KeyboardInterrupt:
- print # new line at exit
+ print # new line at exit
sys.exit()