Using revdep-rebuild with Python 3.6 produces the following traceback # revdep-rebuild -pv Traceback (most recent call last): File "/usr/lib/python-exec/python3.6/revdep-rebuild", line 37, in <module> from gentoolkit.revdep_rebuild import rebuild File "/usr/lib64/python3.6/site-packages/gentoolkit/revdep_rebuild/rebuild.py", line 29, in <module> from .analyse import analyse File "/usr/lib64/python3.6/site-packages/gentoolkit/revdep_rebuild/analyse.py", line 18, in <module> from .collect import (prepare_search_dirs, parse_revdep_config, File "/usr/lib64/python3.6/site-packages/gentoolkit/revdep_rebuild/collect.py", line 18, in <module> from .settings import parse_revdep_config File "/usr/lib64/python3.6/site-packages/gentoolkit/revdep_rebuild/settings.py", line 19, in <module> 'DEFAULT_LD_FILE': os.path.join(portage.root, 'etc/ld.so.conf'), File "/usr/lib64/python3.6/posixpath.py", line 78, in join a = os.fspath(a) TypeError: expected str, bytes or os.PathLike object, not _LegacyGlobalProxy
Here is what was discussed in IRC <fuzzyray> Can someone explain what is going on here from the portage side. I'm working on making sure that gentoolkit works with Python 3.6 and hitting this in revdep-rebuild https://bpaste.net/show/9cc6ffcecda4 <dwfreed> fuzzyray: python3.5 is duck-typing, which works fine in this case; python3.6 does a type check, which fails until the proxy has replaced itself with what it's proxying <dwfreed> since ROOT can be changed by package.env, the proxy allows for late-binding in a way that is invisible to the consumer <dwfreed> (except when it does type checks) <fuzzyray> Thanks <floppym> fuzzyray: Using str(portage.root) seems to work around that. <floppym> Actually, that might be wrong in python2.7. <floppym> Python 2.7.13 (default, Mar 25 2017, 17:40:57) <floppym> [GCC 5.4.0] on linux2 <floppym> Type "help", "copyright", "credits" or "license" for more information. <floppym> >>> import portage <floppym> >>> type(portage.root) <floppym> <class 'portage._LegacyGlobalProxy'> <floppym> >>> portage.root <floppym> u'/' <floppym> >>> type(portage.root) <floppym> <type 'unicode'> <dwfreed> floppym: you don't have to use the results of the str(), you just need something that calls the proxy's _get_target method <floppym> Right; I was suggesting that gentoolkit do something like os.path.join(str(portage.root), ...) <floppym> But that would probably be wrong for python2 <fuzzyray> Looks like if I just do a str(portage.root) and ignore the value, that has the proxy's _get_target method get called and then everything works as it did before with the expected types <fuzzyray> I'm not sure I really like that as it feels like a hack, though <fuzzyray> I could also just set a variable using the appropriate conversion based upon if it is python2 or 3 as well Adding this to the code works, but feels like a hack to me even though it is the minimal amount of code change. # Force the binding of portage.root due to stricter type checking in Python 3.5 str(portage.root)
Fix has been pushed to the gentoolkit repository https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=d3ef9ef1bebc7604db0e8c5c49e167e18300c9e9
*** Bug 630678 has been marked as a duplicate of this bug. ***
*** Bug 638462 has been marked as a duplicate of this bug. ***
*** Bug 629780 has been marked as a duplicate of this bug. ***
(Reopening until fix released...)
How about masking gentoolkit-0.4? With gentoolkit-0.3.3 the problem isn't present.
Can you please release a new version containing the fix?
0.4.1 released fixing this finally :)