Summary: | app-portage/gentoolkit: revdep-rebuild fails with Python 3.6 | ||
---|---|---|---|
Product: | Portage Development | Reporter: | Paul Varner (RETIRED) <fuzzyray> |
Component: | Tools | Assignee: | Portage Tools Team <tools-portage> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | aklhfex, ao, chris.murtagh1, conikost, fturco, leho, michele, O01eg, ostroffjh, pacho, pesa, tdalman |
Priority: | Normal | Keywords: | InVCS |
Version: | 2.2 | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 616934 |
Description
Paul Varner (RETIRED)
2017-05-04 17:26:14 UTC
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 :) |