diff --git a/CHANGELOG b/CHANGELOG
index dc860e6f..6d28b229 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,8 @@
+Version 2.0.8
+24-11-2014
+
+[Updated] - Add more options in slpkg configuration file.
+
Version 2.0.7
22-11-2014
diff --git a/INSTALL b/INSTALL
index 5812fa58..b6cb2413 100644
--- a/INSTALL
+++ b/INSTALL
@@ -11,7 +11,7 @@ slpkg works on Slackware distribution.
Install slpkg
-------------
-There are mainly five ways:
+There are mainly 3 ways:
1) Download latest slpkg version from https://github.com/dslackw/slpkg/releases
Untar or unzip the archive, cd in slpkg-?.?.? directory.
diff --git a/README.rst b/README.rst
index c84d0155..80239579 100644
--- a/README.rst
+++ b/README.rst
@@ -102,7 +102,7 @@ Tutorial
--------
.. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/screenshot-1.png
- :target: https://asciinema.org/a/12667
+ :target: https://asciinema.org/a/14145
Installation
@@ -121,12 +121,27 @@ From SourceForge:
Download binary package from `SourceForge `_
Upgrade
--------------
+-------
-In each upgrade should track the configuration files in the file '/etc/slpkg' for
+In each slpkg upgrade should track the configuration files in the file '/etc/slpkg' for
new updates.
+Configuration files
+-------------------
+
+.. code-block:: bash
+
+ /etc/slpkg/slpkg.conf
+ General configuration of slpkg
+
+ /etc/slpkg/blacklist
+ List of packages to skip
+
+ /etc/slpkg/slackware-mirrors
+ List of Slackware Mirrors
+
+
Slackware Current
-----------------
@@ -134,7 +149,7 @@ For Slackware 'current' users must change the variable VERSION in /etc/slpkg.con
.. code-block:: bash
-$ slpkg -g --config=nano
+ $ slpkg -g --config=nano
Slackware Mirrors
@@ -157,7 +172,7 @@ Command Line Tool Usage
-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 SBo packages in queue
- --build, --install, --build-install build or install packages from queue
+ --build, --install, --build-install build, install packages from queue
-g, --config, --config=[editor] configuration file management
-l, [repository], all, noarch list of installed packages
-c, [repository] --upgrade check for updated packages
@@ -207,7 +222,7 @@ build and install with all dependencies :
6 packages will be installed, 0 allready installed and 0 package
will be upgraded.
- Do you want to continue [Y/n]? y
+ Would you like to continue [Y/n]? y
$ slpkg -s sbo fmpeg
@@ -230,7 +245,7 @@ build and install with all dependencies :
0 installed package and 4 uninstalled packages.
-Install packages from `Slackware official mirrors `_ :
+Install Slackware official packages:
.. code-block:: bash
@@ -254,7 +269,7 @@ Install packages from `Slackware official mirrors `_ :
+Check if your Slackware distribution is up to date:
.. code-block:: bash
@@ -332,7 +346,7 @@ Check if your distribution is up to date from `Slackware official mirrors
Need to get 13.58 Mb of archives.
After this process, 76.10 Mb of additional disk space will be used.
- Would you like to upgrade [Y/n]?
+ Would you like to continue [Y/n]?
Find packages from slackbuilds.org:
diff --git a/conf/slpkg.conf b/conf/slpkg.conf
index 4f90c3ee..c1d2f444 100644
--- a/conf/slpkg.conf
+++ b/conf/slpkg.conf
@@ -54,3 +54,9 @@ DEFAULT_ANSWER=n
# Define default answer for the removal of dependencies.
# Choose 'y' if you do not want to question.
REMOVE_DEPS_ANSWER=n
+
+# Delete package dependencies if DEL_DEPS is on.
+DEL_DEPS=on
+
+# Use colors for highlighting. Choose 'on' or 'off'.
+USE_COLORS=on
diff --git a/man/slpkg.8 b/man/slpkg.8
index 4e071936..ab097ac4 100644
--- a/man/slpkg.8
+++ b/man/slpkg.8
@@ -42,7 +42,7 @@ It's a quick and easy way to manage your packages in slackware to a command.
-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 SBo packages in queue
- --build, --install, --build-install build or install packages from queue
+ --build, --install, --build-install build, install packages from queue
-g, --config, --config= configuration file management
-l, [repository], all, noarch list of installed packages
-c, [repository] --upgrade check for updated packages
diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py
index 353e3156..3f70e5d3 100644
--- a/slpkg/__metadata__.py
+++ b/slpkg/__metadata__.py
@@ -22,9 +22,7 @@
# along with this program. If not, see .
import os
-import getpass
-from messages import s_user
__all__ = "slpkg"
__author__ = "dslackw"
@@ -33,8 +31,6 @@ __version__ = "{0}.{1}.{2}".format(*__version_info__)
__license__ = "GNU General Public License v3 (GPLv3)"
__email__ = "d.zlatanidis@gmail.com"
-s_user(getpass.getuser())
-
# temponary path
tmp = "/tmp/"
@@ -49,6 +45,8 @@ del_build = "off"
sbo_build_log = "on"
default_answer = "n"
remove_deps_answer = "n"
+del_deps = "on"
+use_colors = "on"
if os.path.isfile("/etc/slpkg/slpkg.conf"):
f = open("/etc/slpkg/slpkg.conf", "r")
@@ -78,6 +76,11 @@ if os.path.isfile("/etc/slpkg/slpkg.conf"):
default_answer = line[15:].strip()
if line.startswith("REMOVE_DEPS_ANSWER"):
remove_deps_answer = line[19:].strip()
+ if line.startswith("DEL_DEPS"):
+ del_deps = line[9:].strip()
+ if line.startswith("USE_COLORS"):
+ use_colors = line[11:].strip()
+
# repositories
repositories = [
@@ -88,6 +91,25 @@ repositories = [
"slacky"
]
+if use_colors == "on":
+ color = {
+ 'RED': "\x1b[31m",
+ 'GREEN': "\x1b[32m",
+ 'YELLOW': "\x1b[33m",
+ 'CYAN': "\x1b[36m",
+ 'GREY': "\x1b[38;5;247m",
+ 'ENDC': "\x1b[0m"
+ }
+else:
+ color = {
+ 'RED': "",
+ 'GREEN': "",
+ 'YELLOW': "",
+ 'CYAN': "",
+ 'GREY': "",
+ 'ENDC': ""
+ }
+
# file spacer
sp = "-"
diff --git a/slpkg/arguments.py b/slpkg/arguments.py
index 48d3f16f..9b9b881a 100755
--- a/slpkg/arguments.py
+++ b/slpkg/arguments.py
@@ -38,7 +38,7 @@ def options():
"blacklist",
" -q, --list, [package...] --add, --remove add, remove SBo packages "
"in queue",
- " --build, --install, --build-install build or install packages "
+ " --build, --install, --build-install build, install packages "
"from queue",
" -g, --config, --config=[editor] configuration file " +
"management",
diff --git a/slpkg/blacklist.py b/slpkg/blacklist.py
index 9a52da3d..36d54b16 100755
--- a/slpkg/blacklist.py
+++ b/slpkg/blacklist.py
@@ -21,11 +21,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from colors import (
- RED,
- GREEN,
- ENDC
-)
+from __metadata__ import color
class BlackList(object):
@@ -59,7 +55,7 @@ class BlackList(object):
print("\nPackages in blacklist:\n")
for black in self.packages():
if black:
- print("{0}{1}{2}".format(GREEN, black, ENDC))
+ print("{0}{1}{2}".format(color['GREEN'], black, color['ENDC']))
self.quit = True
if self.quit:
print("") # new line at exit
@@ -74,7 +70,8 @@ class BlackList(object):
with open(self.blackfile, "a") as black_conf:
for pkg in pkgs:
if pkg not in blacklist:
- print("{0}{1}{2}".format(GREEN, pkg, ENDC))
+ print("{0}{1}{2}".format(color['GREEN'], pkg,
+ color['ENDC']))
black_conf.write(pkg + "\n")
self.quit = True
black_conf.close()
@@ -91,7 +88,7 @@ class BlackList(object):
if line not in pkgs:
remove.write(line + "\n")
else:
- print("{0}{1}{2}".format(RED, line, ENDC))
+ print("{0}{1}{2}".format(color['RED'], line, color['ENDC']))
self.quit = True
remove.close()
if self.quit:
diff --git a/slpkg/config.py b/slpkg/config.py
index 3fa06fb2..6074154c 100755
--- a/slpkg/config.py
+++ b/slpkg/config.py
@@ -23,10 +23,7 @@
import subprocess
-from colors import (
- CYAN,
- ENDC
-)
+from __metadata__ import color
class Config(object):
@@ -58,7 +55,7 @@ class Config(object):
if not line.startswith("#") and line.split("=")[0] in conf_args:
print(line)
else:
- print("{0}{1}{2}".format(CYAN, line, ENDC))
+ print("{0}{1}{2}".format(color['CYAN'], line, color['ENDC']))
print("") # new line at end
def edit(self, editor):
diff --git a/slpkg/desc.py b/slpkg/desc.py
index 62a0be59..07949c45 100755
--- a/slpkg/desc.py
+++ b/slpkg/desc.py
@@ -24,18 +24,11 @@
from init import Initialization
from messages import pkg_not_found
-from colors import (
- RED,
- GREEN,
- YELLOW,
- CYAN,
- GREY,
- ENDC
-)
from __metadata__ import (
pkg_path,
lib_path,
- repositories
+ repositories,
+ color
)
from pkg.find import find_package
@@ -43,10 +36,10 @@ from pkg.find import find_package
class PkgDesc(object):
- def __init__(self, name, repo, color):
+ def __init__(self, name, repo, paint):
self.name = name
self.repo = repo
- self.color = color
+ self.paint = paint
self.COLOR = ""
self.lib = ""
init_repos = {
@@ -58,14 +51,14 @@ class PkgDesc(object):
}
init_repos[self.repo]()
color_text = {
- 'red': RED,
- 'green': GREEN,
- 'yellow': YELLOW,
- 'cyan': CYAN,
- 'grey': GREY,
+ 'red': color['RED'],
+ 'green': color['GREEN'],
+ 'yellow': color['YELLOW'],
+ 'cyan': color['CYAN'],
+ 'grey': color['GREY'],
'': ''
}
- self.COLOR = color_text[self.color]
+ self.COLOR = color_text[self.paint]
if self.repo in repositories:
repos = {
'sbo': 'sbo_repo/SLACKBUILDS.TXT',
@@ -94,7 +87,7 @@ class PkgDesc(object):
if line.startswith(self.name + end):
print("{0}{1}{2}".format(self.COLOR,
line[len(self.name) + n:].strip(),
- ENDC))
+ color['ENDC']))
count += 1
if count == 11:
break
diff --git a/slpkg/downloader.py b/slpkg/downloader.py
index ccb775c3..fb6de051 100755
--- a/slpkg/downloader.py
+++ b/slpkg/downloader.py
@@ -24,10 +24,7 @@
import sys
import subprocess
-from colors import (
- GREEN,
- ENDC
-)
+from __metadata__ import color
class Download(object):
@@ -43,7 +40,8 @@ class Download(object):
Check if file already download the skip or continue
download if before stoped.
'''
- print("\n[ {0}Download{1} ] -->{1} {2}\n".format(GREEN, ENDC,
+ print("\n[ {0}Download{1} ] -->{1} {2}\n".format(color['GREEN'],
+ color['ENDC'],
self.file_name))
try:
subprocess.call("wget -c -N --directory-prefix={0} {1}".format(
diff --git a/slpkg/messages.py b/slpkg/messages.py
index 6dcb74a2..54b98f30 100755
--- a/slpkg/messages.py
+++ b/slpkg/messages.py
@@ -23,11 +23,7 @@
import sys
-from colors import (
- RED,
- CYAN,
- ENDC
-)
+from __metadata__ import color
def pkg_not_found(bol, pkg, message, eol):
@@ -65,10 +61,11 @@ def build_FAILED(sbo_url, prgnam):
Print error message if build failed
'''
template(78)
- print("| Build package {0} [ {1}FAILED{2} ]".format(prgnam, RED, ENDC))
+ print("| Build package {0} [ {1}FAILED{2} ]".format(prgnam, color['RED'],
+ color['ENDC']))
template(78)
print("| See log file in {0}/var/log/slpkg/sbo/build_logs{1} directory or "
- "read README file:".format(CYAN, ENDC))
+ "read README file:".format(color['CYAN'], color['ENDC']))
print("| {0}{1}".format(sbo_url, "README"))
template(78)
print # new line at end
diff --git a/slpkg/others/check.py b/slpkg/others/check.py
index b7590083..e43226eb 100644
--- a/slpkg/others/check.py
+++ b/slpkg/others/check.py
@@ -30,16 +30,12 @@ from slpkg.messages import template
from slpkg.blacklist import BlackList
from slpkg.init import Initialization
from slpkg.splitting import split_package
-from slpkg.colors import (
- YELLOW,
- GREY,
- ENDC
-)
from slpkg.__metadata__ import (
pkg_path,
lib_path,
slpkg_tmp_packages,
- default_answer
+ default_answer,
+ color
)
from slpkg.pkg.manager import PackageManager
@@ -59,7 +55,8 @@ class OthersUpgrade(object):
self.tmp_path = slpkg_tmp_packages
self.repo_init()
repos = Repo()
- sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
+ sys.stdout.write("{0}Reading package lists ...{1}".format(
+ color['GREY'], color['ENDC']))
sys.stdout.flush()
self.step = 700
repos = Repo()
@@ -99,7 +96,8 @@ class OthersUpgrade(object):
'''
try:
dwn_links, upgrade_all, comp_sum, uncomp_sum = self.store()
- sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
+ sys.stdout.write("{0}Done{1}\n".format(color['GREY'],
+ color['ENDC']))
print("") # new line at start
if upgrade_all:
template(78)
@@ -118,11 +116,12 @@ class OthersUpgrade(object):
print("\nInstalling summary")
print("=" * 79)
print("{0}Total {1} {2} will be upgraded.".format(
- GREY, len(upgrade_all), msg))
+ color['GREY'], len(upgrade_all), msg))
print("Need to get {0} {1} of archives.".format(size[0],
unit[0]))
print("After this process, {0} {1} of additional disk "
- "space will be used.{2}".format(size[1], unit[1], ENDC))
+ "space will be used.{2}".format(size[1], unit[1],
+ color['ENDC']))
if default_answer == "y":
answer = default_answer
else:
@@ -198,7 +197,7 @@ def views(upgrade_all, comp_sum, repository):
pkg_split = split_package(pkg[:-4])
upg_sum += 1
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11:>11}{12}".format(
- YELLOW, pkg_split[0], ENDC,
+ color['YELLOW'], pkg_split[0], color['ENDC'],
" " * (25-len(pkg_split[0])), pkg_split[1],
" " * (19-len(pkg_split[1])), pkg_split[2],
" " * (8-len(pkg_split[2])), pkg_split[3],
@@ -223,5 +222,6 @@ def upgrade(tmp_path, upgrade_all):
'''
for pkg in upgrade_all:
package = (tmp_path + pkg).split()
- print("[ {0}upgrading{1} ] --> {2}".format(YELLOW, ENDC, pkg[:-4]))
+ print("[ {0}upgrading{1} ] --> {2}".format(color['YELLOW'],
+ color['ENDC'], pkg[:-4]))
PackageManager(package).upgrade()
diff --git a/slpkg/others/install.py b/slpkg/others/install.py
index 9f25afdb..9a809b40 100644
--- a/slpkg/others/install.py
+++ b/slpkg/others/install.py
@@ -33,20 +33,13 @@ from slpkg.messages import (
pkg_not_found,
template
)
-from slpkg.colors import (
- RED,
- GREEN,
- CYAN,
- YELLOW,
- GREY,
- ENDC
-)
from slpkg.__metadata__ import (
pkg_path,
lib_path,
log_path,
slpkg_tmp_packages,
- default_answer
+ default_answer,
+ color
)
from slpkg.pkg.find import find_package
@@ -70,8 +63,9 @@ class OthersInstall(object):
self.repo_init()
repos = Repo()
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
- CYAN, self.package, ENDC))
- sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
+ color['CYAN'], self.package, color['ENDC']))
+ sys.stdout.write("{0}Reading package lists ...{1}".format(
+ color['GREY'], color['ENDC']))
sys.stdout.flush()
self.step = 700
repos = Repo()
@@ -93,7 +87,7 @@ class OthersInstall(object):
f = open(lib, "r")
self.PACKAGES_TXT = f.read()
f.close()
- sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
+ sys.stdout.write("{0}Done{1}\n".format(color['GREY'], color['ENDC']))
def repo_init(self):
'''
@@ -118,7 +112,8 @@ class OthersInstall(object):
dependencies = resolving_deps(self.package, self.repo)
(dwn_links, install_all, comp_sum, uncomp_sum,
matching) = self.store(dependencies)
- sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
+ sys.stdout.write("{0}Done{1}\n".format(color['GREY'],
+ color['ENDC']))
print("") # new line at start
if install_all:
template(78)
@@ -137,8 +132,8 @@ class OthersInstall(object):
msg = msgs(install_all, sums[2])
print("\nInstalling summary")
print("=" * 79)
- print("{0}Total {1} {2}.".format(GREY, len(install_all),
- msg[0]))
+ print("{0}Total {1} {2}.".format(color['GREY'],
+ len(install_all), msg[0]))
print("{0} {1} will be installed, {2} will be upgraded and "
"{3} will be resettled.".format(sums[2], msg[1],
sums[1], sums[0]))
@@ -146,7 +141,7 @@ class OthersInstall(object):
unit[0]))
print("After this process, {0} {1} of additional disk "
"space will be used.{2}".format(size[1], unit[1],
- ENDC))
+ color['ENDC']))
if default_answer == "y":
answer = default_answer
else:
@@ -165,10 +160,10 @@ class OthersInstall(object):
print("\nInstalling summary")
print("=" * 79)
print("{0}Total found {1} matching {2}.".format(
- GREY, len(install_all), msg[1]))
+ color['GREY'], len(install_all), msg[1]))
print("{0} installed {1} and {2} uninstalled {3}.{4}"
"\n".format(sums[0] + sums[1], msg[0], sums[2],
- msg[1], ENDC))
+ msg[1], color['ENDC']))
else:
pkg_not_found("", self.package, "No matching", "\n")
except KeyboardInterrupt:
@@ -232,15 +227,15 @@ def views(install_all, comp_sum, repository, dependencies):
pkg_split = split_package(pkg[:-4])
if find_package(pkg_split[0] + "-" + pkg_split[1], pkg_path):
pkg_sum += 1
- COLOR = GREEN
+ COLOR = color['GREEN']
elif find_package(pkg_split[0] + "-", pkg_path):
- COLOR = YELLOW
+ COLOR = color['YELLOW']
upg_sum += 1
else:
- COLOR = RED
+ COLOR = color['RED']
uni_sum += 1
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11:>11}{12}".format(
- COLOR, pkg_split[0], ENDC,
+ COLOR, pkg_split[0], color['ENDC'],
" " * (25-len(pkg_split[0])), pkg_split[1],
" " * (19-len(pkg_split[1])), pkg_split[2],
" " * (8-len(pkg_split[2])), pkg_split[3],
@@ -272,13 +267,19 @@ def install(tmp_path, install_all):
for install in install_all:
package = (tmp_path + install).split()
if os.path.isfile(pkg_path + install[:-4]):
- print("[ {0}reinstalling{1} ] --> {2}".format(GREEN, ENDC, install))
+ print("[ {0}reinstalling{1} ] --> {2}".format(color['GREEN'],
+ color['ENDC'],
+ install))
PackageManager(package).reinstall()
elif find_package(split_package(install)[0] + "-", pkg_path):
- print("[ {0}upgrading{1} ] --> {2}".format(YELLOW, ENDC, install))
+ print("[ {0}upgrading{1} ] --> {2}".format(color['YELLOW'],
+ color['ENDC'],
+ install))
PackageManager(package).upgrade()
else:
- print("[ {0}installing{1} ] --> {2}".format(GREEN, ENDC, install))
+ print("[ {0}installing{1} ] --> {2}".format(color['GREEN'],
+ color['ENDC'],
+ install))
PackageManager(package).upgrade()
@@ -287,7 +288,8 @@ def resolving_deps(name, repo):
Return package dependencies
'''
requires, dependencies = [], []
- sys.stdout.write("{0}Resolving dependencies ...{1}".format(GREY, ENDC))
+ sys.stdout.write("{0}Resolving dependencies ...{1}".format(color['GREY'],
+ color['ENDC']))
sys.stdout.flush()
deps = dependencies_pkg(name, repo)
requires.append(name)
diff --git a/slpkg/pkg/build.py b/slpkg/pkg/build.py
index f52fbe20..16fc57a8 100644
--- a/slpkg/pkg/build.py
+++ b/slpkg/pkg/build.py
@@ -30,11 +30,6 @@ import tarfile
import subprocess
from slpkg.checksum import md5sum
-from slpkg.colors import (
- RED,
- GREEN,
- ENDC
-)
from slpkg.messages import (
pkg_not_found,
template
@@ -43,7 +38,8 @@ from slpkg.__metadata__ import (
log_path,
sbo_build_log,
sbo_check_md5,
- default_answer
+ default_answer,
+ color
)
from slpkg.sbo.greps import SBoGrep
@@ -120,7 +116,9 @@ def check_md5(sbo_md5, src):
md5 = md5sum(src)
if sbo_md5 != md5:
template(78)
- print("| MD5SUM check for {0} [ {1}FAILED{2} ]".format(src, RED, ENDC))
+ print("| MD5SUM check for {0} [ {1}FAILED{2} ]".format(src,
+ color['RED'],
+ color['ENDC']))
template(78)
print("| Expected: {0}".format(md5))
print("| Found: {0}".format(sbo_md5))
@@ -135,8 +133,9 @@ def check_md5(sbo_md5, src):
sys.exit()
else:
template(78)
- print("| MD5SUM check for {0} [ {1}PASSED{2} ]".format(src, GREEN,
- ENDC))
+ print("| MD5SUM check for {0} [ {1}PASSED{2} ]".format(src,
+ color['GREEN'],
+ color['ENDC']))
template(78)
print("") # new line after pass checksum
diff --git a/slpkg/pkg/manager.py b/slpkg/pkg/manager.py
index 5a3daefb..8b4e96be 100644
--- a/slpkg/pkg/manager.py
+++ b/slpkg/pkg/manager.py
@@ -29,19 +29,14 @@ from slpkg.messages import (
pkg_not_found,
template
)
-from slpkg.colors import (
- RED,
- GREEN,
- CYAN,
- GREY,
- ENDC
-)
from slpkg.__metadata__ import (
pkg_path,
sp,
log_path,
default_answer,
- remove_deps_answer
+ remove_deps_answer,
+ del_deps,
+ color
)
from slpkg.pkg.find import find_package
@@ -127,7 +122,7 @@ class PackageManager(object):
# If package build and install with 'slpkg -s sbo '
# then look log file for dependencies in /var/log/slpkg/dep,
# read and remove all else remove only the package.
- if os.path.isfile(dep_path + rmv):
+ if os.path.isfile(dep_path + rmv) and del_deps == "on":
dependencies = self.view_deps(dep_path, rmv)
try:
if remove_deps_answer == "y":
@@ -158,12 +153,13 @@ class PackageManager(object):
'''
removed = []
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
- CYAN, ", ".join(binary), ENDC))
+ color['CYAN'], ", ".join(binary), color['ENDC']))
for pkg in binary:
pkgs = find_package(pkg + sp, pkg_path)
if pkgs:
- print("[ {0}delete{1} ] --> {2}".format(RED, ENDC,
- "\n ".join(pkgs)))
+ print("[ {0}delete{1} ] --> {2}".format(
+ color['RED'], color['ENDC'],
+ "\n ".join(pkgs)))
removed.append(pkg)
else:
pkg_not_found("", pkg, "Can't remove", "")
@@ -182,7 +178,7 @@ class PackageManager(object):
print("| Found dependencies for package {0}:".format(package))
template(78)
for dep in dependencies:
- print("| {0}{1}{2}".format(RED, dep, ENDC))
+ print("| {0}{1}{2}".format(color['RED'], dep, color['ENDC']))
template(78)
return dependencies
@@ -234,12 +230,12 @@ class PackageManager(object):
self.binary = "".join(self.binary)
matching = size = 0
print("\nPackages with matching name [ {0}{1}{2} ]\n".format(
- CYAN, self.binary, ENDC))
+ color['CYAN'], self.binary, color['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))
+ color['GREEN'], color['ENDC'], match))
with open(pkg_path + match, "r") as f:
data = f.read()
f.close()
@@ -255,13 +251,13 @@ class PackageManager(object):
pkg_not_found("", self.binary, message, "\n")
else:
print("\n{0}Total found {1} matching packages.{2}".format(
- GREY, matching, ENDC))
+ color['GREY'], matching, color['ENDC']))
unit = "Kb"
if size > 1024:
unit = "Mb"
size = (size / 1024)
print("{0}Size of installed packages {1} {2}.{3}\n".format(
- GREY, round(size, 2), unit, ENDC))
+ color['GREY'], round(size, 2), unit, color['ENDC']))
def display(self):
'''
@@ -306,10 +302,12 @@ class PackageManager(object):
for pkg in find_package("", pkg_path):
if pkg.endswith(search) and sl in pkg:
index += 1
- print("{0}{1}:{2} {3}".format(GREY, index, ENDC, pkg))
+ print("{0}{1}:{2} {3}".format(color['GREY'], index,
+ color['ENDC'], pkg))
if index == page:
read = raw_input("\nPress {0}Enter{1} to "
- "continue... ".format(CYAN, ENDC))
+ "continue... ".format(color['CYAN'],
+ color['ENDC']))
if read in ['Q', 'q']:
break
print("") # new line after page
diff --git a/slpkg/queue.py b/slpkg/queue.py
index 6100c86f..3919b9e3 100755
--- a/slpkg/queue.py
+++ b/slpkg/queue.py
@@ -24,14 +24,10 @@
import os
from downloader import Download
-from colors import (
- GREEN,
- RED,
- ENDC
-)
from __metadata__ import (
lib_path,
build_path,
+ color,
tmp
)
@@ -90,7 +86,7 @@ class QueuePkgs(object):
print("\nPackages in queue:\n")
for pkg in self.packages():
if pkg:
- print("{0}{1}{2}".format(GREEN, pkg, ENDC))
+ print("{0}{1}{2}".format(color['GREEN'], pkg, color['ENDC']))
self.quit = True
if self.quit:
print("") # new line at exit
@@ -106,11 +102,12 @@ class QueuePkgs(object):
for pkg in pkgs:
find = sbo_search_pkg(pkg)
if pkg not in queue_list and find is not None:
- print("{0}{1}{2}".format(GREEN, pkg, ENDC))
+ print("{0}{1}{2}".format(color['GREEN'], pkg,
+ color['ENDC']))
queue.write(pkg + "\n")
self.quit = True
else:
- print("{0}{1}{2}".format(RED, pkg, ENDC))
+ print("{0}{1}{2}".format(color['RED'], pkg, color['ENDC']))
self.quit = True
queue.close()
if self.quit:
@@ -128,7 +125,7 @@ class QueuePkgs(object):
if line not in pkgs:
queue.write(line + "\n")
else:
- print("{0}{1}{2}".format(RED, line, ENDC))
+ print("{0}{1}{2}".format(color['RED'], line, color['ENDC']))
self.quit = True
queue.close()
if self.quit:
diff --git a/slpkg/sbo/check.py b/slpkg/sbo/check.py
index 80b435e4..df4b0604 100644
--- a/slpkg/sbo/check.py
+++ b/slpkg/sbo/check.py
@@ -36,18 +36,12 @@ from slpkg.messages import (
template,
build_FAILED
)
-from slpkg.colors import (
- RED,
- GREEN,
- GREY,
- YELLOW,
- ENDC
-)
from slpkg.__metadata__ import (
tmp,
pkg_path,
build_path,
default_answer,
+ color,
sp
)
@@ -61,9 +55,10 @@ from dependency import sbo_dependencies_pkg
class SBoCheck(object):
def __init__(self):
- self.done = "{0}Done{1}\n".format(GREY, ENDC)
+ self.done = "{0}Done{1}\n".format(color['GREY'], color['ENDC'])
Initialization().sbo()
- sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
+ sys.stdout.write("{0}Reading package lists ...{1}".format(
+ color['GREY'], color['ENDC']))
sys.stdout.flush()
self.installed = []
self.index, self.toolbar_width = 0, 3
@@ -84,7 +79,7 @@ class SBoCheck(object):
data = []
if upg_name:
sys.stdout.write("{0}Resolving dependencies ...{1}".format(
- GREY, ENDC))
+ color['GREY'], color['ENDC']))
sys.stdout.flush()
# upgrade name = data[0]
# package for upgrade = data[1]
@@ -124,10 +119,10 @@ class SBoCheck(object):
sys.exit()
if find_package(name + sp, pkg_path):
print("[ {0}Upgrading{1} ] --> {2}".format(
- YELLOW, ENDC, name))
+ color['YELLOW'], color['ENDC'], name))
else:
print("[ {0}Installing{1} ] --> {2}".format(
- GREEN, ENDC, name))
+ color['GREEN'], color['ENDC'], name))
# Use this list to pick out what
# packages will be installed
self.installed.append(name)
@@ -277,14 +272,14 @@ def view_packages(package_for_upgrade, upgrade_version, upgrade_arch):
for upg, ver, arch in zip(package_for_upgrade, upgrade_version,
upgrade_arch):
if find_package(upg[:-len(ver)], pkg_path):
- COLOR = YELLOW
+ COLOR = color['YELLOW']
count_upgraded += 1
else:
- COLOR = RED
+ COLOR = 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,
+ COLOR, upg, color['ENDC'], " " * (38-len(upg)), color['GREEN'],
+ ver, color['ENDC'], " " * (17-len(ver)), arch,
" " * (13-len(arch)), "SBo"))
msg_upg = "package"
msg_ins = msg_upg
@@ -295,8 +290,8 @@ def view_packages(package_for_upgrade, upgrade_version, upgrade_arch):
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))
+ "installed.{5}\n".format(color['GREY'], count_upgraded, msg_upg,
+ count_installed, msg_ins, color['ENDC']))
return [count_installed, count_upgraded], [msg_ins, msg_upg]
diff --git a/slpkg/sbo/slackbuild.py b/slpkg/sbo/slackbuild.py
index b9cfb303..500cc325 100644
--- a/slpkg/sbo/slackbuild.py
+++ b/slpkg/sbo/slackbuild.py
@@ -35,16 +35,9 @@ from slpkg.__metadata__ import (
log_path,
lib_path,
default_answer,
+ color,
sp
)
-from slpkg.colors import (
- RED,
- GREEN,
- GREY,
- YELLOW,
- CYAN,
- ENDC
-)
from slpkg.messages import (
pkg_found,
template,
@@ -68,7 +61,8 @@ class SBoInstall(object):
def __init__(self, name):
self.name = name
Initialization().sbo()
- sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
+ sys.stdout.write("{0}Reading package lists ...{1}".format(
+ color['GREY'], color['ENDC']))
sys.stdout.flush()
self.UNST = ["UNSUPPORTED", "UNTESTED"]
self.dependencies_list = sbo_dependencies_pkg(name)
@@ -82,7 +76,8 @@ class SBoInstall(object):
try:
if self.dependencies_list or sbo_search_pkg(self.name) is not None:
dependencies = self.remove_dbs()
- sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
+ sys.stdout.write("{0}Done{1}\n".format(color['GREY'],
+ color['ENDC']))
# sbo versions = idata[0]
# package arch = idata[1]
# package sum = idata[2]
@@ -113,12 +108,12 @@ class SBoInstall(object):
msg = msgs(dependencies, count[1], count[0])
print("\nInstalling summary")
print("=" * 79)
- print("{0}Total {1} {2}.".format(GREY, len(dependencies),
- msg[2]))
+ print("{0}Total {1} {2}.".format(color['GREY'],
+ len(dependencies), msg[2]))
print("{0} {1} will be installed, {2} allready installed and "
"{3} {4}".format(count[1], msg[0], idata[2], count[0],
msg[1]))
- print("will be upgraded.{0}\n".format(ENDC))
+ print("will be upgraded.{0}\n".format(color['ENDC']))
answer = arch_support(idata[3], self.UNST, idata[2],
dependencies)
if answer in['y', 'Y']:
@@ -136,18 +131,19 @@ class SBoInstall(object):
# sbo version = mdata1]
# package arch = mdata[2]
mdata = matching_data(self.name, self.UNST)
- sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
+ sys.stdout.write("{0}Done{1}\n".format(color['GREY'],
+ color['ENDC']))
if mdata[0]:
print("\nPackages with name matching [ {0}{1}{2} ]"
- "\n".format(CYAN, self.name, ENDC))
+ "\n".format(color['CYAN'], self.name, color['ENDC']))
top_view()
print("Matching:")
for match, ver, march in zip(mdata[0], mdata[1], mdata[2]):
if find_package(match + sp + ver, pkg_path):
- view_packages(GREEN, match, ver, "", march)
+ view_packages(color['GREEN'], match, ver, "", march)
count_installed += 1
else:
- view_packages(RED, match, ver, "", march)
+ view_packages(color['RED'], match, ver, "", march)
count_uninstalled += 1
# insstall message = msg[0]
# uninstall message = msg[1]
@@ -156,10 +152,10 @@ class SBoInstall(object):
print("\nInstalling summary")
print("=" * 79)
print("{0}Total found {1} matching {2}.".format(
- GREY, len(mdata[0]), msg[2]))
+ color['GREY'], len(mdata[0]), msg[2]))
print("{0} installed {1} and {2} uninstalled {3}.{4}"
"\n".format(count_installed, msg[0],
- count_uninstalled, msg[1], ENDC))
+ count_uninstalled, msg[1], color['ENDC']))
else:
pkg_not_found("\n", self.name, "No matching", "\n")
except KeyboardInterrupt:
@@ -196,7 +192,8 @@ def installing_data(dependencies, support):
'''
package_sum = 0
sbo_versions, package_arch = [], []
- sys.stdout.write("{0}Resolving dependencies ...{1}".format(GREY, ENDC))
+ sys.stdout.write("{0}Resolving dependencies ...{1}".format(
+ color['GREY'], color['ENDC']))
sys.stdout.flush()
toolbar_width, index = 2, 0
for pkg in dependencies:
@@ -209,7 +206,7 @@ def installing_data(dependencies, support):
sbo_package = ("{0}-{1}".format(pkg, version))
if find_package(sbo_package, pkg_path):
package_sum += 1
- sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
+ sys.stdout.write("{0}Done{1}\n".format(color['GREY'], color['ENDC']))
return [sbo_versions, package_arch, package_sum, sources]
@@ -227,14 +224,14 @@ def pkg_colors_tag(name, sbo_versions, count_upg, count_ins):
sbo_versions = sbo_versions[-1]
master_pkg = ("{0}-{1}".format(name, sbo_versions))
if find_package(master_pkg, pkg_path):
- color = GREEN
+ paint = color['GREEN']
elif find_package(name + sp, pkg_path):
- color = YELLOW
+ paint = color['YELLOW']
count_upg += 1
else:
- color = RED
+ paint = color['RED']
count_ins += 1
- return color, [count_upg, count_ins]
+ return paint, [count_upg, count_ins]
def arch_colors_tag(support, package_arch):
@@ -243,9 +240,9 @@ def arch_colors_tag(support, package_arch):
'''
color = ""
if support[0] in package_arch[-1]:
- color = RED
+ color = color['RED']
elif support[1] in package_arch[-1]:
- color = YELLOW
+ color = color['YELLOW']
return color
@@ -267,9 +264,9 @@ def view_packages(*args):
View slackbuild packages with version and arch
'''
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
- args[0], args[1], ENDC,
+ args[0], args[1], color['ENDC'],
" " * (38-len(args[1])), args[2],
- " " * (17-len(args[2])), args[3], args[4], ENDC,
+ " " * (17-len(args[2])), args[3], args[4], color['ENDC'],
" " * (13-len(args[4])), "SBo"))
@@ -294,7 +291,8 @@ def arch_support(source, support, package_sum, dependencies):
Exit if all packages already installed
'''
if source in support:
- print("{0}The package {1}{2}\n".format(RED, source, ENDC))
+ print("{0}The package {1}{2}\n".format(color['RED'], source,
+ color['ENDC']))
answer = ""
elif package_sum == len(dependencies):
answer = ""
@@ -358,10 +356,14 @@ def build_install(dependencies, sbo_versions):
build_FAILED(sbo_url, prgnam)
sys.exit()
if find_package(pkg + sp, pkg_path):
- print("{0}[ Upgrading ] --> {1}{2}".format(GREEN, ENDC, pkg))
+ print("{0}[ Upgrading ] --> {1}{2}".format(color['GREEN'],
+ color['ENDC'],
+ pkg))
upgraded.append(pkg)
else:
- print("{0}[ Installing ] --> {1}{2}".format(GREEN, ENDC, pkg))
+ print("{0}[ Installing ] --> {1}{2}".format(color['GREEN'],
+ color['ENDC'],
+ pkg))
PackageManager(binary).upgrade()
installs.append(pkg)
versions.append(ver)
diff --git a/slpkg/sbo/views.py b/slpkg/sbo/views.py
index ea6c7462..211777c1 100644
--- a/slpkg/sbo/views.py
+++ b/slpkg/sbo/views.py
@@ -31,16 +31,9 @@ from slpkg.__metadata__ import (
tmp,
build_path,
pkg_path,
+ color,
sp
)
-from slpkg.colors import (
- RED,
- GREEN,
- GREY,
- CYAN,
- YELLOW,
- ENDC
-)
from slpkg.messages import (
pkg_found,
pkg_not_found,
@@ -64,7 +57,8 @@ class SBoNetwork(object):
def __init__(self, name):
self.name = name
Initialization().sbo()
- sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
+ sys.stdout.write("{0}Reading package lists ...{1}".format(
+ color['GREY'], color['ENDC']))
sys.stdout.flush()
grep = SBoGrep(self.name)
self.sbo_url = sbo_search_pkg(self.name)
@@ -75,7 +69,7 @@ class SBoNetwork(object):
self.sbo_dwn = SBoLink(self.sbo_url).tar_gz()
self.sbo_version = grep.version()
self.space = ("\n" * 50)
- sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
+ sys.stdout.write("{0}Done{1}\n".format(color['GREY'], color['ENDC']))
def view(self):
'''
@@ -135,28 +129,35 @@ class SBoNetwork(object):
'''
print("") # new line at start
template(78)
- print("| {0}Package {1}{2}{3} --> {4}".format(GREEN, CYAN, args[0],
- GREEN, ENDC + args[1]))
+ print("| {0}Package {1}{2}{3} --> {4}".format(color['GREEN'],
+ color['CYAN'], args[0],
+ color['GREEN'],
+ color['ENDC'] + args[1]))
template(78)
- print("| {0}Description : {1}{2}".format(GREEN, ENDC, args[2]))
- print("| {0}SlackBuild : {1}{2}".format(GREEN, ENDC, args[3]))
- print("| {0}Sources : {1}{2}".format(GREEN, ENDC, args[4]))
- print("| {0}Requirements : {1}{2}".format(YELLOW, ENDC,
+ print("| {0}Description : {1}{2}".format(color['GREEN'],
+ color['ENDC'], args[2]))
+ print("| {0}SlackBuild : {1}{2}".format(color['GREEN'], color['ENDC'],
+ args[3]))
+ print("| {0}Sources : {1}{2}".format(color['GREEN'], color['ENDC'],
+ args[4]))
+ print("| {0}Requirements : {1}{2}".format(color['YELLOW'],
+ color['ENDC'],
", ".join(args[5])))
template(78)
- print(" {0}R{1}EADME View the README file".format(RED,
- ENDC))
+ print(" {0}R{1}EADME View the README file".format(
+ color['RED'], color['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))
+ color['RED'], color['ENDC']))
+ print(" In{0}f{1}o View the Info file".format(
+ color['RED'], color['ENDC']))
+ print(" {0}D{1}ownload Download this package".format(
+ color['RED'], color['ENDC']))
+ print(" {0}B{1}uild Download and build".format(
+ color['RED'], color['ENDC']))
print(" {0}I{1}nstall Download/Build/Install".format(
- RED, ENDC))
- print(" {0}Q{1}uit Quit\n".format(RED, ENDC))
+ color['RED'], color['ENDC']))
+ print(" {0}Q{1}uit Quit\n".format(color['RED'],
+ color['ENDC']))
@staticmethod
def fill_pager(page):
@@ -178,7 +179,8 @@ class SBoNetwork(object):
Return choice
'''
try:
- choice = raw_input(" {0}Choose an option: {1}".format(GREY, ENDC))
+ choice = raw_input(" {0}Choose an option: {1}".format(
+ color['GREY'], color['ENDC']))
except KeyboardInterrupt:
print("") # new line at exit
sys.exit()
@@ -206,7 +208,8 @@ class SBoNetwork(object):
Only build and create Slackware package
'''
if FAULT:
- print("\n{0}The package {1} {2}\n".format(RED, FAULT, ENDC))
+ print("\n{0}The package {1} {2}\n".format(color['RED'], FAULT,
+ color['ENDC']))
sys.exit()
sources = []
os.chdir(build_path)
@@ -231,5 +234,7 @@ class SBoNetwork(object):
except ValueError:
build_FAILED(self.sbo_url, prgnam)
sys.exit()
- print("[ {0}Installing{1} ] --> {2}".format(GREEN, ENDC, self.name))
+ print("[ {0}Installing{1} ] --> {2}".format(color['GREEN'],
+ color['ENDC'],
+ self.name))
PackageManager(binary).upgrade()
diff --git a/slpkg/slack/install.py b/slpkg/slack/install.py
index 51eed8f3..f7e5c436 100644
--- a/slpkg/slack/install.py
+++ b/slpkg/slack/install.py
@@ -32,19 +32,12 @@ from slpkg.messages import (
pkg_not_found,
template
)
-from slpkg.colors import (
- RED,
- GREEN,
- CYAN,
- YELLOW,
- GREY,
- ENDC
-)
from slpkg.__metadata__ import (
pkg_path,
lib_path,
slpkg_tmp_packages,
- default_answer
+ default_answer,
+ color
)
from slpkg.pkg.find import find_package
@@ -64,8 +57,9 @@ class Slack(object):
self.tmp_path = slpkg_tmp_packages
Initialization().slack()
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
- CYAN, self.slack_pkg, ENDC))
- sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
+ color['CYAN'], self.slack_pkg, color['ENDC']))
+ sys.stdout.write("{0}Reading package lists ...{1}".format(
+ color['GREY'], color['ENDC']))
sys.stdout.flush()
Initialization().slack()
lib = lib_path + "slack_repo/PACKAGES.TXT"
@@ -79,7 +73,8 @@ class Slack(object):
'''
try:
dwn_links, install_all, comp_sum, uncomp_sum = self.store()
- sys.stdout.write("{0}Done{1}\n\n".format(GREY, ENDC))
+ sys.stdout.write("{0}Done{1}\n\n".format(color['GREY'],
+ color['ENDC']))
if install_all:
template(78)
print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
@@ -96,15 +91,16 @@ class Slack(object):
msg = msgs(install_all, sums[2])
print("\nInstalling summary")
print("=" * 79)
- print("{0}Total {1} {2}.".format(GREY, len(install_all),
- msg[0]))
+ print("{0}Total {1} {2}.".format(color['GREY'],
+ len(install_all), msg[0]))
print("{0} {1} will be installed, {2} will be upgraded and "
"{3} will be resettled.".format(sums[2], msg[1],
sums[1], sums[0]))
print("Need to get {0} {1} of archives.".format(size[0],
unit[0]))
print("After this process, {0} {1} of additional disk space "
- "will be used.{2}".format(size[1], unit[1], ENDC))
+ "will be used.{2}".format(size[1], unit[1],
+ color['ENDC']))
if default_answer == "y":
answer = default_answer
else:
@@ -145,15 +141,15 @@ def views(install_all, comp_sum):
pkg_split = split_package(pkg[:-4])
if os.path.isfile(pkg_path + pkg[:-4]):
pkg_sum += 1
- COLOR = GREEN
+ COLOR = color['GREEN']
elif find_package(pkg_split[0] + "-", pkg_path):
- COLOR = YELLOW
+ COLOR = color['YELLOW']
upg_sum += 1
else:
- COLOR = RED
+ COLOR = color['RED']
uni_sum += 1
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11:>12}{12}".format(
- COLOR, pkg_split[0], ENDC,
+ COLOR, pkg_split[0], color['ENDC'],
" " * (25-len(pkg_split[0])), pkg_split[1],
" " * (19-len(pkg_split[1])), pkg_split[2],
" " * (8-len(pkg_split[2])), pkg_split[3],
@@ -182,11 +178,17 @@ def install(tmp_path, install_all):
for install in install_all:
package = (tmp_path + install).split()
if os.path.isfile(pkg_path + install[:-4]):
- print("[ {0}reinstalling{1} ] --> {2}".format(GREEN, ENDC, install))
+ print("[ {0}reinstalling{1} ] --> {2}".format(color['GREEN'],
+ color['ENDC'],
+ install))
PackageManager(package).reinstall()
elif find_package(split_package(install)[0] + "-", pkg_path):
- print("[ {0}upgrading{1} ] --> {2}".format(YELLOW, ENDC, install))
+ print("[ {0}upgrading{1} ] --> {2}".format(color['YELLOW'],
+ color['ENDC'],
+ install))
PackageManager(package).upgrade()
else:
- print("[ {0}installing{1} ] --> {2}".format(GREEN, ENDC, install))
+ print("[ {0}installing{1} ] --> {2}".format(color['GREEN'],
+ color['ENDC'],
+ install))
PackageManager(package).upgrade()
diff --git a/slpkg/slack/patches.py b/slpkg/slack/patches.py
index 9742f94f..15f01915 100644
--- a/slpkg/slack/patches.py
+++ b/slpkg/slack/patches.py
@@ -30,15 +30,11 @@ from slpkg.url_read import URL
from slpkg.messages import template
from slpkg.blacklist import BlackList
from slpkg.splitting import split_package
-from slpkg.colors import (
- GREY,
- YELLOW,
- ENDC
-)
from slpkg.__metadata__ import (
pkg_path,
slpkg_tmp_patches,
- default_answer
+ default_answer,
+ color
)
from slpkg.pkg.find import find_package
@@ -56,7 +52,8 @@ class Patches(object):
def __init__(self, version):
self.version = version
self.patch_path = slpkg_tmp_patches
- sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
+ sys.stdout.write("{0}Reading package lists ...{1}".format(
+ color['GREY'], color['ENDC']))
sys.stdout.flush()
if version == "stable":
self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", "patches/",
@@ -73,7 +70,8 @@ class Patches(object):
'''
try:
dwn_links, upgrade_all, comp_sum, uncomp_sum = self.store()
- sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
+ sys.stdout.write("{0}Done{1}\n".format(color['GREY'],
+ color['ENDC']))
if upgrade_all:
print("\nThese packages need upgrading:\n")
template(78)
@@ -91,11 +89,12 @@ class Patches(object):
print("\nInstalling summary")
print("=" * 79)
print("{0}Total {1} {2} will be upgraded.".format(
- GREY, len(upgrade_all), msgs(upgrade_all)))
+ color['GREY'], len(upgrade_all), msgs(upgrade_all)))
print("Need to get {0} {1} of archives.".format(size[0],
unit[0]))
print("After this process, {0} {1} of additional disk space "
- "will be used.{2}".format(size[1], unit[1], ENDC))
+ "will be used.{2}".format(size[1], unit[1],
+ color['ENDC']))
if default_answer == "y":
answer = default_answer
else:
@@ -141,7 +140,7 @@ def views(upgrade_all, comp_sum):
for upgrade, size in zip(upgrade_all, comp_sum):
pkg_split = split_package(upgrade[:-4])
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11:>12}{12}".format(
- YELLOW, pkg_split[0], ENDC,
+ color['YELLOW'], pkg_split[0], color['ENDC'],
" " * (25-len(pkg_split[0])), pkg_split[1],
" " * (19-len(pkg_split[1])), pkg_split[2],
" " * (8-len(pkg_split[2])), pkg_split[3],
@@ -164,7 +163,8 @@ def upgrade(patch_path, upgrade_all):
Upgrade packages
'''
for pkg in upgrade_all:
- print("[ {0}upgrading{1} ] --> {2}".format(YELLOW, ENDC, pkg[:-4]))
+ print("[ {0}upgrading{1} ] --> {2}".format(color['YELLOW'],
+ color['ENDC'], pkg[:-4]))
PackageManager((patch_path + pkg).split()).upgrade()
diff --git a/slpkg/toolbar.py b/slpkg/toolbar.py
index feb842d4..7a19690c 100755
--- a/slpkg/toolbar.py
+++ b/slpkg/toolbar.py
@@ -24,10 +24,7 @@
import sys
import time
-from colors import (
- GREY,
- ENDC
-)
+from __metadata__ import color
def status(index, width, step):
@@ -35,7 +32,7 @@ def status(index, width, step):
Print toolbar status
'''
if index == width:
- sys.stdout.write("{0}.{1}".format(GREY, ENDC))
+ sys.stdout.write("{0}.{1}".format(color['GREY'], color['ENDC']))
sys.stdout.flush()
width += step
time.sleep(0.05)
diff --git a/slpkg/tracking.py b/slpkg/tracking.py
index 03f57735..f34c7b5e 100755
--- a/slpkg/tracking.py
+++ b/slpkg/tracking.py
@@ -27,16 +27,9 @@ from messages import template
from init import Initialization
from __metadata__ import (
pkg_path,
+ color,
sp
)
-from colors import (
- RED,
- GREEN,
- GREY,
- YELLOW,
- CYAN,
- ENDC
-)
from pkg.find import find_package
@@ -62,7 +55,8 @@ def track_dep(name, repo):
'slacky': Initialization().slacky
}
init_repos[repo]()
- sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
+ sys.stdout.write("{0}Reading package lists ...{1}".format(color['GREY'],
+ color['ENDC']))
sys.stdout.flush()
if repo == "sbo":
dependencies_list = sbo_dependencies_pkg(name)
@@ -70,7 +64,7 @@ def track_dep(name, repo):
else:
dependencies_list = dependencies_pkg(name, repo)
find_pkg = search_pkg(name, repo)
- sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
+ sys.stdout.write("{0}Done{1}\n".format(color['GREY'], color['ENDC']))
if find_pkg:
requires, dependencies = [], []
# Create one list for all packages
@@ -86,20 +80,23 @@ def track_dep(name, repo):
pkg_len = len(name) + 24
print("") # new line at start
template(pkg_len)
- print("| Package {0}{1}{2} dependencies :".format(CYAN, name, ENDC))
+ print("| Package {0}{1}{2} dependencies :".format(color['CYAN'], name,
+ color['ENDC']))
template(pkg_len)
print("\\")
- print(" +---{0}[ Tree of dependencies ]{1}".format(YELLOW, ENDC))
+ print(" +---{0}[ Tree of dependencies ]{1}".format(color['YELLOW'],
+ color['ENDC']))
index = 0
for pkg in dependencies:
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, color['GREEN'],
+ pkg, color['ENDC']))
else:
print(" |")
- print(" {0}{1}: {2}{3}{4}".format("+--", index, RED, pkg, ENDC))
+ print(" {0}{1}: {2}{3}{4}".format("+--", index, color['RED'],
+ pkg, color['ENDC']))
print("") # new line at end
else:
print("\nNo package was found to match\n")