From 139da51d377288e33f3ec402a8067a5d67ce83da Mon Sep 17 00:00:00 2001 From: dslackw Date: Thu, 31 Jul 2014 06:44:04 +0300 Subject: [PATCH] updated for version 1.6.7 --- CHANGELOG | 7 +++ PKG-INFO | 119 ++++++++++++++++++++++++---------------- README.rst | 36 ++++++------ bin/slpkg | 7 +++ man/slpkg.8 | 33 ++++++----- setup.py | 1 + slpkg/__metadata__.py | 2 +- slpkg/main.py | 14 ++--- slpkg/messages.py | 3 +- slpkg/pkg/__init__.py | 1 + slpkg/pkg/manager.py | 114 ++++++++++++++++---------------------- slpkg/sbo/__init__.py | 1 + slpkg/sbo/check.py | 2 +- slpkg/sbo/read.py | 7 ++- slpkg/sbo/search.py | 1 - slpkg/sbo/views.py | 12 ++-- slpkg/slack/__init__.py | 1 + slpkg/slack/mirrors.py | 2 +- 18 files changed, 198 insertions(+), 165 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 11b4e67c..65d0cba1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +31-07-2014 +Version 1.6.7 + +[Updated[ - Fix packages remove + Fix OSError: [Errno 2] No such file or directory: + Fix messages + 30-07-2014 Version 1.6.6 diff --git a/PKG-INFO b/PKG-INFO index 502a55b0..009e08a4 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,12 +1,12 @@ Metadata-Version: 1.1 Name: slpkg -Version: 1.6.6 +Version: 1.6.7 Author: dslackw Author-email: d zlatanidis at gmail com Maintainer: dslackw Maintainer-email: d zlatanidis at gmail com Home-page: https://github.com/dslackw/slpkg -Summary: Utility to help package management in Slackware +Summary: Utility for easy management packages in Slackware Description: .. image:: https://badge.fury.io/py/slpkg.png :target: http://badge.fury.io/py/slpkg .. image:: https://pypip.in/d/slpkg/badge.png @@ -14,10 +14,7 @@ Description: .. image:: https://badge.fury.io/py/slpkg.png .. image:: https://pypip.in/license/slpkg/badge.png :target: https://pypi.python.org/pypi/slpkg - Slpkg is a terminal tool in order to easy use Slackware packages. - - .. image:: https://raw.githubusercontent.com/dslackw/slpkg/master/logo/slpkg.png - :alt: logo + Slpkg is a terminal multitool in order to easy use Slackware packages. Features ======== @@ -47,7 +44,7 @@ Description: .. image:: https://badge.fury.io/py/slpkg.png .. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/screenshot-1.png - :target: https://asciinema.org/a/10939 + :target: https://asciinema.org/a/11059 Installation ------------ @@ -77,31 +74,36 @@ https://raw.githubusercontent.com/dslackw/images/master/slpkg/screenshot-1.png .. code-block:: bash - usage: slpkg [-h] [-v] [-a script [source ...]] [-l all, sbo [all, sbo ...]] - [-t] [-n] [-c] [-s] [-i [...]] [-u [...]] [-o [...]] - [-r [...]] [-f [...]] [-d [...]] + usage: slpkg [-h] [-v] [-a script [source ...]] + [-l all, sbo, slack, noarch, other [all, sbo, slack, noarch, +other ...]] + [-c sbo, slack [sbo, slack ...]] + [-s sbo, slack [sbo, slack ...]] [-t] [-n] [-i [...]] + [-u [...]] [-o [...]] [-r [...]] [-f [...]] [-d [...]] - Utility to help package management in Slackware + Utility for easy management packages in Slackware - optional arguments: + optional arguments: -h, --help show this help message and exit -v, --verbose print version and exit -a script [source ...] auto build package - -l all, sbo [all, sbo ...] + -l all, sbo, slack, noarch, other [all, sbo, slack, noarch, other ...] list of installed packages - -t tracking dependencies - -n find from SBo repositority -c sbo, slack [sbo, slack ...] check if your packages is up to date - -s download, build & install pkg from SBo + -s sbo, slack [sbo, slack ...] + download, build & install packages + -t tracking dependencies + -n find packages from SBo repository -i [ ...] install binary packages - -u [ ...] install-upgrade packages with new - -o [ ...] reinstall the same packages + -u [ ...] upgrade binary packages + -o [ ...] reinstall binary packages -r [ ...] remove packages -f [ ...] find if packages installed -d [ ...] display the contents of the packages + Slpkg Examples -------------- @@ -110,7 +112,11 @@ https://raw.githubusercontent.com/dslackw/images/master/slpkg/screenshot-1.png .. code-block:: bash - $ slpkg -s brasero + $ slpkg -s sbo brasero + + +============================================================================== + | Build dependecies tree for package brasero + +============================================================================== Searching [ brasero ] from slackbuilds.org ... Searching [ libunique ] from slackbuilds.org ... Searching [ gst1-plugins-bad ] from slackbuilds.org ... @@ -118,6 +124,11 @@ https://raw.githubusercontent.com/dslackw/images/master/slpkg/screenshot-1.png Searching [ gstreamer1 ] from slackbuilds.org ... Searching [ orc ] from slackbuilds.org ... + +============================================================================== + | Start download, build and install packages + +============================================================================== + Searching [ orc ] from slackbuilds.org ... + +============================================================================== | Installing new package /tmp/brasero-3.11.3-x86_64-1_SBo.tgz +============================================================================== @@ -145,6 +156,21 @@ https://raw.githubusercontent.com/dslackw/images/master/slpkg/screenshot-1.png | Package brasero installed +============================================================================== + Find packages from `Slackware official mirrors `_ + download and install: + + .. code-block:: bash + + $ slpkg -s slack mozilla + + Packages with name matching [ mozilla ] + + [ install ] --> mozilla-firefox-24.1.0esr-x86_64-1 + [ install ] --> mozilla-nss-3.15.2-x86_64-2 + [ install ] --> mozilla-thunderbird-24.1.0-x86_64-1 + + Would you like to install [Y/y] + Tracking all dependencies of packages: .. code-block:: bash @@ -154,22 +180,23 @@ https://raw.githubusercontent.com/dslackw/images/master/slpkg/screenshot-1.png +========================= | brasero dependencies : +========================= - | - | - +-- 1 orc - | - +-- 1 gstreamer1 - | - +-- 1 gst1-plugins-base - | - +-- 2 libunique gst1-plugins-bad + \ + +---[ Tree of dependecies ] + | + +-- 1 orc + | + +-- 1 gstreamer1 + | + +-- 1 gst1-plugins-base + | + +-- 2 libunique, gst1-plugins-bad Check if your packages is up to date from slackbuilds.org: .. code-block:: bash $ slpkg -c sbo flashplayer-plugin - Searching `flashplayer-plugin` from slackbuilds.org ... + Searching [ flashplayer-plugin ] from slackbuilds.org ... New version is available: +============================================================================== @@ -179,11 +206,11 @@ https://raw.githubusercontent.com/dslackw/images/master/slpkg/screenshot-1.png Would you like to install ? [Y/y] $ slpkg -c sbo ranger - Searching `ranger` from slackbuilds.org ... + Searching [ ranger ] from slackbuilds.org ... Package ranger is up to date - $ slpkg -c termcolor + $ slpkg -c sbo termcolor No such package termcolor: Can't find @@ -201,25 +228,23 @@ https://raw.githubusercontent.com/dslackw/images/master/slpkg/screenshot-1.png .. code-block:: bash $ slpkg -n bitfighter - Searching `bitfighter` from slackbuilds.org ... + Searching [ bitfighter ] from slackbuilds.org ... +=============================================================================== - | The `bitfighter` found in --> + | Package bitfighter --> http://slackbuilds.org/repository/14.1/games/bitfighter/ +=============================================================================== - | Download SlackBuild : -http://slackbuilds.org/slackbuilds/14.1/games/bitfighter.tar.gz - | Source Downloads : http://bitfighter.org/files/bitfighter-019c.tar.gz - | Extra Downloads : -https://bitfighter.googlecode.com/files/classic_level_pack.zip - | Package requirements : OpenAL SDL2 speex libmodplug + | SlackBuild : bitfighter.tar.gz + | Source : bitfighter-019c.tar.gz + | Extra : classic_level_pack.zip + | Requirements : OpenAL, SDL2, speex, libmodplug +=============================================================================== - README View the README file - SlackBuild View the SlackBuild file - Info View the Info file - Download Download this package - Build Download and build this package - Install Download/Build/Install + README View the README file + SlackBuild View the SlackBuild file + Info View the Info file + Download Download this package + Build Download and build this package + Install Download/Build/Install _ @@ -341,7 +366,7 @@ https://bitfighter.googlecode.com/files/classic_level_pack.zip [ installed ] - yetris-2.0.1-x86_64-1_SBo No such package you-get: Cant find [ installed ] - rar-5.0.1-x86_64-1_SBo - [ installed ] - pip-1.5.4-x86_64-1_SBo + [ installed ] - pip-1.5.4-x86_64-1_SBo Display the contents of the package: @@ -456,3 +481,5 @@ Classifier: Topic :: Software Development :: Build Tools Classifier: Topic :: System :: Archiving :: Packaging Classifier: Topic :: System :: Software Distribution Classifier: Topic :: Utilities + + diff --git a/README.rst b/README.rst index 81d18f0e..fe355388 100644 --- a/README.rst +++ b/README.rst @@ -1,11 +1,11 @@ -.. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/logo.png - :target: slpkg logo .. image:: https://badge.fury.io/py/slpkg.png :target: http://badge.fury.io/py/slpkg .. image:: https://pypip.in/d/slpkg/badge.png :target: https://pypi.python.org/pypi/slpkg .. image:: https://pypip.in/license/slpkg/badge.png :target: https://pypi.python.org/pypi/slpkg +.. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/logo.png + :target: https://github.com/dslackw/slpkg Slpkg is a terminal multitool in order to easy use Slackware packages. @@ -67,7 +67,7 @@ Command Line Tool Usage .. code-block:: bash usage: slpkg [-h] [-v] [-a script [source ...]] - [-l all, sbo, slack, noarch, other [all, sbo, slack, noarch, other ...]] + [-l all, sbo, slack, noarch, other] [-c sbo, slack [sbo, slack ...]] [-s sbo, slack [sbo, slack ...]] [-t] [-n] [-i [...]] [-u [...]] [-o [...]] [-r [...]] [-f [...]] [-d [...]] @@ -79,19 +79,19 @@ Command Line Tool Usage -v, --verbose print version and exit -a script [source ...] auto build package - -l all, sbo, slack, noarch, other [all, sbo, slack, noarch, other ...] + -l all, sbo, slack, noarch, other list of installed packages -c sbo, slack [sbo, slack ...] check if your packages is up to date -s sbo, slack [sbo, slack ...] download, build & install packages -t tracking dependencies - -n find packages from SBo repository + -n view packages from SBo repository -i [ ...] install binary packages -u [ ...] upgrade binary packages -o [ ...] reinstall binary packages -r [ ...] remove packages - -f [ ...] find if packages installed + -f [ ...] view installed packages -d [ ...] display the contents of the packages @@ -119,7 +119,9 @@ build and install with all dependencies : | Start download, build and install packages +============================================================================== Searching [ orc ] from slackbuilds.org ... - + . + . + . +============================================================================== | Installing new package /tmp/brasero-3.11.3-x86_64-1_SBo.tgz +============================================================================== @@ -138,15 +140,6 @@ build and install with all dependencies : Executing install script for brasero-3.11.3-x86_64-1_SBo.tgz. Package brasero-3.11.3-x86_64-1_SBo.tgz installed. - +============================================================================== - | Package orc installed - | Package gstreamer1 installed - | Package gst1-plugins-base installed - | Package gst1-plugins-bad installed - | Package libunique installed - | Package brasero installed - +============================================================================== - Find packages from `Slackware official mirrors `_ download and install: @@ -347,7 +340,10 @@ Find if your packages installed: .. code-block:: bash $ slpkg -f termcolor lua yetris you-get rar pip - [ installed ] - termcolor-1.1.0-x86_64-1_SBo + + Packages with name matching [ termcolor, lua, yetris, you-get, rar, pip ] + + [ installed ] - termcolor-1.1.0-x86_64-1_SBo No such package lua: Cant find [ installed ] - yetris-2.0.1-x86_64-1_SBo No such package you-get: Cant find @@ -407,7 +403,9 @@ Remove package: .. code-block:: bash $ slpkg -r termcolor - + + Packages with name matching [ termcolor ] + [ delete ] --> termcolor-1.1.0-x86_64-1_SBo Are you sure to remove 1 package(s) [Y/y] y @@ -439,6 +437,8 @@ Remove package: $ slpkg -f termcolor lua rar + Packages with name matching [ termcolor, lua, rar ] + No such package termcolor: Cant find No such package lua: Cant find [ installed ] - rar-5.0.1-x86_64-1_SBo diff --git a/bin/slpkg b/bin/slpkg index 229e097e..d30c5bf6 100755 --- a/bin/slpkg +++ b/bin/slpkg @@ -2,6 +2,13 @@ # -*- coding: utf-8 -*- ''' + _ _ + ___| |_ __ | | ____ _ +/ __| | '_ \| |/ / _` | +\__ \ | |_) | < (_| | +|___/_| .__/|_|\_\__, | + |_| |___/ + Slpkg is a terminal tool in order to easy use Slackware packages.It's a quick and easy way to manage your packages in slackware to a command. diff --git a/man/slpkg.8 b/man/slpkg.8 index a836810d..69c6332a 100644 --- a/man/slpkg.8 +++ b/man/slpkg.8 @@ -15,9 +15,9 @@ .SH NAME slpkg - Utility for easy management packages in Slackware .SH SYNOPSIS - \fBslpkg\fP \fB-h\fP \fB-v\fP \fB-a script [source ...]\fP \fB-l all, sbo [all, sbo ...]\fP - \fB-t\fP \fB-n\fP \fB-c sbo, slack [sbo, slack ...]\fP \fB-s\ slack [sbo, slack ...] fP\fB-i - [...]\fP \fB-u [...]\fP \fB-o [...]\fP \fB-r [...]\fP \fB-f [...]\fP \fB-d [...]\fP + \fBslpkg\fP \fB-h\fP \fB-v\fP \fB-a script [source ...]\fP \fB-l all, sbo, slack, noarch, other\fP + \fB-t\fP \fB-n\fP \fB-c sbo, slack [sbo, slack ...]\fP \fB-s\ slack [sbo, slack ...] fP\fB-i [...]\fP + \fB-u [...]\fP \fB-o [...]\fP \fB-r [...]\fP \fB-f [...]\fP \fB-d [...]\fP .SH DESCRIPTION \fBslpkg\fP is a terminal multitool in order to easy use Slackware packages. .PP @@ -26,8 +26,8 @@ It's a quick and easy way to manage your packages in slackware to a command. \fB-h, --help show this help message and exit\fP \fB-v, --verbose print version and exit\fP \fB-a script [source ...]\fP - \fB auto build package\fP - \fB-l all, sbo [all, sbo, slack, noarch, other [all, sbo, slack, noarch, other ...]\fP + \fB auto build packages\fP + \fB-l all, sbo, slack, noarch, other\fP \fB list of installed packages\fP \fB-c sbo, slack [sbo, slack ...]\fp \fB check if your packages is up to date\fP @@ -35,12 +35,12 @@ It's a quick and easy way to manage your packages in slackware to a command. \fB download, build & install packages\fP \fB list of installed packages\fP \fB-t tracking dependencies\fP - \fB-n find packages from SBo repositority\fP + \fB-n view packages from SBo repositority\fP \fB-i [ ...] install binary packages\fP \fB-u [ ...] upgrade binary packages\fP \fB-o [ ...] reinstall binary packages\fP \fB-r [ ...] remove packages\fP - \fB-f [ ...] find if packages installed\fP + \fB-f [ ...] view installed packages\fP \fB-d [ ...] display the contents of the packages\fP .SH GLOBAL OPTIONS @@ -55,7 +55,7 @@ The following commands are available. .PP With this argument, build slackware package from source quickly and easy. Support .tar.gz and .tar.bz2 slackbuilds archives. -.SS -l all, sbo [all, sbo ...] +.SS -l all, sbo, slack, noarch, other \fBslpkg\fP \fB-l\fP <\fIall\fP> <\fIsbo\fP> .PP Two display options list, one for all packages and another @@ -142,10 +142,10 @@ $ \fBslpkg -t brasero\fP | -- 2 libunique gst1-plugins-bad -$ \fBslpkg -s brasero\fP +$ \fBslpkg -s sbo brasero\fP +============================================================================== - | Build dependecies tree for package brasero + | Build dependencies tree for package brasero +============================================================================== Searching [ brasero ] from slackbuilds.org ... Searching [ libunique ] from slackbuilds.org ... @@ -153,7 +153,9 @@ $ \fBslpkg -s brasero\fP Searching [ gst1-plugins-base ] from slackbuilds.org ... Searching [ gstreamer1 ] from slackbuilds.org ... Searching [ orc ] from slackbuilds.org ... - + . + . + . +============================================================================== | Installing new package /tmp/brasero-3.11.3-x86_64-1_SBo.tgz +============================================================================== @@ -221,7 +223,10 @@ $ \fBslpkg -u /tmp/termcolor-1.1.0-x86_64-1_SBo.tgz\fP $ \fBslpkg -r termcolor yetris\fP + Packages with name matching [ termcolor, yetris ] + [ delete ] -- > termcolor-1.1.0-x86_64-1_SBo + No such package yetris: Can't find Are you sure to remove 1 package(s) [Y/y] @@ -233,11 +238,13 @@ $ \fBslpkg -r termcolor yetris\fP $ \fBslpkg -f termcolor\fP - Package: termcolor not found + Packages with name matching [ termcolor ] + + No such package termcolor: Can't find $ \fBslpkg -d termcolor\fP - Package: termcolor not found + No such package termcolor: Can't dislpay $ \fBslpkg -v\fP diff --git a/setup.py b/setup.py index def29a7d..9152f45e 100644 --- a/setup.py +++ b/setup.py @@ -49,3 +49,4 @@ if 'install' in sys.argv: man_page = "man/slpkg.8" shutil.copy2(man_page, man_path) os.chmod(man_path, int('444', 8)) + diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py index 0dd5f16f..1638ab31 100644 --- a/slpkg/__metadata__.py +++ b/slpkg/__metadata__.py @@ -5,7 +5,7 @@ import os __all__ = "slpkg" __author__ = "dslackw" -__version_info__ = (1, 6, 6) +__version_info__ = (1, 6, 7) __version__ = "{0}.{1}.{2}".format(*__version_info__) __license__ = "GNU General Public License v3 (GPLv3)" __email__ = "d.zlatanidis@gmail.com" diff --git a/slpkg/main.py b/slpkg/main.py index 6e5222e5..a43a9459 100755 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -27,7 +27,7 @@ s::::::::::::::s l::::::lp::::::::::::::::p k::::::k k:::::kg::::::::::::::::g gggggg usage: slpkg [-h] [-v] [-a script [source ...]] - [-l all, sbo, slack, noarch, other [all, sbo, slack, noarch, other ...]] + [-l all, sbo, slack, noarch, other] [-c sbo, slack [sbo, slack ...]] [-s sbo, slack [sbo, slack ...]] [-t] [-n] [-i [...]] [-u [...]] [-o [...]] [-r [...]] [-f [...]] [-d [...]] @@ -38,7 +38,7 @@ optional arguments: -h, --help show this help message and exit -v, --verbose print version and exit -a script [source ...] - auto build package + auto build packages -l all, sbo, slack, noarch, other [all, sbo, slack, noarch, other ...] list of installed packages -c sbo, slack [sbo, slack ...] @@ -51,7 +51,7 @@ optional arguments: -u [ ...] upgrade binary packages -o [ ...] reinstall binary packages -r [ ...] remove packages - -f [ ...] find if packages installed + -f [ ...] view packages installed -d [ ...] display the contents of the packages ''' @@ -78,9 +78,9 @@ def main(): parser = argparse.ArgumentParser(description=description) parser.add_argument("-v", "--verbose", help="print version and exit", action="store_true") - parser.add_argument("-a", help="auto build package", + parser.add_argument("-a", help="auto build packages", type=str, nargs="+", metavar=('script', 'source')) - parser.add_argument("-l", help="list of installed packages", nargs="+", + parser.add_argument("-l", help="list of installed packages", choices="all sbo slack noarch other".split(), metavar=('all, sbo, slack, noarch, other')) parser.add_argument("-c", help="check if your packages is up to date", @@ -89,7 +89,7 @@ def main(): type=str, nargs="+", metavar=('sbo, slack')) parser.add_argument("-t", help="tracking dependencies", type=str, metavar=('')) - parser.add_argument("-n", help="find packages from SBo repository", + parser.add_argument("-n", help="view packages from SBo repository", type=str, metavar=('')) parser.add_argument("-i", help="install binary packages", type=str, nargs="+", metavar=('')) @@ -99,7 +99,7 @@ def main(): type=str, nargs="+", metavar=('')) parser.add_argument("-r", help="remove packages", type=str, nargs="+", metavar=('')) - parser.add_argument("-f", help="find if packages installed", + parser.add_argument("-f", help="view installed packages", type=str, nargs="+", metavar=('')) parser.add_argument("-d", help="display the contents of the packages", type=str, nargs="+", metavar=('')) diff --git a/slpkg/messages.py b/slpkg/messages.py index e645cae9..02b2fbd5 100755 --- a/slpkg/messages.py +++ b/slpkg/messages.py @@ -28,8 +28,7 @@ def ext_err_args(): Extended error arguments view ''' print ("usage: {0} [-h] [-v] [-a script [source ...]]".format(__all__)) - print (" [-l all, sbo, slack, noarch, other [all, sbo, slack, \ - noarch, other ...]]") + print (" [-l all, sbo, slack, noarch, other]") print (" [-c sbo, slack [sbo, slack ...]] [-t] [-n]") print (" [-s sbo, slack [sbo, slack ...]] [-i [...]] [-u [...]]") print (" [-o [...]] [-r [...]] [-f [...]] [-d [...]]") diff --git a/slpkg/pkg/__init__.py b/slpkg/pkg/__init__.py index e69de29b..66e7b439 100644 --- a/slpkg/pkg/__init__.py +++ b/slpkg/pkg/__init__.py @@ -0,0 +1 @@ +# [ pkg ] directory diff --git a/slpkg/pkg/manager.py b/slpkg/pkg/manager.py index 7e7f5bd0..89a1556d 100755 --- a/slpkg/pkg/manager.py +++ b/slpkg/pkg/manager.py @@ -16,25 +16,25 @@ def pkg_install(binary): Install Slackware binary packages ''' s_user(getpass.getuser()) - for pkg in range(len(binary)): + for pkg in binary: try: - print subprocess.check_output('installpkg {0}'.format(binary[pkg]), shell=True) + print subprocess.check_output('installpkg {0}'.format(pkg), shell=True) except subprocess.CalledProcessError: message = "Can't install" if len(binary) > 1: bol, eol = "", "" else: bol, eol = "\n", "\n" - pkg_not_found(bol, binary[pkg], message, eol) + pkg_not_found(bol, pkg, message, eol) def pkg_upgrade(binary): ''' Upgrade Slackware binary packages ''' s_user(getpass.getuser()) - for pkg in range(len(binary)): + for pkg in binary: try: - print subprocess.check_output('upgradepkg --install-new {0}'.format(binary[pkg]), + print subprocess.check_output('upgradepkg --install-new {0}'.format(pkg), shell=True) except subprocess.CalledProcessError: message = "Can't upgrade" @@ -42,16 +42,16 @@ def pkg_upgrade(binary): bol, eol = "", "" else: bol, eol = "\n", "\n" - pkg_not_found(bol, binary[pkg], message, eol) + pkg_not_found(bol, pkg, message, eol) def pkg_reinstall(binary): ''' Reinstall Slackware binary packages ''' s_user(getpass.getuser()) - for pkg in range(len(binary)): + for pkg in binary: try: - print subprocess.check_output('upgradepkg --reinstall {0}'.format(binary[pkg]), + print subprocess.check_output('upgradepkg --reinstall {0}'.format(pkg), shell=True) except subprocess.CalledProcessError: message = "Can't reinstall" @@ -59,92 +59,74 @@ def pkg_reinstall(binary): bol, eol = "", "" else: bol, eol = "\n", "\n" - pkg_not_found(bol, binary[pkg], message, eol) + pkg_not_found(bol, pkg, message, eol) def pkg_remove(binary): ''' - Unistall Slackware binary packages + Remove Slackware binary packages ''' s_user(getpass.getuser()) - pkgs = [] - for pkg in range(len(binary)): - if find_package(binary[pkg] + sp, pkg_path) == []: - message = "Can't remove" - if len(binary) > 1: - bol, eol = "", "" - else: - bol, eol = "\n", "\n" - pkg_not_found(bol, binary[pkg], message, eol) - else: - pkgs.append(binary[pkg]) - if pkgs == []: - sys.exit() - count = [] - print # new line at start - for pkg in range(len(binary)): - pkgs = find_package(binary[pkg] + sp, pkg_path) - if pkgs != []: + removed = [] + not_found = [] + print ("\nPackages with name matching [ {0}{1}{2} ]\n".format( + colors.CYAN, ', '.join(binary), colors.ENDC)) + for pkg in binary: + pkgs = find_package(pkg + sp, pkg_path) + if pkgs: print (colors.RED + "[ delete ] --> " + colors.ENDC + "\n ".join(pkgs)) - count.append(pkgs) - sum_pkgs = 0 - for i in range(len(count)): - sum_pkgs += len(count[i]) - remove_pkg = raw_input("\nAre you sure to remove " + str(sum_pkgs) + " package(s) [Y/y] ") - if remove_pkg == "y" or remove_pkg == "Y": - results_removed = [] - not_found = [] - for pkg in range(len(binary)): - if find_package(binary[pkg] + sp, pkg_path) == []: - not_found.append(binary[pkg]) - else: - try: - results_removed.append("".join(find_package(binary[pkg] + sp, pkg_path))) - print subprocess.check_output('removepkg {0}'.format(binary[pkg]), - shell=True) - except subprocess.CalledProcessError: - file_not_found(binary[pkg]) - template(78) - for file in results_removed: - if find_package(file + sp, pkg_path) == []: - print ("| Package: {0} removed".format(file)) - for file in not_found: - print ("| Package: {0} not found".format(file)) - template(78) + removed.append(pkg) + else: + message = "Can't remove" + bol, eol = "", "" + not_found.append(pkg) + pkg_not_found(bol, pkg, message, eol) + if removed == []: print # new line at end + sys.exit() + remove_pkg = raw_input("\nAre you sure to remove " + str(len(removed)) + " package(s) [Y/y] ") + if remove_pkg == "y" or remove_pkg == "Y": + for rmv in removed: + print subprocess.check_output('removepkg {0}'.format(rmv), shell=True) + template(78) + for pkg in removed: + if find_package(pkg + sp, pkg_path) == []: + print ("| Package: {0} removed".format(pkg)) + for pkg in not_found: + print ("| Package: {0} not found".format(pkg)) + template(78) + print # new line at end def pkg_find(binary): ''' Find installed Slackware packages ''' - print # new line at start - for pkg in range(len(binary)): - if find_package(binary[pkg] + sp, pkg_path) == []: + print ("\nPackages with name matching [ {0}{1}{2} ]\n".format( + colors.CYAN, ', '.join(binary), colors.ENDC)) + for pkg in binary: + if find_package(pkg + sp, pkg_path) == []: message = "Can't find" - if len(binary) > 1: - bol, eol = "", "" - else: - bol, eol = "\n", "\n" - pkg_not_found(bol, binary[pkg], message, eol) + bol, eol = "", "" + pkg_not_found(bol, pkg, message, eol) else: print (colors.GREEN + "[ installed ] - " + colors.ENDC + "\n ".join( - find_package(binary[pkg] + sp, pkg_path))) + find_package(pkg + sp, pkg_path))) print # new line at end def pkg_display(binary): ''' Print the Slackware packages contents ''' - for pkg in range(len(binary)): - if find_package(binary[pkg] + sp, pkg_path) == []: + for pkg in binary: + if find_package(pkg + sp, pkg_path) == []: message = "Can't dislpay" if len(binary) > 1: bol, eol = "", "" else: bol, eol = "\n", "\n" - pkg_not_found(bol, binary[pkg], message, eol) + pkg_not_found(bol, pkg, message, eol) else: print subprocess.check_output("cat {0}{1}".format(pkg_path, - " /var/log/packages/".join(find_package(binary[pkg] +sp, pkg_path))), shell=True) + " /var/log/packages/".join(find_package(pkg +sp, pkg_path))), shell=True) def pkg_list(binary): ''' diff --git a/slpkg/sbo/__init__.py b/slpkg/sbo/__init__.py index e69de29b..71519fb9 100644 --- a/slpkg/sbo/__init__.py +++ b/slpkg/sbo/__init__.py @@ -0,0 +1 @@ +# [ sbo ] directory diff --git a/slpkg/sbo/check.py b/slpkg/sbo/check.py index dd54f8bf..8bd0e86d 100755 --- a/slpkg/sbo/check.py +++ b/slpkg/sbo/check.py @@ -64,4 +64,4 @@ def sbo_check(name): pkg_upgrade(binary) else: print ("\nPackage {0} is up to date\n".format( - "".join(find_package(name + sp, pkg_path)))) + "".join(find_package(name + sp, pkg_path)))) diff --git a/slpkg/sbo/read.py b/slpkg/sbo/read.py index f31b8500..60205d0b 100755 --- a/slpkg/sbo/read.py +++ b/slpkg/sbo/read.py @@ -5,9 +5,10 @@ import os import getpass from slpkg.messages import s_user from slpkg.url_read import url_read +from slpkg.__metadata__ import slpkg_path # create tmp directory if not exist -os.system("mkdir -p /tmp/slpkg/readme/") +os.system("mkdir -p /tmp/readme/") def read_readme(sbo_url, name, site): ''' @@ -15,7 +16,7 @@ def read_readme(sbo_url, name, site): ''' s_user(getpass.getuser()) readme = url_read((sbo_url + site).replace("repository", "slackbuilds")) - file = open("/tmp/slpkg/readme/" + name + "." + site, "w") + file = open("{0}readme/{1}.{2}".format(slpkg_path, name, site), "w") file.write(readme) file.close() @@ -25,6 +26,6 @@ def read_info_slackbuild(sbo_url, name, site): ''' s_user(getpass.getuser()) info = url_read((sbo_url + name + site).replace("repository", "slackbuilds")) - file = open("/tmp/slpkg/readme/" + name + site, "w") + file = open("{0}readme/{1}{2}".format(slpkg_path, name, site), "w") file.write(info) file.close() diff --git a/slpkg/sbo/search.py b/slpkg/sbo/search.py index 8a2e4ae4..40173d2b 100755 --- a/slpkg/sbo/search.py +++ b/slpkg/sbo/search.py @@ -25,4 +25,3 @@ def sbo_search_pkg(name): for loc in sbo_location: if get_file(loc, '/') == name: return sbo_url + loc.replace(name, '') + name + "/" - diff --git a/slpkg/sbo/views.py b/slpkg/sbo/views.py index 36e60630..370a40a3 100755 --- a/slpkg/sbo/views.py +++ b/slpkg/sbo/views.py @@ -48,18 +48,18 @@ def sbo_network(name): elif read == "R" or read == "r": site = "README" read_readme(sbo_url, name, site) - os.system("less {0}/readme/{1}.{2}".format(slpkg_path, name, site)) - os.remove("{0}/readme/{1}.{2}".format(slpkg_path, name, site)) + os.system("less {0}readme/{1}.{2}".format(slpkg_path, name, site)) + os.remove("{0}readme/{1}.{2}".format(slpkg_path, name, site)) elif read == "F" or read == "f": site = ".info" read_info_slackbuild(sbo_url, name, site) - os.system("less {0}/readme/{1}{2}".format(slpkg_path, name, site)) - os.remove("{0}/readme/{1}{2}".format(slpkg_path, name, site)) + os.system("less {0}readme/{1}{2}".format(slpkg_path, name, site)) + os.remove("{0}readme/{1}{2}".format(slpkg_path, name, site)) elif read == "S" or read == "s": site = ".SlackBuild" read_info_slackbuild(sbo_url, name, site) - os.system("less {0}/readme/{1}{2}".format(slpkg_path, name, site)) - os.remove("{0}/readme/{1}{2}".format(slpkg_path, name, site)) + os.system("less {0}readme/{1}{2}".format(slpkg_path, name, site)) + os.remove("{0}readme/{1}{2}".format(slpkg_path, name, site)) elif read == "B" or read == "b": s_user(getpass.getuser()) script = get_file(sbo_dwn, "/") diff --git a/slpkg/slack/__init__.py b/slpkg/slack/__init__.py index e69de29b..066ec507 100644 --- a/slpkg/slack/__init__.py +++ b/slpkg/slack/__init__.py @@ -0,0 +1 @@ +# [ slack ] directory diff --git a/slpkg/slack/mirrors.py b/slpkg/slack/mirrors.py index 27d2a499..8352893d 100755 --- a/slpkg/slack/mirrors.py +++ b/slpkg/slack/mirrors.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -from slpkg. __metadata__ import arch +from slpkg.__metadata__ import arch from slack_version import slack_ver def mirrors(name, location):