From 2a37b04fcbc67b6eaa7e335720ce8adde80a08e9 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 27 Aug 2014 17:52:29 +0300 Subject: [PATCH] update license, arches --- slpkg/__metadata__.py | 14 ++++++++++- slpkg/slack/install.py | 45 +++++++++++------------------------- slpkg/slack/mirrors.py | 4 ++-- slpkg/slack/patches.py | 35 +++++++++------------------- slpkg/slack/slack_version.py | 4 ++-- 5 files changed, 42 insertions(+), 60 deletions(-) diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py index dec8fc35..0137a9af 100644 --- a/slpkg/__metadata__.py +++ b/slpkg/__metadata__.py @@ -26,7 +26,7 @@ import subprocess __all__ = "slpkg" __author__ = "dslackw" -__version_info__ = (1, 7, 6) +__version_info__ = (1, 7, 7) __version__ = "{0}.{1}.{2}".format(*__version_info__) __license__ = "GNU General Public License v3 (GPLv3)" __email__ = "d.zlatanidis@gmail.com" @@ -67,3 +67,15 @@ elif "arm" in arch: build = "*" sbo_tag = "_SBo" sbo_filetype = ".tgz" + +''' Slackware architectures ''' +slack_archs = ( + "-noarch-", + "-x86_64-", + "-i386-", + "-i486-", + "-i686-", + "-x86-", + "-fw-" + ) + diff --git a/slpkg/slack/install.py b/slpkg/slack/install.py index 73a4b9f1..9a389eb8 100755 --- a/slpkg/slack/install.py +++ b/slpkg/slack/install.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# install.py +# install.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. @@ -29,7 +29,7 @@ import subprocess from colors import colors from url_read import url_read from messages import pkg_not_found, template -from __metadata__ import slpkg_tmp, pkg_path, sp +from __metadata__ import slpkg_tmp, pkg_path, slack_archs from pkg.manager import pkg_upgrade, pkg_reinstall @@ -44,7 +44,7 @@ def install(slack_pkg): dwn_list, comp_size, uncomp_size = [], [], [] install_all, package_name, package_location = [], [], [] tmp_path = slpkg_tmp + "packages/" - pkg_sum = 0 + pkg_sum, arch = 0, "" if not os.path.exists(tmp_path): if not os.path.exists(slpkg_tmp): os.mkdir(slpkg_tmp) @@ -83,41 +83,25 @@ def install(slack_pkg): template(78) print("Installing:") for pkg, comp in zip(install_all, comp_sum): - if "-noarch-" in pkg: - arch = "noarch" - elif "-x86_64-" in pkg: - arch = "x86_64" - elif "-i386-" in pkg: - arch = "i386" - elif "-i486-" in pkg: - arch = "i486" - elif "-i686-" in pkg: - arch = "i686" - elif "-x86-" in pkg: - arch = "x86" - elif "-fw-" in pkg: - arch = "fw" - else: - arch = "" + for archs in slack_archs: + if archs in pkg: + pkgs = pkg.replace(archs, "") + arch = archs[1:-1] if os.path.isfile(pkg_path + pkg[:-4]): pkg_sum += 1 SC, EC = colors.GREEN, colors.ENDC else: SC, EC = colors.RED, colors.ENDC - print " ", SC + pkg[:-5].replace(sp+arch+sp, "") + EC, " "*( - 40-len(pkg[:-5].replace(sp+arch+sp, ""))), arch, " "*( - 7-len(arch)), pkg[-5:-4].replace(sp+arch+sp, ""), " "*( - 6-len(pkg[-5:-4].replace(sp+arch+sp, ""))), "Slack", " ", comp, " "*( + print " ", SC + pkgs[:-5] + EC, " "*(40-len(pkgs[:-5])), arch, " "*( + 7-len(arch)), pkgs[-5:-4], " "*(6-len(pkgs[-5:-4])), "Slack", " ", comp, " "*( 3-len(comp)), "K" comp_unit, uncomp_unit = "Mb", "Mb" compressed = round((sum(map(float, comp_sum)) * 0.0001220703125), 2) uncompressed = round((sum(map(float, uncomp_sum)) * 0.0001220703125), 2) if compressed < 1: - compressed = sum(map(int, comp_sum)) - comp_unit = "Kb" + compressed, comp_unit = sum(map(int, comp_sum)), "Kb" if uncompressed < 1: - uncompressed = sum(map(int, uncomp_sum)) - uncomp_unit = "Kb" + uncompressed, uncomp_unit = sum(map(int, uncomp_sum)), "Kb" msg_pkg = "package" msg_2_pkg = msg_pkg if len(install_all) > 1: @@ -128,7 +112,7 @@ def install(slack_pkg): print("="*79) print("Total {0} {1}.".format(len(install_all), msg_pkg)) print("{0} {1} will be installed, {2} allready installed.".format( - (len(install_all) - pkg_sum), msg_2_pkg, pkg_sum)) + (len(install_all) - pkg_sum), msg_2_pkg, 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.".format( uncompressed, uncomp_unit)) @@ -161,9 +145,8 @@ def install(slack_pkg): print("\nThere are packages in directory {0}\n".format( tmp_path)) else: - bol, eol = "", "\n" message = "No matching" - pkg_not_found(bol, slack_pkg, message, eol) + pkg_not_found("", slack_pkg, message, "\n") except KeyboardInterrupt: print # new line at exit sys.exit() diff --git a/slpkg/slack/mirrors.py b/slpkg/slack/mirrors.py index 38344d30..d36b5441 100755 --- a/slpkg/slack/mirrors.py +++ b/slpkg/slack/mirrors.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# mirrors.py +# mirrors.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. diff --git a/slpkg/slack/patches.py b/slpkg/slack/patches.py index 50d2c8ec..44b1dc86 100755 --- a/slpkg/slack/patches.py +++ b/slpkg/slack/patches.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# patches.py +# patches.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. @@ -29,7 +29,8 @@ import subprocess from colors import colors from url_read import url_read from messages import template -from __metadata__ import pkg_path, slpkg_tmp, sp +from __metadata__ import (pkg_path, slpkg_tmp, + slack_archs) from pkg.manager import pkg_upgrade @@ -83,31 +84,17 @@ def patches(): template(78) print("Upgrading:") for upgrade, size in zip(upgrade_all, comp_sum): - if "-noarch-" in upgrade: - arch = "noarch" - elif "-x86_64-" in upgrade: - arch = "x86_64" - elif "-i386-" in upgrade: - arch = "i386" - elif "-i486-" in upgrade: - arch = "i486" - elif "-i686-" in upgrade: - arch = "i686" - elif "-x86-" in upgrade: - arch = "x86" - elif "-fw-" in upgrade: - arch = "fw" - else: - arch = "" + for archs in slack_archs: + if archs in upgrade: + upg = upgrade.replace(archs, "") + arch = archs[1:-1] if "_slack" in upgrade: slack = "_slack" + slack_ver() else: slack = "" - print " ", upgrade[:-(5+len(slack))].replace( - sp+arch+sp, ""), " "*(40-len(upgrade[:-( - 5+len(slack))].replace(sp+arch+sp, ""))), arch, " "*( - 7-len(arch)), upgrade[-15:-14].replace(sp+arch+sp, ""), " "*( - 6-len(upgrade[-15:-14].replace(sp+arch+sp, ""))), "Slack", " ", size, " "*( + print " ", upg[:-(5+len(slack))], " "*(40-len(upg[:-( + 5+len(slack))])), arch, " "*(7-len(arch)), upg[-15:-14], " "*( + 6-len(upgrade[-15:-14])), "Slack", " ", size, " "*( 3-len(size)), "K" comp_unit, uncomp_unit = "Mb", "Mb" compressed = round((sum(map(float, comp_sum)) * 0.0001220703125), 2) diff --git a/slpkg/slack/slack_version.py b/slpkg/slack/slack_version.py index d34ae76f..9f65c0b7 100755 --- a/slpkg/slack/slack_version.py +++ b/slpkg/slack/slack_version.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# slack_version.py +# slack_version.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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.