From 093c1453a59fb7deb23ba7c47e2d66622cc9fb61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 11 Feb 2020 10:56:17 +0100 Subject: [PATCH] Hardlink duplicated bytecode cache files by --hardlink-dupes instead of BRP script This is explained in https://discuss.python.org/t/3014 and https://github.com/fedora-python/compileall2/issues/16 The %__brp_python_hardlink script already does this by Shell, this should be slightly faster. Also, this is more explicit. --- python39.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python39.spec b/python39.spec index c3f8b74..dff17b9 100644 --- a/python39.spec +++ b/python39.spec @@ -948,9 +948,13 @@ find . -name "*~" -exec rm -f {} \; # -o - optimization levels to run compilation with # -s - part of path to left-strip from path to source file (buildroot) # -p - path to add as prefix to path to source file (/ to make it absolute) +# --hardlink-dupes - hardlink different optimization level pycs together if identical (saves space) LD_LIBRARY_PATH="%{buildroot}%{dynload_dir}/:%{buildroot}%{_libdir}" \ PYTHONPATH="%{_rpmconfigdir}/redhat" %{buildroot}%{_bindir}/python%{pybasever} -s -B -m \ -compileall2 -f %{_smp_mflags} -o 0 -o 1 -o 2 -s %{buildroot} -p / %{buildroot} || : +compileall2 -f %{_smp_mflags} -o 0 -o 1 -o 2 -s %{buildroot} -p / %{buildroot} --hardlink-dupes || : + +# Turn this BRP off, it is done by compileall2 --hardlink-dupes above +%global __brp_python_hardlink %{nil} # Since we have pathfix.py in bindir, this is created, but we don't want it rm -rf %{buildroot}%{_bindir}/__pycache__