Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 523258 - app-portage/layman-2.1.0-r3: python API layman.config output issue
Summary: app-portage/layman-2.1.0-r3: python API layman.config output issue
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2014-09-19 17:58 UTC by Maxim Odinintsev
Modified: 2014-09-29 13:47 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Layman python API output patch (layman-config-output.patch,660 bytes, patch)
2014-09-19 18:00 UTC, Maxim Odinintsev
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Maxim Odinintsev 2014-09-19 17:58:21 UTC
'BareConfig' object has no attribute 'output'

Reproducible: Always

Steps to Reproduce:
Simple python script:

try:
    from layman.api import LaymanAPI
    from layman.config import BareConfig
    HAS_LAYMAN_API = True
except ImportError:
    HAS_LAYMAN_API = False

def init_layman(config=None):
    if config is None: config = BareConfig(read_configfile=True, quietness=1)
    return LaymanAPI(config)

layman = init_layman()
name = layman.get_available()
print(name)
Actual Results:  
Traceback (most recent call last):
  File "./layman-api-test.py", line 17, in <module>
    layman.get_available()
  File "/usr/lib64/python2.7/site-packages/layman/api.py", line 559, in get_available
    self._available_ids = self._get_remote_db(dbreload).list_ids()
  File "/usr/lib64/python2.7/site-packages/layman/api.py", line 582, in _get_remote_db
    self._available_db = RemoteDB(self.config)
  File "/usr/lib64/python2.7/site-packages/layman/remotedb.py", line 50, in __init__
    self.proxies = config.proxies
  File "/usr/lib64/python2.7/site-packages/layman/config.py", line 299, in proxies
    self.output.debug("Warning: unable to determine proxies.", 6)
AttributeError: 'BareConfig' object has no attribute 'output'


Expected Results:  
[u'Armageddon', u'AstroFloyd', u'AzP', u'DuPol', u'FireBurn', u'GoGooOS', u'LaraCraft304', u'OSSDL', u'ROKO__', u'THE', u'TomWij', u'abendbrot', u'abnorm', u'activehome', u'ago', u'aidecoe', u'akoya', u'alatar-lay', u'alba-overlay', u'alexcepoi', u'alexxy', u'alice', u'aliceinwire', u'aluco', u'alunduil', u'amielke-overlay', u'anarchy', u'anaximander', u'and3k-sunrise', u'anderse', u'andy', u'angelos', u'anyc', u'arax-overlay', u'arc', u'arces', u'arcon', u'armagetron', u'aross', u'arx-libertatis', u'asux']

# diff -u /usr/lib64/python2.7/site-packages/layman/config.py.orig /usr/lib64/python2.7/site-packages/layman/config.py
--- /usr/lib64/python2.7/site-packages/layman/config.py.orig	2014-09-19 20:54:21.216670781 +0300
+++ /usr/lib64/python2.7/site-packages/layman/config.py	2014-09-19 20:54:59.463691942 +0300
@@ -296,7 +296,7 @@
             elif os.getenv(proxy):
                 proxies[proxy.split('_')[0]] = os.getenv(proxy)
         if self.config and proxies == {}:
-            self.output.debug("Warning: unable to determine proxies.", 6)
+            self._options['output'].debug("Warning: unable to determine proxies.", 6)
 
         return proxies
Comment 1 Maxim Odinintsev 2014-09-19 18:00:07 UTC
Created attachment 385132 [details, diff]
Layman python API output patch
Comment 2 Devan Franchini (RETIRED) gentoo-dev 2014-09-20 17:50:06 UTC
Patch tested and applied. You can recompile layman and it will be in there.

Thank you for your contribution to layman's codebase.
Comment 3 Devan Franchini (RETIRED) gentoo-dev 2014-09-29 13:47:41 UTC
Available in layman-2.2.0, closing as fixed.