Support replacing installed files with cross-implementation symlinks
to save space. Opt-in via `DISTUTILS_ALLOW_CROSS_IMPL_SYMLINKS`
variable.
Closes:
https://bugs.gentoo.org/954762
Signed-off-by: Micha艂 G贸rny <
mgorny@gentoo.org>
---
eclass/distutils-r1.eclass | 66 ++++++++++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 32cff457e996..d2e4f9ce7ba0 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -227,6 +227,18 @@
# Note that it requires >=dev-python/gpep517-19.
: "${DISTUTILS_ALLOW_PYC_SYMLINKS=}"
+# @ECLASS_VARIABLE: DISTUTILS_ALLOW_CROSS_IMPL_SYMLINKS
+# @USER_VARIABLE
+# @DESCRIPTION:
+# If set to a non-empty value, the eclass will replace identical files
+# from installed wheels with symlinks, across different Python
+# implementations. This may include .py files, variety of data files
+# and stable ABI extensions.
+#
+# This is an optimization that can reduce disk space usage when packages
+# are built for multiple Python implementations.
+: "${DISTUTILS_ALLOW_CROSS_IMPL_SYMLINKS=}"
+
# @ECLASS_VARIABLE: BUILD_DIR
# @OUTPUT_VARIABLE
# @DEFAULT_UNSET
@@ -1233,6 +1245,33 @@ distut