update code

This commit is contained in:
Dimitris Zlatanidis 2014-10-29 13:58:44 +02:00
parent 96da4e5348
commit 71583dee63
2 changed files with 83 additions and 57 deletions

80
slpkg/arguments.py Executable file
View file

@ -0,0 +1,80 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# arguments.py file is part of slpkg.
# Copyright 2014 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Utility for easy management packages in Slackware
# https://github.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __metadata__ import __version__
def options():
arguments = [
"slpkg - version {0}\n".format(__version__),
"Utility for easy management packages in Slackware\n",
"Optional arguments:",
" -h, --help show this help message " +
"and exit",
" -v, --version print version and exit",
" -a, script [source...] auto build packages",
" -b, --list, [package...] --add, --remove add, remove packages in " +
"blacklist",
" -q, --list, [package...] --add, --remove add, remove packages in " +
"queue",
" --build, --install, --build-install build or install from " +
"queue",
" -l, all, sbo, slack, noarch list of installed " +
"packages",
" -c, <repository> --upgrade --current check for updated " +
"packages",
" -s, <repository> <package> --current download, build & install",
" -f, <package> find installed packages",
" -t, <package> tracking dependencies " +
"from SBo",
" -n, <package> view packages from SBo",
" -i, [package...] install binary packages",
" -u, [package...] upgrade binary packages",
" -o, [package...] reinstall binary packages",
" -r, [package...] remove binary packages",
" -d, [package...] display the contents\n",
"Repositories:",
" SlackBuilds = sbo",
" Slackware = slack '--current'\n",
]
for opt in arguments:
print(opt)
def usage():
view = [
"slpkg - version {0}\n".format(__version__),
"Usage: slpkg [-h] [-v] [-a script [sources...]]",
" [-b --list, [...] --add, --remove]",
" [-q --list, [...] --add, --remove]",
" [-q --build, --install, --build-install]",
" [-l all, sbo, slack, noarch]",
" [-c <repository> --upgrade --current]",
" [-s <repository> <package> --current]",
" [-f] [-t] [-n] [-i [...]] [-u [...]]",
" [-o [...]] [-r [...]] [-d [...]]\n",
"For more information try 'slpkg --help'\n"
]
for usg in view:
print(usg)

View file

@ -28,7 +28,8 @@ from queue import QueuePkgs
from messages import s_user
from blacklist import BlackList
from version import prog_version
from __metadata__ import path, __version__
from __metadata__ import path
from arguments import options, usage
from pkg.build import BuildPackage
from pkg.manager import PackageManager
@ -42,61 +43,6 @@ from slack.install import Slack
from slack.patches import Patches
def help():
arguments = [
"slpkg - version {0}\n".format(__version__),
"Utility for easy management packages in Slackware\n",
"Optional arguments:",
" -h, --help show this help message " +
"and exit",
" -v, --version print version and exit",
" -a, script [source...] auto build packages",
" -b, --list, [package...] --add, --remove add, remove packages in " +
"blacklist",
" -q, --list, [package...] --add, --remove add, remove packages in " +
"queue",
" --build, --install, --build-install build or install from " +
"queue",
" -l, all, sbo, slack, noarch list of installed " +
"packages",
" -c, <repository> --upgrade --current check for updated " +
"packages",
" -s, <repository> <package> --current download, build & install",
" -f, <package> find installed packages",
" -t, <package> tracking dependencies " +
"from SBo",
" -n, <package> view packages from SBo",
" -i, [package...] install binary packages",
" -u, [package...] upgrade binary packages",
" -o, [package...] reinstall binary packages",
" -r, [package...] remove binary packages",
" -d, [package...] display the contents\n",
"Repositories:",
" SlackBuilds = sbo",
" Slackware = slack '--current'\n",
]
for opt in arguments:
print(opt)
def usage():
usage = [
"slpkg - version {0}\n".format(__version__),
"Usage: slpkg [-h] [-v] [-a script [sources...]]",
" [-b --list, [...] --add, --remove]",
" [-q --list, [...] --add, --remove]",
" [-q --build, --install, --build-install]",
" [-l all, sbo, slack, noarch]",
" [-c <repository> --upgrade --current]",
" [-s <repository> <package> --current]",
" [-f] [-t] [-n] [-i [...]] [-u [...]]",
" [-o [...]] [-r [...]] [-d [...]]\n",
"For more information try 'slpkg --help'\n"
]
for opt in usage:
print(opt)
def main():
# root privileges required
@ -110,7 +56,7 @@ def main():
usage()
elif (len(args) == 1 and args[0] == "-h" or
args[0] == "--help" and args[1:] == []):
help()
options()
elif (len(args) == 1 and args[0] == "-v" or
args[0] == "--version" and args[1:] == []):
prog_version()