From 9133dd9f7d26767f220f711808de328e2c284a26 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Tue, 18 Nov 2014 07:24:49 +0200 Subject: [PATCH] update code, fix repos --- TESTING | 15 +++++ slpkg/__metadata__.py | 92 +++---------------------- slpkg/arguments.py | 35 +++++----- slpkg/config.py | 124 ++++++++++++++++++++++++++++++++++ slpkg/init.py | 4 +- slpkg/main.py | 9 +++ slpkg/others/check.py | 23 ++++--- slpkg/others/dependency.py | 4 +- slpkg/others/greps.py | 134 +++++++++++++++++++++++-------------- slpkg/others/search.py | 2 +- slpkg/pkg/build.py | 2 +- slpkg/pkg/manager.py | 18 ++--- slpkg/sbo/check.py | 2 +- slpkg/sbo/search.py | 2 +- slpkg/sbo/slackbuild.py | 2 +- slpkg/sbo/views.py | 4 +- slpkg/slack/greps.py | 4 +- slpkg/slack/install.py | 6 +- slpkg/slack/patches.py | 2 +- slpkg/tracking.py | 9 ++- 20 files changed, 303 insertions(+), 190 deletions(-) create mode 100644 TESTING create mode 100755 slpkg/config.py diff --git a/TESTING b/TESTING new file mode 100644 index 00000000..378a6f85 --- /dev/null +++ b/TESTING @@ -0,0 +1,15 @@ +Slpkg testing log: + +The majority of trials have been made in an environment Slackware x86_64 and x86 stable version +14.1. +Is logical tests are always to be latest versions of the distribution. +Slpkg are supported version 'current' but it is minimal tests have been done on this release. + + +TEST: + +Distribution : Slackware Linux +Release : 14.1 +Version : stable +Arch : x86, x86_64 + diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py index 293776ed..92a1b6fa 100644 --- a/slpkg/__metadata__.py +++ b/slpkg/__metadata__.py @@ -23,9 +23,12 @@ import os +from config import slpkg_conf + + __all__ = "slpkg" __author__ = "dslackw" -__version_info__ = (2, 0, 4) +__version_info__ = (2, 0, 5) __version__ = "{0}.{1}.{2}".format(*__version_info__) __license__ = "GNU General Public License v3 (GPLv3)" __email__ = "d.zlatanidis@gmail.com" @@ -34,59 +37,8 @@ __email__ = "d.zlatanidis@gmail.com" # temponary path tmp = "/tmp/" -if not os.path.exists("/etc/slpkg"): - os.mkdir("/etc/slpkg") - -slpkg_conf = [ - "# Configuration file for slpkg\n", - "\n", - "# slpkg.conf file is part of slpkg.\n", - "\n", - "# Copyright 2014 Dimitris Zlatanidis \n", - "# All rights reserved.\n", - "\n", - "# Utility for easy management packages in Slackware\n", - "\n", - "# https://github.com/dslackw/slpkg\n", - "\n", - "# Slpkg is free software: you can redistribute it and/or modify\n", - "# it under the terms of the GNU General Public License as published by\n", - "# the Free Software Foundation, either version 3 of the License, or\n", - "# (at your option) any later version.\n", - "# This program is distributed in the hope that it will be useful,\n", - "# but WITHOUT ANY WARRANTY; without even the implied warranty of\n", - "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n", - "# GNU General Public License for more details.\n", - "# You should have received a copy of the GNU General Public License\n", - "# along with this program. If not, see .\n", - "\n", - "# Slackware version 'stable' or 'current'.\n", - "VERSION=stable\n", - "\n", - "# Build directory for repository slackbuilds.org. In this directory\n", - "# downloaded sources and scripts for building.\n", - "BUILD=/tmp/slpkg/build/\n", - "\n", - "# If SBO_CHECK_MD5 is 'on' the system will check all downloaded\n", - "# sources from SBo repository.\n", - "SBO_CHECK_MD5=on\n", - "\n", - "# Download directory for others repositories that use binaries files\n", - "# for installation.\n", - "PACKAGES=/tmp/slpkg/packages/\n", - "\n", - "# Download directory for Slackware patches file.\n", - "PATCHES=/tmp/slpkg/patches/\n", - "\n", - "# Delete all downloaded files if DEL_ALL is 'on'.\n", - "DEL_ALL=on\n", - "\n", - "# Delete build directory after each process if DEL_BUILD is 'on'.\n", - "DEL_BUILD=off\n", - "\n", - "# Keep build log file if SBO_BUILD_LOG is 'on'.\n", - "SBO_BUILD_LOG=on\n" -] +if not os.path.exists("/etc/slpkg/"): + os.mkdir("/etc/slpkg/") if not os.path.isfile("/etc/slpkg/slpkg.conf"): with open("/etc/slpkg/slpkg.conf", "w") as conf: @@ -112,6 +64,8 @@ for line in conf.splitlines(): line = line.lstrip() if line.startswith("VERSION"): slack_rel = line[8:].strip() + if not slack_rel: + slack_rel = "stable" if line.startswith("BUILD"): build_path = line[6:].strip() if line.startswith("PACKAGES"): @@ -127,36 +81,6 @@ for line in conf.splitlines(): if line.startswith("SBO_BUILD_LOG"): sbo_build_log = line[14:].strip() -if not slack_rel or slack_rel not in ['stable', 'current']: - slack_rel = "stable" - -if not build_path: - build_path = "/tmp/slpkg/build/" -elif not build_path.endswith("/"): - build_path = build_path + "/" - -if not slpkg_tmp_packages: - slpkg_tmp_packages = tmp + "slpkg/packages/" -elif not slpkg_tmp_packages.endswith("/"): - slpkg_tmp_packages = slpkg_tmp_packages + "/" - -if not slpkg_tmp_patches: - slpkg_tmp_patches = tmp + "slpkg/patches/" -elif not slpkg_tmp_patches.endswith("/"): - slpkg_tmp_patches = slpkg_tmp_patches + "/" - -if not del_all or del_all not in ['on', 'off']: - del_all = "on" - -if not del_build or del_build not in ['on', 'off']: - del_build = "off" - -if not sbo_check_md5 or sbo_check_md5 not in ['on', 'off']: - sbo_check_md5 = "on" - -if not sbo_build_log or sbo_build_log not in ['on', 'off']: - sbo_build_log = "on" - # repositories repositories = [ "sbo", diff --git a/slpkg/arguments.py b/slpkg/arguments.py index b8ec05a2..1b399d33 100755 --- a/slpkg/arguments.py +++ b/slpkg/arguments.py @@ -27,7 +27,7 @@ from __metadata__ import __version__ def options(): arguments = [ - "slpkg - version {0}\n".format(__version__), + "\nslpkg - version {0}\n".format(__version__), "Utility for easy management packages in Slackware\n", "Optional arguments:", " -h, --help show this help message " + @@ -36,32 +36,28 @@ def options(): " -a, script.tar.gz [source...] auto build SBo 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", + " -q, --list, [package...] --add, --remove add, remove SBo packages " + "in queue", + " --build, --install, --build-install build or install packages " + "from queue", + " -g, --config, --config= configuration file " + + "management", " -l, , all, noarch list of installed " + "packages", " -c, --upgrade check for updated " + "packages", - " -s, download, build & install", - " -t, tracking dependencies", - " -p, --color= print package description", - " red, green, yellow, cyan, grey colors support", - " -f, find installed packages", - " -n, view packages from SBo", + " -s, [package] download, build & install", + " -t, [package] tracking dependencies", + " -p, [package] --color=[] print package description", + " -f, [package] find installed packages", + " -n, [package] 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", - "Note: '-q' options is working only for SBo repository\n", - "Repositories:", - " Slackware = slack", - " Alien = alien", - " SlackBuilds = sbo", - " Slacky = slacky", - " Robby's = rlw\n" + "Repositories: ", + "Colors = [red, green, yellow, cyan, grey]\n", ] for opt in arguments: print(opt) @@ -74,6 +70,7 @@ def usage(): " [-b --list, [...] --add, --remove]", " [-q --list, [...] --add, --remove]", " [ --build, --install, --build-install]", + " [-g --config, --config=]", " [-l , all, noarch]", " [-c --upgrade]", " [-s ]", @@ -81,7 +78,7 @@ def usage(): " [-p --color=]", " [ red, green, yellow, cyan, grey]", " [-f] [-n] [-i [...]] [-u [...]]", - " [-o [...]] [-r [...]] [-d [...]]\n", + " [-o [...]] [-r [...]] [-d [...]]\n" "For more information try 'slpkg --help'\n" ] for usg in view: diff --git a/slpkg/config.py b/slpkg/config.py new file mode 100755 index 00000000..dbafc35c --- /dev/null +++ b/slpkg/config.py @@ -0,0 +1,124 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# config.py file is part of slpkg. + +# Copyright 2014 Dimitris Zlatanidis +# All rights reserved. + +# Utility for easy management packages in Slackware + +# https://github.com/dslackw/slpkg + +# Slpkg is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import os +import subprocess + +from colors import CYAN, ENDC + +slpkg_conf = [ + "# Configuration file for slpkg\n", + "\n", + "# slpkg.conf file is part of slpkg.\n", + "\n", + "# Copyright 2014 Dimitris Zlatanidis \n", + "# All rights reserved.\n", + "\n", + "# Utility for easy management packages in Slackware\n", + "\n", + "# https://github.com/dslackw/slpkg\n", + "\n", + "# Slpkg is free software: you can redistribute it and/or modify\n", + "# it under the terms of the GNU General Public License as published by\n", + "# the Free Software Foundation, either version 3 of the License, or\n", + "# (at your option) any later version.\n", + "# This program is distributed in the hope that it will be useful,\n", + "# but WITHOUT ANY WARRANTY; without even the implied warranty of\n", + "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n", + "# GNU General Public License for more details.\n", + "# You should have received a copy of the GNU General Public License\n", + "# along with this program. If not, see .\n", + "\n", + "# Slackware version 'stable' or 'current'.\n", + "VERSION=stable\n", + "\n", + "# Build directory for repository slackbuilds.org. In this directory\n", + "# downloaded sources and scripts for building.\n", + "BUILD=/tmp/slpkg/build/\n", + "\n", + "# If SBO_CHECK_MD5 is 'on' the system will check all downloaded\n", + "# sources from SBo repository.\n", + "SBO_CHECK_MD5=on\n", + "\n", + "# Download directory for others repositories that use binaries files\n", + "# for installation.\n", + "PACKAGES=/tmp/slpkg/packages/\n", + "\n", + "# Download directory for Slackware patches file.\n", + "PATCHES=/tmp/slpkg/patches/\n", + "\n", + "# Delete all downloaded files if DEL_ALL is 'on'.\n", + "DEL_ALL=on\n", + "\n", + "# Delete build directory after each process if DEL_BUILD is 'on'.\n", + "DEL_BUILD=off\n", + "\n", + "# Keep build log file if SBO_BUILD_LOG is 'on'.\n", + "SBO_BUILD_LOG=on\n" +] + +if not os.path.exists("/etc/slpkg"): + os.mkdir("/etc/slpkg") +if not os.path.isfile("/etc/slpkg/slpkg.conf"): + with open("/etc/slpkg/slpkg.conf", "w") as conf: + for line in slpkg_conf: + conf.write(line) + conf.close() + + +class Config(object): + + def __init__(self): + self.config_file = "/etc/slpkg/slpkg.conf" + + def view(self): + ''' + View slpkg config file + ''' + print("") + conf_args = [ + 'VERSION', + 'BUILD', + 'SBO_CHECK_MD5', + 'PACKAGES', + 'PATCHES', + 'DEL_ALL', + 'DEL_BUILD', + 'SBO_BUILD_LOG' + ] + f = open(self.config_file, "r") + read_conf = f.read() + f.close() + for line in read_conf.splitlines(): + if not line.startswith("#") and line.split("=")[0] in conf_args: + print(line) + else: + print("{0}{1}{2}".format(CYAN, line, ENDC)) + print("") + + def edit(self, editor): + ''' + Edit configuration file + ''' + subprocess.call("{0} {1}".format(editor, self.config_file), + shell=True) diff --git a/slpkg/init.py b/slpkg/init.py index 87421bfa..9a55f8bb 100755 --- a/slpkg/init.py +++ b/slpkg/init.py @@ -37,8 +37,8 @@ from slack.slack_version import slack_ver class Initialization(object): def __init__(self): - if not os.path.exists("/etc/slpkg"): - os.mkdir("/etc/slpkg") + if not os.path.exists("/etc/slpkg/"): + os.mkdir("/etc/slpkg/") if not os.path.exists(log_path): os.mkdir(log_path) if not os.path.exists(lib_path): diff --git a/slpkg/main.py b/slpkg/main.py index d7eb6e05..bba59da1 100755 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -25,6 +25,7 @@ import sys import getpass from desc import PkgDesc +from config import Config from queue import QueuePkgs from messages import s_user from tracking import track_dep @@ -178,6 +179,14 @@ def main(): usage() elif len(args) > 1 and args[0] == "-d": PackageManager(args[1:]).display() + elif len(args) == 2 and args[0] == "-g" and args[1].startswith("--config"): + editor = args[1][len("--config="):] + if args[1] == "--config": + Config().view() + elif editor: + Config().edit(editor) + else: + usage() else: usage() diff --git a/slpkg/others/check.py b/slpkg/others/check.py index 1145cf73..5f152afb 100755 --- a/slpkg/others/check.py +++ b/slpkg/others/check.py @@ -31,8 +31,11 @@ from blacklist import BlackList from init import Initialization from splitting import split_package from colors import YELLOW, GREY, ENDC -from __metadata__ import (pkg_path, lib_path, - slpkg_tmp_packages) +from __metadata__ import ( + pkg_path, + lib_path, + slpkg_tmp_packages +) from pkg.manager import PackageManager @@ -92,12 +95,12 @@ class OthersUpgrade(object): try: dwn_links, upgrade_all, comp_sum, uncomp_sum = self.store() sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC)) - print # new line at start + print("") # new line at start if upgrade_all: template(78) print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format( "| Package", " " * 17, - "Version", " " * 12, + "New version", " " * 8, "Arch", " " * 4, "Build", " " * 2, "Repos", " " * 10, @@ -119,12 +122,13 @@ class OthersUpgrade(object): if read in ['Y', 'y']: upgrade_all.reverse() packages_dwn(self.tmp_path, dwn_links) - upgrade(upgrade_all) + upgrade(self.tmp_path, upgrade_all) delete(self.tmp_path, upgrade_all) else: - print("There are no packages for upgrade\n") + print("No new updates in the repository '{0}'\n".format( + self.repo)) except KeyboardInterrupt: - print # new line at exit + print("") # new line at exit sys.exit() def store(self): @@ -205,10 +209,11 @@ def msgs(upgrade_all): return msg_pkg -def upgrade(upgrade_all): +def upgrade(tmp_path, upgrade_all): ''' Install or upgrade packages ''' for pkg in upgrade_all: + package = (tmp_path + pkg).split() print("[ {0}upgrading{1} ] --> {2}".format(YELLOW, ENDC, pkg[:-4])) - PackageManager(pkg).upgrade() + PackageManager(package).upgrade() diff --git a/slpkg/others/dependency.py b/slpkg/others/dependency.py index e2e66752..fee2c883 100755 --- a/slpkg/others/dependency.py +++ b/slpkg/others/dependency.py @@ -25,7 +25,7 @@ import sys from toolbar import status -from greps import repo_requires +from greps import Requires dep_results = [] @@ -36,7 +36,7 @@ def dependencies_pkg(name, repo): ''' try: dependencies = [] - requires = repo_requires(name, repo) + requires = Requires(name, repo).get_deps() toolbar_width, index = 2, 0 if requires: for req in requires: diff --git a/slpkg/others/greps.py b/slpkg/others/greps.py index 89ad1c54..024f9da5 100755 --- a/slpkg/others/greps.py +++ b/slpkg/others/greps.py @@ -26,7 +26,7 @@ import os from toolbar import status from __metadata__ import lib_path from splitting import split_package - +from init import Initialization from slack.slack_version import slack_ver @@ -103,56 +103,88 @@ def alien_filter(name, location, size, unsize, version): return [fname, flocation, fsize, funsize] -def repo_requires(name, repo): - ''' - Grap package requirements from repositories - ''' - if repo in ["alien", "slacky"]: - lib = { - 'alien': lib_path + "alien_repo/PACKAGES.TXT", - 'slacky': lib_path + "slacky_repo/PACKAGES.TXT" - } - f = open(lib[repo], "r") - PACKAGES_TXT = f.read() +class Requires(object): + + def __init__(self, name, repo): + self.name = name + self.repo = repo + if not os.path.isfile(lib_path + "slack_repo/PACKAGES.TXT"): + Initialization().slack() + lib = lib_path + "slack_repo/PACKAGES.TXT" + f = open(lib, "r") + self.SLACK_PACKAGES_TXT = f.read() f.close() - for line in PACKAGES_TXT.splitlines(): - if line.startswith("PACKAGE NAME: "): - pkg = line[14:].strip() - pkg_name = split_package(pkg)[0] - if line.startswith("PACKAGE REQUIRED: "): - if pkg_name == name: - if repo == "slacky": - return slacky_req_fix(line) - else: - return line[18:].strip().split(",") - elif repo == "rlw": - # Robby's repository dependencies as shown in the central page - # http://rlworkman.net/pkgs/ - dependencies = { - "abiword": "wv", - "claws-mail": "libetpan bogofilter html2ps", - "inkscape": "gtkmm atkmm pangomm cairomm mm-common libsigc++ " - "libwpg lxml gsl numpy BeautifulSoup", - "texlive": "libsigsegv texi2html", - "xfburn": "libburn libisofs" - } - if name in dependencies.keys(): - return dependencies[name].split() - else: - return "" + def get_deps(self): + ''' + Grap package requirements from repositories + ''' + if self.repo in ["alien", "slacky"]: + lib = { + 'alien': lib_path + "alien_repo/PACKAGES.TXT", + 'slacky': lib_path + "slacky_repo/PACKAGES.TXT" + } + f = open(lib[self.repo], "r") + PACKAGES_TXT = f.read() + f.close() + for line in PACKAGES_TXT.splitlines(): + if line.startswith("PACKAGE NAME: "): + pkg = line[14:].strip() + pkg_name = split_package(pkg)[0] + if line.startswith("PACKAGE REQUIRED: "): + if pkg_name == self.name: + if line[17:].strip(): + if self.repo == "slacky": + return self.slacky_req_fix(line) -def slacky_req_fix(line): - ''' - Fix slacky requirements because more dependencies splitting - with ',' and others with '|' - ''' - slacky_deps = [] - for dep in line[18:].strip().split(","): - dep = dep.split("|") - if len(dep) > 1: - for d in dep: - slacky_deps.append(d.split()[0]) - dep = "".join(dep) - slacky_deps.append(dep.split()[0]) - return slacky_deps + else: + return line[18:].strip().split(",") + elif self.repo == "rlw": + # Robby's repository dependencies as shown in the central page + # http://rlworkman.net/pkgs/ + dependencies = { + "abiword": "wv", + "claws-mail": "libetpan bogofilter html2ps", + "inkscape": "gtkmm atkmm pangomm cairomm mm-common libsigc++ " + "libwpg lxml gsl numpy BeautifulSoup", + "texlive": "libsigsegv texi2html", + "xfburn": "libburn libisofs" + } + if self.name in dependencies.keys(): + return dependencies[self.name].split() + else: + return "" + + def slacky_req_fix(self, line): + ''' + Fix slacky requirements because many dependencies splitting + with ',' and others with '|' + ''' + slacky_deps = [] + for dep in line[18:].strip().split(","): + dep = dep.split("|") + if len(dep) > 1: + for d in dep: + slacky_deps.append(d.split()[0]) + dep = "".join(dep) + slacky_deps.append(dep.split()[0]) + slacky_deps = self.remove_slack_deps(slacky_deps) + return slacky_deps + + def remove_slack_deps(self, dependencies): + ''' + Because the repository slacky mentioned packages and dependencies + that exist in the distribution Slackware, this feature is intended + to remove them and return only those needed. + ''' + name, slacky_deps = [], [] + index, toolbar_width, step = 0, 700, 1800 + for line in self.SLACK_PACKAGES_TXT.splitlines(): + index += 1 + toolbar_width = status(index, toolbar_width, step) + if line.startswith("PACKAGE NAME:"): + name.append("-".join(line[15:].split("-")[:-3])) + for deps in dependencies: + if deps not in name: + slacky_deps.append(deps) + return slacky_deps diff --git a/slpkg/others/search.py b/slpkg/others/search.py index e6248df7..4ca6e940 100755 --- a/slpkg/others/search.py +++ b/slpkg/others/search.py @@ -48,5 +48,5 @@ def search_pkg(name, repo): PACKAGES_TXT.close() return pkg_name except KeyboardInterrupt: - print # new line at exit + print("") # new line at exit sys.exit() diff --git a/slpkg/pkg/build.py b/slpkg/pkg/build.py index 3923aae0..700d1d11 100755 --- a/slpkg/pkg/build.py +++ b/slpkg/pkg/build.py @@ -32,7 +32,7 @@ import subprocess from checksum import md5sum from colors import RED, GREEN, ENDC from messages import pkg_not_found, template -from __metadata__ import log_path, sbo_check_md5, sbo_build_log +from __metadata__ import log_path, sbo_build_log, sbo_check_md5 from sbo.greps import SBoGrep diff --git a/slpkg/pkg/manager.py b/slpkg/pkg/manager.py index bb541ec1..a94b76d8 100755 --- a/slpkg/pkg/manager.py +++ b/slpkg/pkg/manager.py @@ -93,7 +93,7 @@ class PackageManager(object): dependencies, rmv_list = [], [] removed = self.view_removed(self.binary) if not removed: - print # new line at end + print("") # new line at end else: msg = "package" if len(removed) > 1: @@ -103,7 +103,7 @@ class PackageManager(object): "\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 in ['y', 'Y']: for rmv in removed: @@ -117,7 +117,7 @@ class PackageManager(object): "\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 in ['y', 'Y']: rmv_list += self.rmv_deps(self.binary, @@ -157,7 +157,7 @@ class PackageManager(object): with open(path + package, "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(package)) template(78) @@ -205,7 +205,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): ''' @@ -253,7 +253,7 @@ class PackageManager(object): with open(pkg_path + "".join(find), "r") as package: for line in package: print(line).strip() - print # new line per file + print("") # new line per file else: message = "Can't dislpay" if len(self.binary) > 1: @@ -292,9 +292,9 @@ class PackageManager(object): "continue... ".format(CYAN, ENDC)) if read in ['Q', 'q']: break - print # new line after page + print("") # new line after page page += row - 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/sbo/check.py b/slpkg/sbo/check.py index da45d429..83c5e24a 100755 --- a/slpkg/sbo/check.py +++ b/slpkg/sbo/check.py @@ -124,7 +124,7 @@ class SBoCheck(object): sys.stdout.write(self.done) print("\nNo SBo packages found\n") except KeyboardInterrupt: - print # new line at exit + print("") # new line at exit sys.exit() def sbo_list(self): diff --git a/slpkg/sbo/search.py b/slpkg/sbo/search.py index a78d0a58..67377d3d 100755 --- a/slpkg/sbo/search.py +++ b/slpkg/sbo/search.py @@ -48,5 +48,5 @@ def sbo_search_pkg(name): 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 9409da77..02844870 100755 --- a/slpkg/sbo/slackbuild.py +++ b/slpkg/sbo/slackbuild.py @@ -145,7 +145,7 @@ class SBoInstall(object): else: pkg_not_found("\n", self.name, "No matching", "\n") except KeyboardInterrupt: - print # new line at exit + print("") # new line at exit sys.exit() def one_for_all(self): diff --git a/slpkg/sbo/views.py b/slpkg/sbo/views.py index 71f8fbe3..feb6568a 100755 --- a/slpkg/sbo/views.py +++ b/slpkg/sbo/views.py @@ -116,7 +116,7 @@ class SBoNetwork(object): ''' View slackbuild.org ''' - print # new line at start + print("") # new line at start template(78) print("| {0}Package {1}{2}{3} --> {4}".format(GREEN, CYAN, args[0], GREEN, ENDC + args[1])) @@ -163,7 +163,7 @@ class SBoNetwork(object): try: choice = raw_input(" {0}Choose an option: {1}".format(GREY, ENDC)) except KeyboardInterrupt: - print # new line at exit + print("") # new line at exit sys.exit() return choice diff --git a/slpkg/slack/greps.py b/slpkg/slack/greps.py index 886c9356..0f15aa50 100755 --- a/slpkg/slack/greps.py +++ b/slpkg/slack/greps.py @@ -33,9 +33,9 @@ def slack_data(PACKAGES_TXT, step): for line in PACKAGES_TXT.splitlines(): index += 1 toolbar_width = status(index, toolbar_width, step) - if line.startswith("PACKAGE NAME"): + if line.startswith("PACKAGE NAME:"): name.append(line[15:].strip()) - if line.startswith("PACKAGE LOCATION"): + if line.startswith("PACKAGE LOCATION:"): location.append(line[21:].strip()) if line.startswith("PACKAGE SIZE (compressed): "): size.append(line[28:-2].strip()) diff --git a/slpkg/slack/install.py b/slpkg/slack/install.py index fa4dd6bb..120ee22e 100755 --- a/slpkg/slack/install.py +++ b/slpkg/slack/install.py @@ -26,11 +26,11 @@ import sys from sizes import units from blacklist import BlackList +from init import Initialization from splitting import split_package from messages import pkg_not_found, template -from __metadata__ import pkg_path, lib_path, slpkg_tmp_packages -from init import Initialization from colors import RED, GREEN, CYAN, YELLOW, GREY, ENDC +from __metadata__ import pkg_path, lib_path, slpkg_tmp_packages from pkg.find import find_package from pkg.manager import PackageManager @@ -98,7 +98,7 @@ class Slack(object): else: pkg_not_found("", self.slack_pkg, "No matching", "\n") except KeyboardInterrupt: - print # new line at exit + print("") # new line at exit sys.exit() def store(self): diff --git a/slpkg/slack/patches.py b/slpkg/slack/patches.py index 33cb0b79..dac12c78 100755 --- a/slpkg/slack/patches.py +++ b/slpkg/slack/patches.py @@ -100,7 +100,7 @@ class Patches(object): print("\nSlackware{0} '{1}' v{2} distribution is up to " "date\n".format(slack_arch, self.version, slack_ver())) except KeyboardInterrupt: - print # new line at exit + print("") # new line at exit sys.exit() def store(self): diff --git a/slpkg/tracking.py b/slpkg/tracking.py index e7b19e66..4260b93b 100755 --- a/slpkg/tracking.py +++ b/slpkg/tracking.py @@ -44,7 +44,14 @@ def track_dep(name, repo): if allready installed and color red if not installed. ''' - Initialization().sbo() + init_repos = { + 'sbo': Initialization().sbo, + 'slack': Initialization().slack, + 'rlw': Initialization().rlw, + 'alien': Initialization().alien, + 'slacky': Initialization().slacky + } + init_repos[repo]() sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC)) sys.stdout.flush() if repo == "sbo":