diff options
author | Brian Dolbec <brian.dolbec@gmail.com> | 2011-02-19 03:01:30 -0800 |
---|---|---|
committer | Brian Dolbec <brian.dolbec@gmail.com> | 2011-02-19 03:01:30 -0800 |
commit | 990e967e10ec6511aa8e58beacdc9c3a5a029fcc (patch) | |
tree | 2e6db43ca3f540cbaacaa32318a85fbd5fcc1367 | |
parent | 3097da00099de860894ddde8f7b3df9722ec6734 (diff) | |
download | layman-990e967e10ec6511aa8e58beacdc9c3a5a029fcc.tar.gz layman-990e967e10ec6511aa8e58beacdc9c3a5a029fcc.tar.bz2 layman-990e967e10ec6511aa8e58beacdc9c3a5a029fcc.zip |
Create a new single import high level Layman class
-rw-r--r-- | layman/__init__.py | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/layman/__init__.py b/layman/__init__.py index 792d600..e27488a 100644 --- a/layman/__init__.py +++ b/layman/__init__.py @@ -1 +1,47 @@ -# +#!/usr/bin/python +# -*- coding: utf-8 -*- + +"""Layman is a complete library for the operation and maintainance +on all gentoo repositories and overlays +""" + + + +class Layman(object): + """High level interface capable of performing all + overlay repository actions.""" + + def __init__(self, stdout=None, stdin=None, stderr=None, + config=None, read_configfile=True, quiet=False, quietness=4, + verbose=False, nocolor=False, width=0 + ): + """Input parameters are optional to override the defaults. + sets up our LaymanAPI with defaults or passed in values + and returns an instance of it""" + import sys + try: + from layman.api import LaymanAPI + from layman.config import BareConfig + from layman.output import Message + except ImportError: + sys.stderr.write("!!! Layman API import failed.") + return None + self.message = Message() + self.config = BareConfig( + output=message, + stdout=None, + stdin=None, + stderr=None, + config=None, + read_configfile=True, + quiet=False, + quietness=4, + verbose=False, + nocolor=False, + width=0 + ) + self.layman = LaymanAPI(self.config, + report_errors=True, + output=config['output'] + ) + return _layman |