Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 575788 - app-portage/gentoolkit-0.3.0.9-r2: Python 3 + ROOT set => AttributeError: 'dict' object has no attribute 'iteritems'
Summary: app-portage/gentoolkit-0.3.0.9-r2: Python 3 + ROOT set => AttributeError: 'di...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: Normal minor with 1 vote (vote)
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2016-02-26 23:53 UTC by Skruppy
Modified: 2022-07-10 23:10 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Skruppy 2016-02-26 23:53:09 UTC
With Python 3.4 an ROOT set in /etc/portage/make.conf, equery's belongs queries cause an exception.

Reproducible: Always

Steps to Reproduce:
1. Set ROOT to something else than "/" in /etc/portage/make.conf
2. Use Python 3.4 (I guess it will happen with all Python 3.*)
3. Execute "equery b portage" (or any "equery b ....")
Actual Results:  
```
 * Searching for portage ... 
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.4/equery", line 38, in <module>
    equery.main(sys.argv)
  File "/usr/lib64/python3.4/site-packages/gentoolkit/equery/__init__.py", line 357, in main
    loaded_module.main(module_args)
  File "/usr/lib64/python3.4/site-packages/gentoolkit/equery/belongs.py", line 157, in main
    if not find_owner(queries):
  File "/usr/lib64/python3.4/site-packages/gentoolkit/helpers.py", line 264, in __call__
    return self.find_owners(query_re, use_match=use_match, pkgset=pkgset)
  File "/usr/lib64/python3.4/site-packages/gentoolkit/helpers.py", line 287, in find_owners
    files = pkg.parsed_contents()
  File "/usr/lib64/python3.4/site-packages/gentoolkit/package.py", line 366, in parsed_contents
    for key, val in self.dblink.getcontents().iteritems():
AttributeError: 'dict' object has no attribute 'iteritems'
```

Expected Results:  
```
 * Searching for portage ... 
sys-apps/portage-2.2.26 (/etc/portage)
sys-apps/portage-2.2.26 (/usr/lib/portage)
sys-apps/portage-2.2.26 (/var/log/portage)
...
```

WORKAROUND:
Use `/usr/lib/python-exec/python2.7/equery b portage` or similar (as long as it is a Python 2 Version)

CAUSE: 
in root/pym/gentoolkit/package.py, "if myroot != '/':" (https://gitweb.gentoo.org/proj/gentoolkit.git/tree/pym/gentoolkit/package.py?id=95648e0369e74d65582ee3ef44b0a0a338f82cf0#n364) causes the bug to only appear in environments, where ROOT is set. The bug itself is caused by "self.dblink.getcontents().iteritems()", which is not Python3 Syntax.
Comment 1 Brian Dolbec (RETIRED) gentoo-dev 2016-09-15 16:04:06 UTC
Sorry for the long delay, but this is fixed in master now.

Thank you for the detailed troubleshooting.