updated for version 1.0.3

This commit is contained in:
dslackw 2014-05-10 00:48:25 +03:00
parent 4f3128f41d
commit ba79a09004
4 changed files with 22 additions and 11 deletions

View file

@ -1,3 +1,9 @@
10-05-2014
Version 1.0.3
[Updated] - bin/slpkg added function find_package
10-05-2014 10-05-2014
Version 1.0.2 Version 1.0.2

View file

@ -1,6 +1,6 @@
Metadata-Version: 1.1 Metadata-Version: 1.1
Name: slpkg Name: slpkg
Version: 1.0.2 Version: 1.0.3
Author: dslackw Author: dslackw
Author-email: d zlatanidis at gmail com Author-email: d zlatanidis at gmail com
Maintainer: dslackw Maintainer: dslackw

View file

@ -7,7 +7,7 @@ import sys
import argparse import argparse
import subprocess import subprocess
__version__ = "1.0.2" __version__ = "1.0.3"
__author__ = "dslackw" __author__ = "dslackw"
__license__ = "GPLv3" __license__ = "GPLv3"
@ -15,6 +15,14 @@ __license__ = "GPLv3"
__packages__ = "/var/log/packages/" __packages__ = "/var/log/packages/"
# this fuction return the path of the package
def find_package(find_pkg):
find_pkg = subprocess.check_output(["find " + __packages__ + " -name '{}*' 2> /dev/null".format(find_pkg)],shell=True)
return find_pkg
# main function # main function
def main(): def main():
description = "Slpkg is a Slackware tool to upgrade, remove, find and view packages contents" description = "Slpkg is a Slackware tool to upgrade, remove, find and view packages contents"
@ -42,8 +50,7 @@ def main():
# uninstall package # uninstall package
if args.remove: if args.remove:
find_pkg = subprocess.check_output(["find " + __packages__ + " -name '{}*' 2> /dev/null".format(args.remove)],shell=True) if find_package(args.remove) == "":
if find_pkg == "":
os.system("echo -e '\e[31mThe package is not found\e[39m'") os.system("echo -e '\e[31mThe package is not found\e[39m'")
else: else:
os.system("echo -e '\e[93m!!! WARNING !!!\e[39m'") os.system("echo -e '\e[93m!!! WARNING !!!\e[39m'")
@ -57,19 +64,17 @@ def main():
# find if packages installed on your system # find if packages installed on your system
if args.find: if args.find:
find_pkg = subprocess.check_output(["find " + __packages__ + " -name '{}*' 2> /dev/null".format(args.find)],shell=True) if find_package(args.find) == "":
if find_pkg == "":
os.system("echo -e '\e[31mThe package is not installed on your system\e[39m'") os.system("echo -e '\e[31mThe package is not installed on your system\e[39m'")
else: else:
os.system("echo -e '\e[32mThe package is installed on your system\e[39m'") os.system("echo -e '\e[32mThe package is installed on your system\e[39m'")
# print the package contents # print the package contents
if args.display: if args.display:
find_pkg = subprocess.check_output(["find " + __packages__ + " -name '{}*' 2> /dev/null".format(args.display)],shell=True) if find_package(args.display) == "":
if find_pkg == "":
os.system("echo -e '\e[31mThe package is not found\e[39m'") os.system("echo -e '\e[31mThe package is not found\e[39m'")
else: else:
os.system("cat {}".format(find_pkg)) os.system("cat {}".format(find_package(args.display)))
main() main()

View file

@ -8,13 +8,13 @@ from distutils.core import setup
setup( setup(
name='Slpkg', name='Slpkg',
py_modules=['slpkg'], py_modules=['slpkg'],
version='1.0.2', version='1.0.3',
description="Python tool to manage Slackware packages", description="Python tool to manage Slackware packages",
keywords=["slpkg", "upgrade", "install", "remove", "view", "slackpkg", "tool"], keywords=["slpkg", "upgrade", "install", "remove", "view", "slackpkg", "tool"],
author="dslackw", author="dslackw",
author_email="d.zlatanidis@gmail.com", author_email="d.zlatanidis@gmail.com",
url="https://github.com/dslackw/slpkg", url="https://github.com/dslackw/slpkg",
download_url="https://github.com/dslackw/slpkg/archive/v1.0.2.tar.gz", download_url="https://github.com/dslackw/slpkg/archive/v1.0.3.tar.gz",
scripts=['bin/slpkg'], scripts=['bin/slpkg'],
package_data={"": ["LICENSE", "README.rst", "CHANGELOG"]}, package_data={"": ["LICENSE", "README.rst", "CHANGELOG"]},
classifiers=[ classifiers=[