Merge branch 'develop'

This commit is contained in:
Dimitris Zlatanidis 2019-12-03 19:56:04 +01:00
commit 247d20e519
33 changed files with 134 additions and 193 deletions

View file

@ -8,4 +8,4 @@ as important how a package is build.
Small changes in the code each time more appreciated. Small changes in the code each time more appreciated.
Keep the style code applicable items. Keep the style code applicable items.
Please ensure your changes work in Python 2.7.5+ Please ensure your changes work in Python >= 3.7

View file

@ -1,4 +1,14 @@
3.7.0 - 1/12/2019 3.7.1 - 03/12/2019
Updated:
- pythondialog dependency
- slackware mirrors
- pip installation method
- improved setup.py file for python3
- print function for python3 format
Added:
- Dependency python requests replace bult-in python urllib
3.7.0 - 01/12/2019
Updated: Updated:
- Switch to python3 - Switch to python3

View file

@ -22,4 +22,5 @@ There are mainly 3 ways:
2. Download binary package from '`https://sourceforge.net/projects/slpkg/files/binary/`' 2. Download binary package from '`https://sourceforge.net/projects/slpkg/files/binary/`'
and use Slackware command '`upgradepkg --install-new <slpkg binary>`' and use Slackware command '`upgradepkg --install-new <slpkg binary>`'
3. Using pip: '`pip install https://gitlab.com/dslackw/slpkg/-/archive/3.7.0/slpkg-3.7.0.tar.gz`' 3. Using pip: '`pip3 install https://gitlab.com/dslackw/slpkg/-/archive/3.7.0/slpkg-3.7.0.tar.gz`'
or instead '`'python3 -m pip install`''.

View file

@ -1,4 +1,4 @@
# slpkg 3.7.0 # slpkg 3.7.1
Slpkg is a powerful software package manager that installs, updates, and removes packages on Slpkg is a powerful software package manager that installs, updates, and removes packages on
[Slackware](http://www.slackware.com/) based systems. It automatically computes dependencies and [Slackware](http://www.slackware.com/) based systems. It automatically computes dependencies and
@ -13,6 +13,17 @@ What makes slpkg to distinguish it from the other tools; The user friendliness i
target as well as easy to understand and use, also use colors to highlight packages and target as well as easy to understand and use, also use colors to highlight packages and
display warning messages, etc. display warning messages, etc.
#### Asciicast:
[<img src="https://asciinema.org/a/3uFNAOX8o16AmKKJDIvdezPBa" width="250"/>](https://asciinema.org/a/3uFNAOX8o16AmKKJDIvdezPBa)
##### Copyright ##### Copyright
Copyright 2014-2019 © Dimitris Zlatanidis. Slackware® is a Registered Trademark of Patrick Volkerding. Linux is a Registered Trademark of Linus Torvalds. Copyright 2014-2019 © Dimitris Zlatanidis. Slackware® is a Registered Trademark of Patrick Volkerding. Linux is a Registered Trademark of Linus Torvalds.

View file

@ -40,5 +40,5 @@ if __name__ == "__main__":
s_user() s_user()
main() main()
except KeyboardInterrupt: except KeyboardInterrupt:
print("") print()
raise SystemExit() raise SystemExit()

View file

@ -32,8 +32,7 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# #
# #
# Last Updated: Tue Jan 15 14:54:01 UTC 2019 # Last Updated: Mon Dec 2 14:54:02 UTC 2019
#
# Available https mirrors: # Available https mirrors:
# #
# bg https://mirrors.linux-bulgaria.org/slackware/ # bg https://mirrors.linux-bulgaria.org/slackware/
@ -48,7 +47,6 @@
# de https://mirror.netcologne.de/slackware/ # de https://mirror.netcologne.de/slackware/
# dk https://mirrors.dotsrc.org/slackware/ # dk https://mirrors.dotsrc.org/slackware/
# ec https://mirror.cedia.org.ec/slackware/ # ec https://mirror.cedia.org.ec/slackware/
# fr https://mirrors.phx.ms/slackware/
# gb https://lon.mirror.rackspace.com/slackware/ # gb https://lon.mirror.rackspace.com/slackware/
# gb https://mirror.bytemark.co.uk/slackware/ # gb https://mirror.bytemark.co.uk/slackware/
# gb https://www.mirrorservice.org/sites/ftp.slackware.com/pub/slackware/ # gb https://www.mirrorservice.org/sites/ftp.slackware.com/pub/slackware/
@ -85,6 +83,7 @@
# us https://slackware.absolutehosting.net/pub/slackware/ # us https://slackware.absolutehosting.net/pub/slackware/
# #
# #
#
# Available http mirrors: # Available http mirrors:
# #
# au http://ftp.swin.edu.au/slackware/ # au http://ftp.swin.edu.au/slackware/
@ -97,7 +96,6 @@
# bg http://x.ultranet.biz/slackware/ # bg http://x.ultranet.biz/slackware/
# br http://ftp.slackware-brasil.com.br/ # br http://ftp.slackware-brasil.com.br/
# br http://linorg.usp.br/slackware/ # br http://linorg.usp.br/slackware/
# br http://slackmirror.cbpf.br/pub/slackware/
# by http://mirror.datacenter.by/pub/slackware/ # by http://mirror.datacenter.by/pub/slackware/
# cz http://ftp.linux.cz/pub/linux/slackware/ # cz http://ftp.linux.cz/pub/linux/slackware/
# de http://download.dlackware.com/slackware/ # de http://download.dlackware.com/slackware/
@ -123,8 +121,10 @@
# ph http://mirror.rise.ph/slackware/ # ph http://mirror.rise.ph/slackware/
# pl http://mirror.onet.pl/pub/mirrors/slackware/ # pl http://mirror.onet.pl/pub/mirrors/slackware/
# ru http://slackware.tsu.ru/slackware/ # ru http://slackware.tsu.ru/slackware/
# sg http://download.nus.edu.sg/mirror/slackware/
# tr http://ftp.linux.org.tr/slackware/ # tr http://ftp.linux.org.tr/slackware/
# tw http://ftp.isu.edu.tw/pub/Linux/Slackware/ # tw http://ftp.isu.edu.tw/pub/Linux/Slackware/
# ua http://slackware.ip-connect.info/
# us http://ftp.gtlib.gatech.edu/pub/slackware/ # us http://ftp.gtlib.gatech.edu/pub/slackware/
# us http://ftp.slackware.com/pub/slackware/ # us http://ftp.slackware.com/pub/slackware/
# us http://mirror.cs.princeton.edu/pub/mirrors/slackware/ # us http://mirror.cs.princeton.edu/pub/mirrors/slackware/
@ -135,76 +135,3 @@
# za http://ftp.is.co.za/mirror/ftp.slackware.com/pub/ # za http://ftp.is.co.za/mirror/ftp.slackware.com/pub/
# za http://ftp.wa.co.za/pub/slackware/ # za http://ftp.wa.co.za/pub/slackware/
# za http://slackware.mirror.ac.za/ # za http://slackware.mirror.ac.za/
#
#
# Available ftp mirrors:
#
# au ftp://ftp.swin.edu.au/slackware/
# au ftp://mirror.as24220.net/pub/slackware/slackware64-14.2/
# au ftp://mirror.internode.on.net/pub/slackware/
# au ftp://syd.mirror.rackspace.com/slackware/
# bg ftp://mirrors.netix.net/slackware/
# bg ftp://mirrors.slackware.bg/slackware/
# bg ftp://mirrors.unixsol.org/slackware/
# bg ftp://slackware.telecoms.bg/slackware/
# br ftp://ftp.slackware-brasil.com.br/
# br ftp://linorg.usp.br/slackware/
# by ftp://mirror.datacenter.by/pub/slackware/
# ca ftp://mirror.csclub.uwaterloo.ca/slackware/
# ca ftp://mirror.its.dal.ca/slackware/
# ca ftp://slackware.freemirror.org/slackware/
# cr ftp://mirrors.ucr.ac.cr/slackware/pub/slackware/
# cz ftp://ftp.linux.cz/pub/linux/slackware/
# de ftp://ftp.tu-chemnitz.de/pub/linux/slackware/
# de ftp://ftp6.gwdg.de/pub/linux/slackware/
# de ftp://linux.rz.rub.de/slackware/
# de ftp://mirror.de.leaseweb.net/slackware/
# de ftp://mirror.netcologne.de/slackware/
# de ftp://mirrors.nav.ro/slackware/
# dk ftp://mirrors.dotsrc.org/slackware/
# ec ftp://mirror.cedia.org.ec/slackware/
# gb ftp://ftp.mirrorservice.org/sites/ftp.slackware.com/pub/slackware/
# gb ftp://lon.mirror.rackspace.com/slackware/
# gb ftp://mirror.bytemark.co.uk/slackware/
# gb ftp://slackware.uk/slackware/
# gr ftp://ftp.cc.uoc.gr/mirrors/linux/slackware/
# gr ftp://ftp.ntua.gr/pub/linux/slackware/
# gr ftp://ftp.otenet.gr/pub/linux/slackware/
# hk ftp://hkg.mirror.rackspace.com/slackware/
# hr ftp://mirror.slackware.hr/slackware/
# jp ftp://ftp.kddilabs.jp/Linux/distributions/Slackware/
# jp ftp://ftp.nara.wide.ad.jp/pub/Linux/slackware/
# jp ftp://ftp.riken.jp/Linux/slackware/
# nc ftp://mirror.lagoon.nc/pub/slackware/
# nl ftp://ftp.nluug.nl/pub/os/Linux/distr/slackware/
# nl ftp://mirror.nl.leaseweb.net/slackware/
# no ftp://ftp.slackware.no/slackware/
# nz ftp://ftp.slackware.org.nz/slackware/
# ph ftp://mirror.rise.ph/slackware/
# pl ftp://ftp.slackware.pl/pub/slackware/
# pl ftp://mirror.onet.pl/pub/mirrors/slackware/
# pl ftp://sunsite.icm.edu.pl/pub/Linux/slackware/
# pt ftp://ftp.rnl.tecnico.ulisboa.pt/pub/slackware/
# ru ftp://mirror.yandex.ru/slackware/
# ru ftp://slackware.tsu.ru/slackware/
# se ftp://ftp.acc.umu.se/mirror/slackware.com/
# tr ftp://ftp.linux.org.tr/slackware/
# tw ftp://ftp.yzu.edu.tw/Linux/Slackware/
# ua ftp://ifconfig.com.ua/pub/Mirror/slackware/
# ua ftp://mirrors.nix.org.ua/linux/slackware/
# us ftp://dfw.mirror.rackspace.com/slackware/
# us ftp://ftp.gtlib.gatech.edu/pub/slackware
# us ftp://ftp.lug.udel.edu/pub/slackware/
# us ftp://ftp.slackware.com/pub/slackware/
# us ftp://ftp.ussg.indiana.edu/linux/slackware/
# us ftp://mirror.cs.princeton.edu/pub/mirrors/slackware/
# us ftp://mirror.slackbuilds.org/pub/slackware/
# us ftp://mirror.us.leaseweb.net/slackware/
# us ftp://mirrors.syringanetworks.net/slackware/
# us ftp://mirrors.xmission.com/slackware/
# us ftp://slackware.absolutehosting.net/pub/slackware/
# us ftp://slackware.cs.utah.edu/slackware/
# us ftp://slackware.mirrors.tds.net/pub/slackware
# za ftp://ftp.is.co.za/mirror/ftp.slackware.com/pub/
# za ftp://ftp.wa.co.za/pub/slackware/
# za ftp://slackware.mirror.ac.za/

View file

@ -9,4 +9,6 @@
# httpie (alternative downloader) # httpie (alternative downloader)
# pygraphviz >= 1.3.1 (drawing dependencies diagram) # pygraphviz >= 1.3.1 (drawing dependencies diagram)
# perl 5 language and graph-easy >= 0.75 (drawing dependencies ascii diagram) # perl 5 language and graph-easy >= 0.75 (drawing dependencies ascii diagram)
# python3-pythondialog >= 3.3.0 (Python interface to the UNIX dialog utility) # python3-pythondialog >= 3.5.0 (Python interface to the UNIX dialog utility)
python-requests >= 2.22.0

View file

@ -34,12 +34,14 @@ try:
except ImportError: except ImportError:
from distutils.core import setup from distutils.core import setup
INSTALLATION_REQUIREMENTS = [] docs_requires = []
DOCS_REQUIREMENTS = [] tests_requires = []
TESTS_REQUIREMENTS = [] install_requires = [
OPTIONAL_REQUIREMENTS = [ "requests>=2.22.0"
"python3-pythondialog >= 3.3.0", ]
"pygraphviz >= 1.3.1" optional_requires = [
"pythondialog>=3.5.0",
"pygraphviz>=1.3.1"
] ]
# Non-Python/non-PyPI optional dependencies: # Non-Python/non-PyPI optional dependencies:
@ -47,6 +49,7 @@ OPTIONAL_REQUIREMENTS = [
def print_logo(): def print_logo():
"""print slpkg logo"""
if "install" not in sys.argv: if "install" not in sys.argv:
logo_fname = os.path.join(os.path.dirname(__file__), 'logo.txt') logo_fname = os.path.join(os.path.dirname(__file__), 'logo.txt')
with open(logo_fname, 'rb') as f: with open(logo_fname, 'rb') as f:
@ -65,6 +68,7 @@ setup(
scripts=["bin/slpkg"], scripts=["bin/slpkg"],
version=_meta_.__version__, version=_meta_.__version__,
description="Package manager for Slackware installations", description="Package manager for Slackware installations",
long_description=open("README.md").read(),
keywords=["slackware", "slpkg", "upgrade", "install", "remove", keywords=["slackware", "slpkg", "upgrade", "install", "remove",
"view", "slackpkg", "tool", "build"], "view", "slackpkg", "tool", "build"],
author=_meta_.__author__, author=_meta_.__author__,
@ -74,11 +78,11 @@ setup(
data_files=[("man/man8", ["man/slpkg.8"]), data_files=[("man/man8", ["man/slpkg.8"]),
("/etc/bash_completion.d", ["conf/slpkg.bash-completion"]), ("/etc/bash_completion.d", ["conf/slpkg.bash-completion"]),
("/etc/fish/completions", ["conf/slpkg.fish"])], ("/etc/fish/completions", ["conf/slpkg.fish"])],
install_requires=INSTALLATION_REQUIREMENTS, install_requires=install_requires,
extras_require={ extras_require={
"optional": OPTIONAL_REQUIREMENTS, "optional": optional_requires,
"docs": DOCS_REQUIREMENTS, "docs": docs_requires,
"tests": TESTS_REQUIREMENTS, "tests": tests_requires,
}, },
classifiers=[ classifiers=[
"Development Status :: 5 - Production/Stable", "Development Status :: 5 - Production/Stable",
@ -86,14 +90,18 @@ setup(
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: POSIX :: Linux", "Operating System :: POSIX :: Linux",
"Operating System :: Unix", "Operating System :: Unix",
"Programming Language :: Python",
"Programming Language :: Python :: 3", "Programming Language :: Python :: 3",
"Programming Language :: Unix Shell", "Programming Language :: Unix Shell",
"Topic :: Software Development :: Build Tools", "Topic :: Software Development :: Build Tools",
"Topic :: System :: Archiving :: Packaging", "Topic :: System :: Archiving :: Packaging",
"Topic :: System :: Software Distribution", "Topic :: System :: Software Distribution",
"Topic :: System :: Installation/Setup",
"Topic :: System :: Systems Administration",
"Topic :: System :: Software Distribution",
"Topic :: Utilities"], "Topic :: Utilities"],
long_description=open("README.md").read() python_requires=">=3.7"
) )
# Install configuration files with pip. # Install configuration files with pip.
if "install" in sys.argv: if "install" in sys.argv:

View file

@ -78,7 +78,7 @@ class MetaData(object):
__all__ = "slpkg" __all__ = "slpkg"
__author__ = "dslackw" __author__ = "dslackw"
__version_info__ = (3, 7, 0) __version_info__ = (3, 7, 1)
__version__ = "{0}.{1}.{2}".format(*__version_info__) __version__ = "{0}.{1}.{2}".format(*__version_info__)
__license__ = "GNU General Public License v3 (GPLv3)" __license__ = "GNU General Public License v3 (GPLv3)"
__email__ = "d.zlatanidis@gmail.com" __email__ = "d.zlatanidis@gmail.com"

View file

@ -49,7 +49,7 @@ class Auto(object):
print("\nDetected Slackware binary package for installation:\n") print("\nDetected Slackware binary package for installation:\n")
for pkg in self.packages: for pkg in self.packages:
print(" " + pkg.split("/")[-1]) print(" " + pkg.split("/")[-1])
print("") print()
self.msg.template(78) self.msg.template(78)
print("| Choose a Slackware command:") print("| Choose a Slackware command:")
self.msg.template(78) self.msg.template(78)
@ -62,7 +62,7 @@ class Auto(object):
try: try:
self.choice = input(" > ") self.choice = input(" > ")
except EOFError: except EOFError:
print("") print()
raise SystemExit() raise SystemExit()
if self.choice in self.commands.keys(): if self.choice in self.commands.keys():
print(" \x1b[1A{0}{1}{2}\n\n".format( print(" \x1b[1A{0}{1}{2}\n\n".format(

View file

@ -140,7 +140,7 @@ class BinaryInstall(object):
print("After this process, {0} {1} of additional disk " print("After this process, {0} {1} of additional disk "
"space will be used.{2}".format(size[1], unit[1], "space will be used.{2}".format(size[1], unit[1],
self.meta.color["ENDC"])) self.meta.color["ENDC"]))
print("") print()
self.if_all_installed() self.if_all_installed()
if self.msg.answer() in ["y", "Y"]: if self.msg.answer() in ["y", "Y"]:
for inst, dwn in zip(self.dep_install + self.install, for inst, dwn in zip(self.dep_install + self.install,

View file

@ -60,7 +60,7 @@ class BlackList(object):
self.meta.color["ENDC"])) self.meta.color["ENDC"]))
self.quit = True self.quit = True
if self.quit: if self.quit:
print("") # new line at exit print() # new line at exit
def add(self, pkgs): def add(self, pkgs):
"""Add blacklist packages if not exist """Add blacklist packages if not exist
@ -77,7 +77,7 @@ class BlackList(object):
self.quit = True self.quit = True
black_conf.close() black_conf.close()
if self.quit: if self.quit:
print("") # new line at exit print() # new line at exit
def remove(self, pkgs): def remove(self, pkgs):
"""Remove packages from blacklist """Remove packages from blacklist
@ -93,7 +93,7 @@ class BlackList(object):
self.quit = True self.quit = True
remove.close() remove.close()
if self.quit: if self.quit:
print("") # new line at exit print() # new line at exit
def packages(self, pkgs, repo): def packages(self, pkgs, repo):
"""Return packages in blacklist or by repository """Return packages in blacklist or by repository

View file

@ -63,7 +63,7 @@ class Updates(object):
def status_bar(self): def status_bar(self):
"""Top view bar status """Top view bar status
""" """
print("") print()
self.msg.template(78) self.msg.template(78)
print("| Repository Status") print("| Repository Status")
self.msg.template(78) self.msg.template(78)

View file

@ -31,7 +31,7 @@ def check_md5(pkg_md5, src_file):
"""MD5 Checksum """MD5 Checksum
""" """
if _meta_.checkmd5 in ["on", "ON"]: if _meta_.checkmd5 in ["on", "ON"]:
print("") print()
md5s = md5(src_file) md5s = md5(src_file)
if pkg_md5 != md5s: if pkg_md5 != md5s:
Msg().template(78) Msg().template(78)
@ -42,7 +42,7 @@ def check_md5(pkg_md5, src_file):
print("| Expected: {0}".format(pkg_md5)) print("| Expected: {0}".format(pkg_md5))
print("| Found: {0}".format(md5s)) print("| Found: {0}".format(md5s))
Msg().template(78) Msg().template(78)
print("") print()
if not Msg().answer() in ["y", "Y"]: if not Msg().answer() in ["y", "Y"]:
raise SystemExit() raise SystemExit()
else: else:
@ -51,4 +51,4 @@ def check_md5(pkg_md5, src_file):
src_file.split("/")[-1], _meta_.color["GREEN"], src_file.split("/")[-1], _meta_.color["GREEN"],
_meta_.color["ENDC"])) _meta_.color["ENDC"]))
Msg().template(78) Msg().template(78)
print("") # new line after pass checksum print() # new line after pass checksum

View file

@ -40,7 +40,7 @@ class Config(object):
def view(self): def view(self):
"""View slpkg config file """View slpkg config file
""" """
print("") # new line at start print() # new line at start
conf_args = [ conf_args = [
"RELEASE", "RELEASE",
"SLACKWARE_VERSION", "SLACKWARE_VERSION",
@ -74,7 +74,7 @@ class Config(object):
else: else:
print("{0}{1}{2}".format(self.meta.color["CYAN"], line, print("{0}{1}{2}".format(self.meta.color["CYAN"], line,
self.meta.color["ENDC"])) self.meta.color["ENDC"]))
print("") # new line at end print() # new line at end
def edit(self): def edit(self):
"""Edit configuration file """Edit configuration file

View file

@ -56,7 +56,7 @@ class PkgDesc(object):
def view(self): def view(self):
"""Print package description by repository """Print package description by repository
""" """
print("") # new line at start print() # new line at start
description, count = "", 0 description, count = "", 0
if self.repo == "sbo": if self.repo == "sbo":
description = SBoGrep(self.name).description() description = SBoGrep(self.name).description()
@ -75,4 +75,4 @@ class PkgDesc(object):
self.msg.pkg_not_found("", self.name, "No matching", "\n") self.msg.pkg_not_found("", self.name, "No matching", "\n")
raise SystemExit(1) raise SystemExit(1)
if description and self.repo == "sbo": if description and self.repo == "sbo":
print("") print()

View file

@ -100,13 +100,13 @@ class Download(object):
"""Check if file downloaded """Check if file downloaded
""" """
if not os.path.isfile(self.path + self.file_name): if not os.path.isfile(self.path + self.file_name):
print("") print()
self.msg.template(78) self.msg.template(78)
print("| Download '{0}' file [ {1}FAILED{2} ]".format( print("| Download '{0}' file [ {1}FAILED{2} ]".format(
self.file_name, self.meta.color["RED"], self.file_name, self.meta.color["RED"],
self.meta.color["ENDC"])) self.meta.color["ENDC"]))
self.msg.template(78) self.msg.template(78)
print("") print()
if not self.msg.answer() in ["y", "Y"]: if not self.msg.answer() in ["y", "Y"]:
raise SystemExit() raise SystemExit()
@ -121,7 +121,7 @@ class Download(object):
print("| '{0}' need to go ahead downloading".format( print("| '{0}' need to go ahead downloading".format(
certificate[:23].strip())) certificate[:23].strip()))
self.msg.template(78) self.msg.template(78)
print("") print()
self.downder_options += certificate self.downder_options += certificate
if not self.msg.answer() in ["y", "Y"]: if not self.msg.answer() in ["y", "Y"]:
raise SystemExit() raise SystemExit()

View file

@ -23,8 +23,7 @@
import os import os
import urllib import requests
from urllib.request import urlopen
class FileSize(object): class FileSize(object):
@ -37,10 +36,9 @@ class FileSize(object):
"""Returns the size of remote files """Returns the size of remote files
""" """
try: try:
tar = urlopen(self.registry) r = requests.head(self.registry)
meta = tar.info() return int(r.headers["Content-Length"])
return int(meta.get_all("Content-Length")[0]) except (requests.exceptions.Timeout):
except (urllib.error.URLError, IndexError):
return " " return " "
def local(self): def local(self):

View file

@ -62,7 +62,7 @@ class PackageHealth(object):
elif not self.mode: elif not self.mode:
print(line) print(line)
except IOError: except IOError:
print("") print()
raise SystemExit() raise SystemExit()
def test(self): def test(self):
@ -87,7 +87,7 @@ class PackageHealth(object):
def results(self): def results(self):
"""Print results """Print results
""" """
print("") print()
per = int(round((float(self.cf) / (self.cf + self.cn)) * 100)) per = int(round((float(self.cf) / (self.cf + self.cn)) * 100))
if per > 90: if per > 90:
color = self.meta.color["GREEN"] color = self.meta.color["GREEN"]

View file

@ -784,7 +784,7 @@ class Update(object):
print(self.done, end="") print(self.done, end="")
else: else:
print(self.error, end="") print(self.error, end="")
print("") # new line at end print() # new line at end
raise SystemExit() raise SystemExit()

View file

@ -59,7 +59,7 @@ class Msg(object):
"directory or read the README file".format( "directory or read the README file".format(
self.meta.color["CYAN"], self.meta.color["ENDC"])) self.meta.color["CYAN"], self.meta.color["ENDC"]))
self.template(78) self.template(78)
print("") # new line at end print() # new line at end
def template(self, max_len): def template(self, max_len):
"""Print template """Print template
@ -126,14 +126,14 @@ class Msg(object):
try: try:
answer = input("Would you like to continue [y/N]? ") answer = input("Would you like to continue [y/N]? ")
except EOFError: except EOFError:
print("") print()
raise SystemExit() raise SystemExit()
return answer return answer
def security_pkg(self, pkg): def security_pkg(self, pkg):
"""Warning message for some special reasons """Warning message for some special reasons
""" """
print("") print()
self.template(78) self.template(78)
print("| {0}{1}*** WARNING ***{2}").format( print("| {0}{1}*** WARNING ***{2}").format(
" " * 27, self.meta.color["RED"], self.meta.color["ENDC"]) " " * 27, self.meta.color["RED"], self.meta.color["ENDC"])
@ -142,7 +142,7 @@ class Msg(object):
"| the README file. You can use the command " "| the README file. You can use the command "
"'slpkg -n {1}'").format(pkg, pkg) "'slpkg -n {1}'").format(pkg, pkg)
self.template(78) self.template(78)
print("") print()
def reference(self, install, upgrade): def reference(self, install, upgrade):
"""Reference list with packages installed """Reference list with packages installed
@ -159,7 +159,7 @@ class Msg(object):
if installed: if installed:
print("| Package {0} installed successfully".format(installed)) print("| Package {0} installed successfully".format(installed))
self.template(78) self.template(78)
print("") print()
def matching(self, packages): def matching(self, packages):
"""Message for matching packages """Message for matching packages

View file

@ -52,7 +52,7 @@ class NewConfig(object):
self.find_new() self.find_new()
for n in self.news: for n in self.news:
print("{0}".format(n)) print("{0}".format(n))
print("") print()
self.msg.template(78) self.msg.template(78)
print("| Installed {0} new configuration files:".format( print("| Installed {0} new configuration files:".format(
len(self.news))) len(self.news)))
@ -90,9 +90,9 @@ class NewConfig(object):
try: try:
choose = input("\nWhat would you like to do [K/O/R/P/Q]? ") choose = input("\nWhat would you like to do [K/O/R/P/Q]? ")
except EOFError: except EOFError:
print("") print()
raise SystemExit() raise SystemExit()
print("") print()
if choose in ("K", "k"): if choose in ("K", "k"):
self.keep() self.keep()
elif choose in ("O", "o"): elif choose in ("O", "o"):
@ -114,7 +114,7 @@ class NewConfig(object):
""" """
for n in self.news: for n in self.news:
self._remove(n) self._remove(n)
print("") print()
def prompt(self): def prompt(self):
"""Select file """Select file
@ -127,22 +127,22 @@ class NewConfig(object):
self.red, self.endc, self.br, self.red, self.endc, self.br, self.red, self.endc, self.br, self.red, self.endc, self.br,
self.red, self.endc, self.br, self.red, self.endc, self.br)) self.red, self.endc, self.br, self.red, self.endc, self.br))
self.msg.template(78) self.msg.template(78)
print("") print()
self.i = 0 self.i = 0
try: try:
while self.i < len(self.news): while self.i < len(self.news):
self.question(self.news[self.i]) self.question(self.news[self.i])
self.i += 1 self.i += 1
except EOFError: except EOFError:
print("") print()
raise SystemExit() raise SystemExit()
def question(self, n): def question(self, n):
"""Choose what do to file by file """Choose what do to file by file
""" """
print("") print()
prompt_ask = input("{0} [K/O/R/D/M/Q]? ".format(n)) prompt_ask = input("{0} [K/O/R/D/M/Q]? ".format(n))
print("") print()
if prompt_ask in ("K", "k"): if prompt_ask in ("K", "k"):
self.keep() self.keep()
elif prompt_ask in ("O", "o"): elif prompt_ask in ("O", "o"):

View file

@ -99,7 +99,7 @@ class PackageManager(object):
dependencies, rmv_list = [], [] dependencies, rmv_list = [], []
self.removed = self._view_removed() self.removed = self._view_removed()
if not self.removed: if not self.removed:
print("") # new line at end print() # new line at end
else: else:
msg = "package" msg = "package"
if len(self.removed) > 1: if len(self.removed) > 1:
@ -112,7 +112,7 @@ class PackageManager(object):
"\nAre you sure to remove {0} {1} [y/N]? ".format( "\nAre you sure to remove {0} {1} [y/N]? ".format(
str(len(self.removed)), msg)) str(len(self.removed)), msg))
except EOFError: except EOFError:
print("") # new line at exit print() # new line at exit
raise SystemExit() raise SystemExit()
if remove_pkg in ["y", "Y"]: if remove_pkg in ["y", "Y"]:
self._check_if_used(self.binary) self._check_if_used(self.binary)
@ -147,9 +147,9 @@ class PackageManager(object):
remove_dep = input( remove_dep = input(
"\nRemove dependencies (maybe used by " "\nRemove dependencies (maybe used by "
"other packages) [y/N]? ") "other packages) [y/N]? ")
print("") print()
except EOFError: except EOFError:
print("") # new line at exit print() # new line at exit
raise SystemExit() raise SystemExit()
return remove_dep return remove_dep
@ -276,7 +276,7 @@ class PackageManager(object):
dependencies.append("-".join(d.split("-")[:-1])) dependencies.append("-".join(d.split("-")[:-1]))
self.meta.remove_deps_answer = "y" self.meta.remove_deps_answer = "y"
else: else:
print("") # new line at start print() # new line at start
self.msg.template(78) self.msg.template(78)
print("| Found dependencies for the package {0}:".format( print("| Found dependencies for the package {0}:".format(
package)) package))
@ -339,7 +339,7 @@ class PackageManager(object):
try: try:
self.skip = input(" > ").split() self.skip = input(" > ").split()
except EOFError: except EOFError:
print("") print()
raise SystemExit() raise SystemExit()
for s in self.skip: for s in self.skip:
if s in self.removed: if s in self.removed:
@ -388,7 +388,7 @@ class PackageManager(object):
def _reference_rmvs(self, removes): def _reference_rmvs(self, removes):
"""Prints all removed packages """Prints all removed packages
""" """
print("") print()
self.msg.template(78) self.msg.template(78)
msg_pkg = "package" msg_pkg = "package"
if len(removes) > 1: if len(removes) > 1:
@ -401,7 +401,7 @@ class PackageManager(object):
else: else:
print("| Package {0} not found".format(pkg)) print("| Package {0} not found".format(pkg))
self.msg.template(78) self.msg.template(78)
print("") # new line at end print() # new line at end
def find(self, flag): def find(self, flag):
"""Find installed Slackware packages """Find installed Slackware packages
@ -498,7 +498,7 @@ class PackageManager(object):
r = self.list_lib(repo) r = self.list_lib(repo)
pkg_list = self.list_greps(repo, r)[0] pkg_list = self.list_greps(repo, r)[0]
all_installed_names = self.list_of_installed(repo, name) all_installed_names = self.list_of_installed(repo, name)
print("") print()
for pkg in sorted(pkg_list): for pkg in sorted(pkg_list):
pkg = self._splitting_packages(pkg, repo, name) pkg = self._splitting_packages(pkg, repo, name)
if installed: if installed:
@ -525,13 +525,13 @@ class PackageManager(object):
self.meta.color["ENDC"])) self.meta.color["ENDC"]))
if read in ["Q", "q"]: if read in ["Q", "q"]:
break break
print("") # new line after page print() # new line after page
page += row page += row
else: else:
print(pkg) print(pkg)
print("") # new line at end print() # new line at end
except EOFError: except (EOFError, KeyboardInterrupt, BrokenPipeError, IOError):
print("") # new line at exit print() # new line at exit
raise SystemExit() raise SystemExit()
def _splitting_packages(self, pkg, repo, name): def _splitting_packages(self, pkg, repo, name):

View file

@ -98,10 +98,10 @@ class RepoInfo(object):
self.form["Number of packages:"] = sum_sbo_pkgs self.form["Number of packages:"] = sum_sbo_pkgs
self.form["Status:"] = status self.form["Status:"] = status
self.form["Last updated:"] = last_upd self.form["Last updated:"] = last_upd
print("") print()
for key, value in sorted(self.form.items()): for key, value in sorted(self.form.items()):
print(self.meta.color["GREY"] + key + self.meta.color["ENDC"], value) print(self.meta.color["GREY"] + key + self.meta.color["ENDC"], value)
print("") print()
raise SystemExit() raise SystemExit()
def repository_data(self, repo): def repository_data(self, repo):

View file

@ -41,7 +41,7 @@ class RepoList(object):
"""View or enabled or disabled repositories """View or enabled or disabled repositories
""" """
def_cnt, cus_cnt = 0, 0 def_cnt, cus_cnt = 0, 0
print("") print()
self.msg.template(78) self.msg.template(78)
print("{0}{1}{2}{3}{4}{5}{6}".format( print("{0}{1}{2}{3}{4}{5}{6}".format(
"| Repo id", " " * 2, "| Repo id", " " * 2,

View file

@ -174,7 +174,7 @@ class SBoNetwork(object):
self.choice = input("{0}{1}{2}".format(self.grey, message, self.choice = input("{0}{1}{2}".format(self.grey, message,
self.endc)) self.endc))
except EOFError: except EOFError:
print("") print()
raise SystemExit() raise SystemExit()
try: try:
print("{0}\x1b[1A{1}{2}{3}\n".format( print("{0}\x1b[1A{1}{2}{3}\n".format(
@ -261,7 +261,7 @@ class SBoNetwork(object):
br1 = "(" br1 = "("
br2 = ")" br2 = ")"
fix_sp = "" fix_sp = ""
print("") # new line at start print() # new line at start
self.msg.template(78) self.msg.template(78)
print("| {0}{1}SlackBuilds Repository{2}".format(" " * 28, self.grey, print("| {0}{1}SlackBuilds Repository{2}".format(" " * 28, self.grey,
self.endc)) self.endc))
@ -365,7 +365,7 @@ class SBoNetwork(object):
pkg_security([self.name]) pkg_security([self.name])
self.error_uns() self.error_uns()
if self.FAULT: if self.FAULT:
print("") print()
self.msg.template(78) self.msg.template(78)
print("| Package {0} {1} {2} {3}".format(self.prgnam, self.red, print("| Package {0} {1} {2} {3}".format(self.prgnam, self.red,
self.FAULT, self.endc)) self.FAULT, self.endc))

View file

@ -86,7 +86,7 @@ class QueuePkgs(object):
self.meta.color["ENDC"])) self.meta.color["ENDC"]))
self.quit = True self.quit = True
if self.quit: if self.quit:
print("") # new line at exit print() # new line at exit
def add(self, pkgs): def add(self, pkgs):
"""Add packages in queue if not exist """Add packages in queue if not exist
@ -108,7 +108,7 @@ class QueuePkgs(object):
self.quit = True self.quit = True
queue.close() queue.close()
if self.quit: if self.quit:
print("") # new line at exit print() # new line at exit
def remove(self, pkgs): def remove(self, pkgs):
"""Remove packages from queue """Remove packages from queue
@ -124,7 +124,7 @@ class QueuePkgs(object):
self.quit = True self.quit = True
queue.close() queue.close()
if self.quit: if self.quit:
print("") # new line at exit print() # new line at exit
def build(self): def build(self):
"""Build packages from queue """Build packages from queue
@ -158,7 +158,7 @@ class QueuePkgs(object):
""" """
packages = self.packages() packages = self.packages()
if packages: if packages:
print("") # new line at start print() # new line at start
for pkg in packages: for pkg in packages:
ver = SBoGrep(pkg).version() ver = SBoGrep(pkg).version()
prgnam = "{0}-{1}".format(pkg, ver) prgnam = "{0}-{1}".format(pkg, ver)

View file

@ -112,7 +112,7 @@ class Patches(object):
print("After this process, {0} {1} of additional disk space " print("After this process, {0} {1} of additional disk space "
"will be used.{2}".format(size[1], unit[1], "will be used.{2}".format(size[1], unit[1],
self.meta.color["ENDC"])) self.meta.color["ENDC"]))
print("") print()
if self.msg.answer() in ["y", "Y"]: if self.msg.answer() in ["y", "Y"]:
Download(self.patch_path, self.dwn_links, Download(self.patch_path, self.dwn_links,
repo="slack").start() repo="slack").start()
@ -121,9 +121,12 @@ class Patches(object):
self.upgrade() self.upgrade()
self.kernel() self.kernel()
if self.meta.slackpkg_log in ["on", "ON"]: if self.meta.slackpkg_log in ["on", "ON"]:
# update the slackpkg ChanheLog.txt file
self.slackpkg_update() self.slackpkg_update()
self.msg.reference(self.installed, self.upgraded) self.msg.reference(self.installed, self.upgraded)
# delete the downloaded packages
delete_package(self.patch_path, self.upgrade_all) delete_package(self.patch_path, self.upgrade_all)
# update the packages lists
self.update_lists() self.update_lists()
else: else:
slack_arch = "" slack_arch = ""
@ -238,7 +241,7 @@ class Patches(object):
if self.meta.default_answer in ["y", "Y"]: if self.meta.default_answer in ["y", "Y"]:
answer = self.meta.default_answer answer = self.meta.default_answer
else: else:
print("") print()
self.msg.template(78) self.msg.template(78)
print("| {0}*** HIGHLY recommended reinstall boot loader " print("| {0}*** HIGHLY recommended reinstall boot loader "
"***{1}".format(self.meta.color["RED"], "***{1}".format(self.meta.color["RED"],
@ -247,9 +250,9 @@ class Patches(object):
self.msg.template(78) self.msg.template(78)
try: try:
answer = input("\nThe kernel has been upgraded, " answer = input("\nThe kernel has been upgraded, "
"reinstall boot loader [L/E/G]? ") "reinstall boot loader [L/E/G]? ")
except EOFError: except EOFError:
print("") print()
raise SystemExit() raise SystemExit()
if answer in ["L"]: if answer in ["L"]:
subprocess.call("lilo", shell=True) subprocess.call("lilo", shell=True)
@ -266,6 +269,8 @@ class Patches(object):
"""This replace slackpkg ChangeLog.txt file with new """This replace slackpkg ChangeLog.txt file with new
from Slackware official mirrors after update distribution. from Slackware official mirrors after update distribution.
""" """
print(mirrors("ChangeLog.txt", ""))
NEW_ChangeLog_txt = URL(mirrors("ChangeLog.txt", "")).reading() NEW_ChangeLog_txt = URL(mirrors("ChangeLog.txt", "")).reading()
if os.path.isfile(self.meta.slackpkg_lib_path + "ChangeLog.txt.old"): if os.path.isfile(self.meta.slackpkg_lib_path + "ChangeLog.txt.old"):
os.remove(self.meta.slackpkg_lib_path + "ChangeLog.txt.old") os.remove(self.meta.slackpkg_lib_path + "ChangeLog.txt.old")
@ -275,7 +280,6 @@ class Patches(object):
os.remove(self.meta.slackpkg_lib_path + "ChangeLog.txt") os.remove(self.meta.slackpkg_lib_path + "ChangeLog.txt")
with open(self.meta.slackpkg_lib_path + "ChangeLog.txt", "w") as log: with open(self.meta.slackpkg_lib_path + "ChangeLog.txt", "w") as log:
log.write(NEW_ChangeLog_txt) log.write(NEW_ChangeLog_txt)
log.close()
def update_lists(self): def update_lists(self):
"""Update packages list and ChangeLog.txt file after """Update packages list and ChangeLog.txt file after

View file

@ -61,10 +61,10 @@ def it_self_update():
try: try:
answer = input("Would you like to upgrade [y/N]? ") answer = input("Would you like to upgrade [y/N]? ")
except EOFError: except EOFError:
print("") print()
raise SystemExit() raise SystemExit()
if answer in ["y", "Y"]: if answer in ["y", "Y"]:
print("") # new line after answer print() # new line after answer
else: else:
raise SystemExit() raise SystemExit()
dwn_link = ["https://{0}.com/{1}/{2}/-/archive/" dwn_link = ["https://{0}.com/{1}/{2}/-/archive/"

View file

@ -85,7 +85,7 @@ class DependenciesStatus(object):
"""Show dependencies status """Show dependencies status
""" """
self.data() self.data()
print("") print()
self.msg.template(78) self.msg.template(78)
print("| {0}{1}{2}".format("Dependencies", " " * 20, "Packages")) print("| {0}{1}{2}".format("Dependencies", " " * 20, "Packages"))
self.msg.template(78) self.msg.template(78)

View file

@ -79,7 +79,7 @@ class TrackingDeps(object):
self.deps_tree() self.deps_tree()
self.msg.done() self.msg.done()
pkg_len = len(self.name) + 24 pkg_len = len(self.name) + 24
print("") # new line at start print() # new line at start
self.msg.template(pkg_len) self.msg.template(pkg_len)
print("| Package {0}{1}{2} dependencies :".format( print("| Package {0}{1}{2} dependencies :".format(
self.cyan, self.name, self.endc)) self.cyan, self.name, self.endc))
@ -114,7 +114,7 @@ class TrackingDeps(object):
if self.meta.use_colors in ["off", "OFF"]: if self.meta.use_colors in ["off", "OFF"]:
print("\n * = Installed\n") print("\n * = Installed\n")
else: else:
print("") # new line at end print() # new line at end
if "--graph=" in self.flag: if "--graph=" in self.flag:
self.graph() self.graph()
else: else:

View file

@ -54,5 +54,5 @@ def choose_upg(packages):
selected_packages.append(name) selected_packages.append(name)
if not selected_packages: if not selected_packages:
raise SystemExit() raise SystemExit()
print("") print()
return selected_packages return selected_packages

View file

@ -22,9 +22,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# import os import requests
import urllib
from urllib.request import urlopen
from slpkg.__metadata__ import MetaData as _meta_ from slpkg.__metadata__ import MetaData as _meta_
@ -40,27 +38,9 @@ class URL(object):
"""Open url and read """Open url and read
""" """
try: try:
''' f = requests.get(self.link)
# testing proxy return f.text
proxies = {} except (requests.exceptions.Timeout):
try:
proxies["http_proxy"] = os.environ['http_proxy']
except KeyError:
pass
try:
proxies["https_proxy"] = os.environ['https_proxy']
except KeyError:
pass
if len(proxies) != 0:
proxy = urllib2.ProxyHandler(proxies)
opener = urllib2.build_opener(proxy)
urllib2.install_opener(opener)
# end testing
'''
f = urlopen(self.link)
return f.read().decode("utf-8")
except (urllib.error.URLError, ValueError):
print("\n{0}Can't read the file '{1}'{2}".format( print("\n{0}Can't read the file '{1}'{2}".format(
self.meta.color["RED"], self.link.split("/")[-1], self.meta.color["RED"], self.link.split("/")[-1],
self.meta.color["ENDC"])) self.meta.color["ENDC"]))