Created attachment 631218 [details] build.log There seems to be some weird python 2.7 3.6 mix-up happening here. This is on a stable box. Cannot reproduce locally easily. * python2_7: running distutils-r1_run_phase python_install_all Traceback (most recent call last): File "/usr/lib/portage/python3.6/doins.py", line 17, in <module> import argparse File "/usr/lib64/python3.6/argparse.py", line 89, in <module> import re as _re File "/usr/lib64/python3.6/re.py", line 142, in <module> class RegexFlag(enum.IntFlag): AttributeError: module 'enum' has no attribute 'IntFlag' Any ideas what might be going on?
I had a chance to debug this further. What I found: - Python 3.6 is eselected for a system-wide interpreter, as expected. - einstalldocs calls dodoc which calls doins (/usr/lib/portage/python3.6/ebuild-helpers/doins) which calls doins.py (/usr/lib/portage/python3.6/doins.py) with PYTHONPATH=/usr/lib64/python3.6/site-packages:. where . is /var/tmp/portage/dev-python/enum34-1.1.6-r1/work/enum34-1.1.6 . - As a result, doins.py ends up with this sys.path when started: 1. "" 2. "/var/tmp/portage/dev-python/enum34-1.1.6-r1/work/enum34-1.1.6-python2_7/lib" 3. "/var/tmp/portage/dev-python/enum34-1.1.6-r1/work/enum34-1.1.6" 4. "/usr/lib64/python36.zip" 5. "/usr/lib64/python3.6" 6. "/usr/lib64/python3.6/lib-dynload" 7. "/usr/lib64/python3.6/site-packages" - As a result, for "import enum" file [3]/enum/__init__.py of enum34 without attribute IntFlag wins the the race over Python 3.6's own [5]/enum.py . For a true fix, it seems either we need to a) get ":." out of ${PORTAGE_PYTHONPATH} or b) get /usr/lib64/pythonX.Y into ${PORTAGE_PYTHONPATH} before ".". If you agree with that assessment, it might be a bug in portage, both stable 2.3.89-r1 and unstable 2.3.98-r1 . So I'll hand over to the portage team to get their opinion. PS: I have not been able to find a workaround for enum34-1.1.6-r1.ebuild, yet.
It looks like you have a PYTHONPATH=. setting in your environment which passes through to PORTAGE_PYTHONPATH. In the absence of an inherited PYTHONPATH setting, we should have just PORTAGE_PYTHONPATH=/usr/lib64/python3.6/site-packages here.
In order to check the effective PORTAGE_PYTHONPATH setting, I temporarily patched the ebuild like this: > --- a/dev-python/enum34/enum34-1.1.6-r1.ebuild > +++ b/dev-python/enum34/enum34-1.1.6-r1.ebuild > @@ -25,5 +25,6 @@ python_test() { > python_install_all() { > use doc && local DOCS=( enum/doc/. enum/README ) > > + die "PORTAGE_PYTHONPATH=$PORTAGE_PYTHONPATH" > distutils-r1_python_install_all > }
I did something similar and my PORTAGE_PYTHONPATH is "/usr/lib64/python3.6/site-packages:." with ":." at that very place.
(In reply to Zac Medico from comment #2) > It looks like you have a PYTHONPATH=. setting in your environment which > passes through to PORTAGE_PYTHONPATH. Let me double-check that, one moment
You're instinct was right: From where emerge was called, there was PYTHONPATH=. in the environment. Once I dropped that, the build failure went away. In theory, is this something portage has a chance to protect itself against? I imagine something like checking the environment for PYTHONPATH, dropping it, and re-executing? Should we close this as invalid or should we keep it open for portage?
(In reply to Sebastian Pipping from comment #6) > Should we close this as invalid or should we keep it open for portage? The PYTHONPATH pass-through is a feature which is useful for testing portage from a git checkout, for example: https://wiki.gentoo.org/wiki/Project:Portage#Testing_Portage It can also be useful as a means to temporarily override arbitrary python libraries. I suppose we could detect non-absolute paths in PYTHONPATH, display a warning message, and filter them out.
Even if portage filters the PYTHONPATH=. value from PORTAGE_PYTHONPATH, it's not allowed to do the same for the regular PYTHONPATH variable in the ebuild environment, since that would deviate from PMS behavior. We can see that an environmental PYPTHONPATH=. does pass through to the ebuild environment when we patch the ebuild like this: > --- a/dev-python/enum34/enum34-1.1.6-r1.ebuild > +++ b/dev-python/enum34/enum34-1.1.6-r1.ebuild > @@ -25,5 +25,7 @@ python_test() { > python_install_all() { > use doc && local DOCS=( enum/doc/. enum/README ) > > + die "PYTHONPATH=$PYTHONPATH" > + > distutils-r1_python_install_all > }