diff options
Diffstat (limited to 'layman/layman/config.py')
-rw-r--r-- | layman/layman/config.py | 116 |
1 files changed, 0 insertions, 116 deletions
diff --git a/layman/layman/config.py b/layman/layman/config.py deleted file mode 100644 index c4658e7..0000000 --- a/layman/layman/config.py +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -################################################################################# -# LAYMAN CONFIGURATION -################################################################################# -# File: config.py -# -# Handles layman configuration -# -# Copyright: -# (c) 2005 Gunnar Wrobel -# Distributed under the terms of the GNU General Public License v2 -# -# Author(s): -# Gunnar Wrobel <wrobel@gentoo.org> -# - -__version__ = "$Id$" - -#=============================================================================== -# -# Dependencies -# -#------------------------------------------------------------------------------- - -import os, sys, optparse, ConfigParser - -from optparse import OptionParser, OptionGroup -from layman.debug import OUT -from layman.version import LMVERSION - -#=============================================================================== -# -# Class Config -# -#------------------------------------------------------------------------------- - -class Config(object): - - defaults = {'config' : '/etc/layman/layman.cfg', - 'overlays': 'http://dev.gentoo.org/~wrobel/layman/overlays.xml'} - - def __init__(self): - ''' - Creates and describes all possible polymeraZe options and creates - a debugging object. - ''' - - self.parser = OptionParser( - usage = 'layman <ACTION> [overlay]', - version = LMVERSION) - - ################################################################## - # Main Options - - group = OptionGroup(self.parser, - '<Actions>') - - group.add_option('-a', - '--add', - action = 'store', - help = 'Add an overlay to your selection of overlays' - '.') - - group.add_option('-d', - '--delete', - action = 'store', - help = 'Remove an overlay from your selection of ove' - 'rlays.') - - group.add_option('-u', - '--update', - action = 'store', - help = 'Update the specified overlays. If you don\'t' - ' specify an argument, all overlays will be updated ') - - group.add_option('-f', - '--fetch', - action = 'store_true', - help = 'Fetch the overlay listing.') - - self.parser.add_option_group(group) - - ################################################################## - # Additional Options - - group = OptionGroup(self.parser, - '<Path options>') - - group.add_option('-c', - '--config', - action = 'store', - help = 'Path to the config file.') - - group.add_option('-o', - '--overlays', - action = 'store', - help = 'The list of overlays.') - - self.parser.add_option_group(group) - - # Parse the command line first since we need to get the config - # file option. - (options, args) = self.parser.parse_args() - - # Map options from the command line into the default - for i in options.__dict__: - self.default[i] = options.__dict__[i] - - self.config = ConfigParser.ConfigParser(self.default) - self.config.add_section('MAIN') - - self.config.read(self.default['config']) - - - |