From 6d439c6718625bb7dce32b0afdc6a3d5168a21e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Sat, 11 Apr 2020 07:01:27 +0200
Subject: [PATCH] Support Gentoo install scheme

---
 lib-python/3/distutils/command/install.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lib-python/3/distutils/command/install.py b/lib-python/3/distutils/command/install.py
index 6fe62be..a4e9f0d 100644
--- a/lib-python/3/distutils/command/install.py
+++ b/lib-python/3/distutils/command/install.py
@@ -97,6 +97,13 @@ INSTALL_SCHEMES = {
         'scripts': '$base/Scripts',
         'data'   : '$base',
         },
+    'gentoo': {
+        'purelib': '$base/site-packages',
+        'platlib': '$base/site-packages',
+        'headers': '$base/include/$dist_name',
+        'scripts': '@EPREFIX@/usr/bin',
+        'data'   : '@EPREFIX@/usr',
+        },
     }
 
 # The keys to an installation scheme; if any new types of files are to be
@@ -483,7 +490,10 @@ class install (Command):
         # it's the caller's problem if they supply a bad name!
         if (hasattr(sys, 'pypy_version_info') and
                 not name.endswith(('_user', '_home'))):
-            if os.name == 'nt':
+            if self.install_base.startswith(os.path.normpath('@EPREFIX@/usr/lib/pypy')):
+                # override paths for system-wide install
+                name = 'gentoo'
+            elif os.name == 'nt':
                 name = 'pypy_nt'
             else:
                 name = 'pypy'
-- 
2.26.0

