Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 617498 - app-portage/gentoolkit: revdep-rebuild fails with Python 3.6
Summary: app-portage/gentoolkit: revdep-rebuild fails with Python 3.6
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords: InVCS
: 629780 630678 638462 (view as bug list)
Depends on:
Blocks: 616934
  Show dependency tree
 
Reported: 2017-05-04 17:26 UTC by Paul Varner (RETIRED)
Modified: 2018-01-23 13:47 UTC (History)
12 users (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 Paul Varner (RETIRED) gentoo-dev 2017-05-04 17:26:14 UTC
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
Comment 1 Paul Varner (RETIRED) gentoo-dev 2017-05-04 19:25:45 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)
Comment 2 Paul Varner (RETIRED) gentoo-dev 2017-05-05 20:02:42 UTC
Fix has been pushed to the gentoolkit repository

https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=d3ef9ef1bebc7604db0e8c5c49e167e18300c9e9
Comment 3 dwfreed 2017-09-11 15:10:42 UTC
*** Bug 630678 has been marked as a duplicate of this bug. ***
Comment 4 Arfrever Frehtes Taifersar Arahesis 2017-11-27 06:29:19 UTC
*** Bug 638462 has been marked as a duplicate of this bug. ***
Comment 5 Arfrever Frehtes Taifersar Arahesis 2017-11-27 06:31:06 UTC
*** Bug 629780 has been marked as a duplicate of this bug. ***
Comment 6 Arfrever Frehtes Taifersar Arahesis 2017-11-27 06:32:10 UTC
(Reopening until fix released...)
Comment 7 Michele Alzetta 2017-11-27 12:50:18 UTC
How about masking gentoolkit-0.4?
With gentoolkit-0.3.3 the problem isn't present.
Comment 8 Davide Pesavento (RETIRED) gentoo-dev 2017-12-01 06:53:34 UTC
Can you please release a new version containing the fix?
Comment 9 Pacho Ramos gentoo-dev 2017-12-16 11:54:50 UTC
0.4.1 released fixing this finally :)