mac9416 has proposed merging lp:~mac9416/keryx/devel into lp:keryx/devel. Requested reviews: Keryx Admins (keryx-admins) -- https://code.launchpad.net/~mac9416/keryx/devel/+merge/9995 Your team Keryx Development Team is subscribed to branch lp:keryx/devel.
=== modified file 'keryx.py' --- keryx.py 2009-07-31 16:10:10 +0000 +++ keryx.py 2009-08-11 18:27:53 +0000 @@ -1,9 +1,10 @@ -import sys, platform from optparse import OptionParser -from lib import meta +import platform +import sys -PROGRAM = meta.appName -VERSION = meta.appVersion +#START setup logging +PROGRAM = 'Keryx' +VERSION = '1.0 alpha' USAGE = """%prog [options] [command] arg1 arg2\n\n Commands: create\tCreates a project @@ -22,67 +23,77 @@ pkgnames\tList the names of all packages in the system """ +import logging + def parse(args=None): """ Parses options and arguments passed """ parser = OptionParser(usage=USAGE, version='%s %s' % (PROGRAM, VERSION)) - parser.set_defaults(verbose=False) + parser.set_defaults(log_level=logging.WARNING) - parser.add_option('-V', '--verbose', action='store_true', help='') - parser.add_option('-q', '--quiet', action='store_false', dest='verbose', help='') + parser.add_option('-V', '--verbose', action='store_const', dest="log_level", const=logging.INFO, help='Show vervose output') + parser.add_option('-d', '--debug', action='store_const', dest="log_level", const=logging.DEBUG, help='Show debugging output') if args: return parser.parse_args(args) else: return parser.parse_args() +LOG_FORMAT = '%(asctime)s %(levelname)-8s %(message)s' +DATE = '%a, %d %b %Y %H:%M:%S' +logging.basicConfig(format=LOG_FORMAT, date=DATE) +opts, args = parse(sys.argv[1:]) +logging.root.setLevel(opts.log_level) + +import libkeryx +#END setup logging + def main(argv=None): """ Main function of execution """ - opts, args = parse(argv) if len(args) == 0: - print 'ERROR: No commands provided. Exiting.' + logging.error('No commands provided. Exiting.') elif args[0] == 'create': if len(args) < 2: # If there isn't a project name provided project_name = raw_input('Please enter a project name [%s]: ' % (platform.node())) if not project_name: project_name = platform.node() - print 'create is not yet implemented. Exiting.' + logging.error('create is not yet implemented. Exiting.') elif args[0] == 'update': - print 'update is not yet implemented. Exiting.' + logging.error('update is not yet implemented. Exiting.') elif args[0] == 'upgrade': - print 'upgrade is not yet implemented. Exiting.' + logging.error('upgrade is not yet implemented. Exiting.') elif args[0] == 'download': if len(args) < 2: # If there isn't a package name provided package_names = getPacknameFromUser() - print 'download is not yet implemented. Exiting.' + logging.error('download is not yet implemented. Exiting.') elif args[0] == 'install': if len(args) < 2: # If there isn't a package name provided package_names = getPacknameFromUser() - print 'install is not yet implemented. Exiting.' + logging.error('install is not yet implemented. Exiting.') elif args[0] == 'remove': if len(args) < 2: # If there isn't a package name provided package_names = getPacknameFromUser() - print 'remove is not yet implemented. Exiting.' + logging.error('remove is not yet implemented. Exiting.') elif args[0] == 'dist-upgrade': - print 'dist-upgrade is not yet implemented. Exiting.' + logging.error('dist-upgrade is not yet implemented. Exiting.') elif args[0] == 'apt-clean': - print 'apt-clean is not yet implemented. Exiting.' + logging.error('apt-clean is not yet implemented. Exiting.') elif args[0] == 'clean': - print 'clean is not yet implemented. Exiting.' + logging.error('clean is not yet implemented. Exiting.') elif args[0] == 'showpkg': - print 'showpkg creation is not yet implemented. Exiting.' + logging.error('showpkg creation is not yet implemented. Exiting.') elif args[0] == 'search': if len(args) < 2: # If there isn't a package name provided package_names = getPacknameFromUser() - print 'search creation is not yet implemented. Exiting.' + logging.error('search creation is not yet implemented. Exiting.') elif args[0] == 'show': - print 'show creation is not yet implemented. Exiting.' + logging.error('show creation is not yet implemented. Exiting.') elif args[0] == 'depends': - print 'depends creation is not yet implemented. Exiting.' + logging.error('depends creation is not yet implemented. Exiting.') elif args[0] == 'pkgnames': - print 'pkgnames creation is not yet implemented. Exiting.' + logging.error('pkgnames creation is not yet implemented. Exiting.') else: - print 'Invalid operation: %s' % (args[0]) + logging.error('Invalid operation: %s' % (args[0])) exit() def getPacknameFromUser():
=== removed directory 'lib' === removed file 'lib/meta.py' --- lib/meta.py 2009-07-31 16:10:10 +0000 +++ lib/meta.py 1970-01-01 00:00:00 +0000 @@ -1,28 +0,0 @@ -import os, os.path -from gettext import gettext as _ - -# Strings -appName = 'Keryx' -appVersion = '1.0 alpha' -appNameShort = 'keryx' -appFileExt = '.keryx' -appComments = _('Bringing Updates Home.') - -authors = 'Chris Oliver\nBuran Ayuthia\nmac9416' -email = 'exc...@gmail.com' -artists = 'Chris Oliver' -docwriters = 'Chris Oliver' -translators = '' -copyright = '(C) 2008 Chris Oliver' -description = appName + _(' is a package manager for computers without internet.') -license = appName + _(""" 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 2 of the License, or (at your option) -any later version. - -Keryx 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 Keryx; -if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite -330, Boston, MA 02111-1307 USA""") === modified file 'libkeryx/__init__.py' --- libkeryx/__init__.py 2009-07-19 22:14:11 +0000 +++ libkeryx/__init__.py 2009-08-11 18:27:53 +0000 @@ -1,12 +1,14 @@ """ Keryx library """ # Imports +import logging import os.path import platform import re import sys from database import * +from meta import * # Library metadata __appname__ = 'libkeryx' @@ -67,7 +69,7 @@ filenameToModuleName = lambda f: os.path.splitext(f)[0] moduleNames = map(filenameToModuleName, files) definitions = map(__import__, moduleNames) - print 'Loaded %i definitions' % len(definitions) + logging.info('Loaded %i definitions' % len(definitions)) def getDefinition(filename): """ Finds the correct definition based on the currrent OS or file """ === added file 'libkeryx/meta.py' --- libkeryx/meta.py 1970-01-01 00:00:00 +0000 +++ libkeryx/meta.py 2009-08-11 18:27:53 +0000 @@ -0,0 +1,28 @@ +import os, os.path +from gettext import gettext as _ + +# Strings +appName = 'Keryx' +appVersion = '1.0 alpha' +appNameShort = 'keryx' +appFileExt = '.keryx' +appComments = _('Bringing Updates Home.') + +authors = 'Chris Oliver\nBuran Ayuthia\nmac9416' +email = 'exc...@gmail.com' +artists = 'Chris Oliver' +docwriters = 'Chris Oliver' +translators = '' +copyright = '(C) 2008 Chris Oliver' +description = appName + _(' is a package manager for computers without internet.') +license = appName + _(""" 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 2 of the License, or (at your option) +any later version. + +Keryx 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 Keryx; +if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite +330, Boston, MA 02111-1307 USA""")
_______________________________________________ Mailing list: https://launchpad.net/~keryx Post to : keryx@lists.launchpad.net Unsubscribe : https://launchpad.net/~keryx More help : https://help.launchpad.net/ListHelp