From e84b7727f4910d71dd2e15d5dd3c4688dc7b2ff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 5 Dec 2024 12:02:54 +0100 Subject: [PATCH] Optimize patch 251 a tiny bit Before: $ python3.14 -m timeit -s 'import sysconfig' 'sysconfig.get_paths()' 2000 loops, best of 5: 157 usec per loop $ python3.14 -m timeit -s 'import sysconfig' 'sysconfig.get_paths()' 2000 loops, best of 5: 162 usec per loop $ python3.14 -m timeit -s 'import sysconfig' 'sysconfig.get_paths()' 1000 loops, best of 5: 146 usec per loop After: $ python3.14 -m timeit -s 'import sysconfig' 'sysconfig.get_paths()' 5000 loops, best of 5: 75.9 usec per loop $ python3.14 -m timeit -s 'import sysconfig' 'sysconfig.get_paths()' 5000 loops, best of 5: 77.1 usec per loop $ python3.14 -m timeit -s 'import sysconfig' 'sysconfig.get_paths()' 5000 loops, best of 5: 76.2 usec per loop The results are inconclusive on 3.12, but we want the patch to be identical (if possible). This can be shipped with the next update. --- 00251-change-user-install-location.patch | 4 ++-- python3.12.spec | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/00251-change-user-install-location.patch b/00251-change-user-install-location.patch index b4068f7..dd7a07a 100644 --- a/00251-change-user-install-location.patch +++ b/00251-change-user-install-location.patch @@ -51,7 +51,7 @@ index aed254ad50..568dbdb945 100644 if os.path.isdir(sitedir): addsitedir(sitedir, known_paths) diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py -index 517b13acaf..f85ab25d27 100644 +index 517b13acaf..928d1a0541 100644 --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -104,6 +104,11 @@ @@ -119,7 +119,7 @@ index 517b13acaf..f85ab25d27 100644 + # we only change the defaults here, so explicit --prefix will take precedence + # https://fedoraproject.org/wiki/Changes/Making_sudo_pip_safe + if (scheme == 'posix_prefix' and -+ get_config_vars('prefix')[0] == '/usr' and ++ sys.prefix == '/usr' and + 'RPM_BUILD_ROOT' not in os.environ): + _extend_dict(vars, _config_vars_local()) + else: diff --git a/python3.12.spec b/python3.12.spec index c8f6fd8..d3fa09e 100644 --- a/python3.12.spec +++ b/python3.12.spec @@ -336,7 +336,7 @@ Source11: idle3.appdata.xml # (Patches taken from github.com/fedora-python/cpython) -# 00251 # 7f0caf37f83f1e591194e93fd0f8cefede49bba6 +# 00251 # 6a4ec74157aa01f1ada9f29f30a371cd9e5369e8 # Change user install location # # Set values of base and platbase in sysconfig from /usr