I will attach a patch with the differences between gx86 and Prefix for distutils.eclass. I did not make any modifications to handle EAPI=3 correctly. If you prefer to see those, please let me know. (I rely on a previous request for python.eclass here.)
Created attachment 221957 [details, diff] distutils.eclass prefix patch
EAPI="3" is already handled correctly. I think that you missed s/ROOT/EROOT/ in the following line: python_mod_cleanup "${pylibdir#${ROOT%/}}/site-packages/${pymod}" I have changed it to use EROOT. Fixed.