So before Python 3.5, we had .pyc and common .pyo for -O and -OO. Since 3.5, there's .opt-1.pyc for -O and .opt-2.pyc for -OO. Our current code is causing only the latter to be installed. The results you can guess -- scripts that are run with -O cause Python to try to re-optimize the installed modules, either resulting in silent permission errors and lack of optimization (acceptable), or runtime writes to /usr (bad). Components involved that I can think of: 1. dev-lang/python:3.5 -- seems to compile all variants correctly already, 2. distutils -- I will be opening a bug upstream, 3. python-utils-r1.eclass -- should be trivial to patch. Anything I'm missing?
Patch to Python 3.5 and python-utils-r1.eclass is now on python-oo-fix branch.
Merged now. Would be nice if someone tried to convince the Python upstream that it's a real issue and what they did is not good. But I don't have the patience.