diff options
author | Brian Dolbec <dolsen@gentoo.org> | 2015-02-16 21:05:31 -0800 |
---|---|---|
committer | Brian Dolbec <dolsen@gentoo.org> | 2015-02-16 21:06:08 -0800 |
commit | ddb28916e73660871ca8a6f41d69d9dd42ab9f0c (patch) | |
tree | 27842ed26c65654f835f6037e5db4ccc0e39549b /layman/__init__.py | |
parent | config_modules/reposconf.py: pyflakes import cleanup (diff) | |
download | layman-ddb28916e73660871ca8a6f41d69d9dd42ab9f0c.tar.gz layman-ddb28916e73660871ca8a6f41d69d9dd42ab9f0c.tar.bz2 layman-ddb28916e73660871ca8a6f41d69d9dd42ab9f0c.zip |
Move Layman class initialization into a layman sub-file to prevent un-needed imports
setup.py was indirectly causing multiple imports just to get the version.
This minimizes the imports for simple layman imports like obtaining version.
Diffstat (limited to 'layman/__init__.py')
-rw-r--r-- | layman/__init__.py | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/layman/__init__.py b/layman/__init__.py index 3f70381..932dc55 100644 --- a/layman/__init__.py +++ b/layman/__init__.py @@ -5,48 +5,3 @@ on all gentoo repositories and overlays """ -from __future__ import unicode_literals - -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 imports failed.") - raise - - - -class Layman(LaymanAPI): - """A complete high level interface capable of performing all - overlay repository actions.""" - - def __init__(self, stdout=sys.stdout, stdin=sys.stdin, stderr=sys.stderr, - config=None, read_configfile=True, quiet=False, quietness=4, - verbose=False, nocolor=False, width=0, root=None - ): - """Input parameters are optional to override the defaults. - sets up our LaymanAPI with defaults or passed in values - and returns an instance of it""" - self.message = Message(out=stdout, err=stderr) - self.config = BareConfig( - output=self.message, - stdout=stdout, - stdin=stdin, - stderr=stderr, - config=config, - read_configfile=read_configfile, - quiet=quiet, - quietness=quietness, - verbose=verbose, - nocolor=nocolor, - width=width, - root=root - ) - LaymanAPI.__init__(self, self.config, - report_errors=True, - output=self.config['output'] - ) - return |