SHA256
1
0
forked from pool/python312
python312/F00251-change-user-install-location.patch

174 lines
7.3 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Mon, 15 Feb 2021 12:19:27 +0100
Subject: [PATCH] 00251: Change user install location
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Set values of base and platbase in sysconfig from /usr
to /usr/local when RPM build is not detected
to make pip and similar tools install into separate location.
Fedora Change: https://fedoraproject.org/wiki/Changes/Making_sudo_pip_safe
Downstream only.
We've tried to rework in Fedora 36/Python 3.10 to follow https://bugs.python.org/issue43976
but we have identified serious problems with that approach,
see https://bugzilla.redhat.com/2026979 or https://bugzilla.redhat.com/2097183
pypa/distutils integration: https://github.com/pypa/distutils/pull/70
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Miro Hrončok <miro@hroncok.cz>
Co-authored-by: Michal Cyprian <m.cyprian@gmail.com>
Co-authored-by: Lumír Balhar <frenzy.madness@gmail.com>
---
Lib/site.py | 9 ++++++-
Lib/sysconfig.py | 49 +++++++++++++++++++++++++++++++++++++-
Lib/test/test_sysconfig.py | 17 +++++++++++--
3 files changed, 71 insertions(+), 4 deletions(-)
Accepting request 1102652 from home:dgarcia:branches:devel:languages:python:Factory - Refresh all patches - Drop Revert-gh105127-left-tests.patch, in upstream now - Update to 3.12.0rc1: - Reverted the :mod:`email.utils` security improvement change released in 3.12beta4 that unintentionally caused :mod:`email.utils.getaddresses` to fail to parse email addresses with a comma in the quoted name field. See :gh:`106669`. - Start initializing ob_digit during creation of :c:type:`PyLongObject` objects. Patch by Illia Volochii. - Increase C recursion limit for functions other than the main interpreter from 800 to 1500. This should allow functions like list.__repr__ and json.dumps to handle all the inputs that they could prior to 3.12 - Fix potential unaligned memory access on C APIs involving returned sequences of char * pointers within the :mod:`grp` and :mod:`socket` modules. These were revealed using a -fsaniziter=alignment build on ARM macOS. Patch by Christopher Chavez. - Add the exception as the third argument to PY_UNIND callbacks in sys.monitoring. This makes the PY_UNWIND callback consistent with the other exception hanlding callbacks. - Raise a ValueError when a monitoring callback funtion returns DISABLE for events that cannot be disabled locally. - Add a RERAISE event to sys.monitoring, which occurs when an exception is reraised, either explicitly by a plain raise statement, or implicitly in an except or finally block. - Unsupported modules now always fail to be imported. - Fix classmethod-style :func:`super` method calls (i.e., where the second argument to :func:`super`, or the implied second argument drawn from self/cls in the case of zero-arg super, is a type) when the target of the call is not a classmethod. - Python no longer crashes due an infrequent race when initialzing per-interpreter interned strings. The crash would manifest when the interpreter was finalized. - Python no longer crashes due to an infrequent race in setting Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors (both deprecated), when simultaneously initializing two isolated subinterpreters. Now they are only set during runtime initialization. - Fix a segmentation fault caused by a use-after-free bug in frame_dealloc when the trashcan delays the deallocation of a PyFrameObject. - No longer suppress arbitrary errors in the __annotations__ getter and setter in the type and module types. - Propagate frozen_modules to multiprocessing spawned process interpreters. - Prevent out-of-bounds memory access during mmap.find() calls. - Seems that in some conditions, OpenSSL will return SSL_ERROR_SYSCALL instead of SSL_ERROR_SSL when a certification verification has failed, but the error parameters will still contain ERR_LIB_SSL and SSL_R_CERTIFICATE_VERIFY_FAILED. We are now detecting this situation and raising the appropiate ssl.SSLCertVerificationError. Patch by Pablo Galindo - Fix :func:`types.get_original_bases` to only return :attr:`!__orig_bases__` if it is present on cls directly. Patch by James Hilton-Balfe. - Prevent memory leak and use-after-free when using pointers to pointers with ctypes - Make :func:`gettext.pgettext` search plural definitions when translation is not found. - Document behavior of :func:`shutil.disk_usage` for non-mounted filesystems on Unix. - Do not report MultipartInvariantViolationDefect defect when the :class:`email.parser.Parser` class is used to parse emails with headersonly=True. - Fix invalid result from :meth:`PurePath.relative_to` method when attempting to walk a ".." segment in other with walk_up enabled. A :exc:`ValueError` exception is now raised in this case. - Fix potential missing NULL check of d2i_SSL_SESSION result in _ssl.c. - Update the bundled copy of pip to version 23.2.1. - Fixed several bugs in zipfile.Path, including: in Path.match`, Windows separators are no longer honored (and never were meant to be); Fixed ``name/suffix/suffixes/stem operations when no filename is present and the Path is not at the root of the zipfile; Reworked glob for performance and more correct matching behavior. - Add __copy__ and __deepcopy__ in :mod:`enum` - Revert a change to :func:`colorsys.rgb_to_hls` that caused division by zero for certain almost-white inputs. Patch by Terry Jan Reedy. - Instances of :class:`typing.TypeVar`, :class:`typing.ParamSpec`, :class:`typing.ParamSpecArgs`, :class:`typing.ParamSpecKwargs`, and :class:`typing.TypeVarTuple` once again support weak references, fixing a regression introduced in Python 3.12.0 beta 1. Patch by Jelle Zijlstra. - Detect possible memory allocation failure in the libtommath function :c:func:`mp_init` used by the _tkinter module. - Fix crash when calling repr with a manually constructed SignalDict object. Patch by Charlie Zhao. - Change the default return value of :meth:`http.client.HTTPConnection.get_proxy_response_headers` to be None and not {}. - Ensure gettext(msg) retrieve translations even if a plural form exists. In other words: gettext(msg) == ngettext(msg, '', 1). - Add documentation for :c:type:`PyInterpreterConfig` and :c:func:`Py_NewInterpreterFromConfig`. Also clarify some of the nearby docs relative to per-interpreter GIL. - Document the :mod:`curses` module variables :const:`~curses.LINES` and :const:`~curses.COLS`. - Add a number of standard external names to nitpick_ignore. - Add documentation on how to localize the :mod:`argparse` module. - test_logging: Fix test_udp_reconnection() by increasing the timeout from 100 ms to 5 minutes (LONG_TIMEOUT). Patch by Victor Stinner. - test_capi: Fix test_no_FatalError_infinite_loop() to no longer write a coredump, by using test.support.SuppressCrashReport. Patch by Victor Stinner. - Avoid creating a reference to the test object in :meth:`~unittest.TestResult.collectedDurations`. - Moved tests for zipfile.Path into Lib/test/test_zipfile/_path. Made zipfile._path a package. - Check for linux/limits.h before including it in Modules/posixmodule.c. - Detect MPI compilers in :file:`configure`. - Add experimental wasi-threads support. Patch by Takashi Yamamoto. - Update Windows build to use OpenSSL 3.0.9 - Update macOS installer to use OpenSSL 3.0.9. - Fix bugs in the Argument Clinic destination <name> clear command; the destination buffers would never be cleared, and the destination directive parser would simply continue to the fault handler after processing the command. Patch by Erlend E. Aasland. - freeze now fetches CONFIG_ARGS from the original CPython instance the Makefile uses to call utility scripts. Patch by Ijtaba Hussain. - :c:func:`PyModule_AddObjectRef` is now only available in the limited API version 3.10 or later. OBS-URL: https://build.opensuse.org/request/show/1102652 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:Factory/python312?expand=0&rev=19
2023-08-07 17:58:04 +02:00
Index: Python-3.12.0rc1/Lib/site.py
===================================================================
Accepting request 1102652 from home:dgarcia:branches:devel:languages:python:Factory - Refresh all patches - Drop Revert-gh105127-left-tests.patch, in upstream now - Update to 3.12.0rc1: - Reverted the :mod:`email.utils` security improvement change released in 3.12beta4 that unintentionally caused :mod:`email.utils.getaddresses` to fail to parse email addresses with a comma in the quoted name field. See :gh:`106669`. - Start initializing ob_digit during creation of :c:type:`PyLongObject` objects. Patch by Illia Volochii. - Increase C recursion limit for functions other than the main interpreter from 800 to 1500. This should allow functions like list.__repr__ and json.dumps to handle all the inputs that they could prior to 3.12 - Fix potential unaligned memory access on C APIs involving returned sequences of char * pointers within the :mod:`grp` and :mod:`socket` modules. These were revealed using a -fsaniziter=alignment build on ARM macOS. Patch by Christopher Chavez. - Add the exception as the third argument to PY_UNIND callbacks in sys.monitoring. This makes the PY_UNWIND callback consistent with the other exception hanlding callbacks. - Raise a ValueError when a monitoring callback funtion returns DISABLE for events that cannot be disabled locally. - Add a RERAISE event to sys.monitoring, which occurs when an exception is reraised, either explicitly by a plain raise statement, or implicitly in an except or finally block. - Unsupported modules now always fail to be imported. - Fix classmethod-style :func:`super` method calls (i.e., where the second argument to :func:`super`, or the implied second argument drawn from self/cls in the case of zero-arg super, is a type) when the target of the call is not a classmethod. - Python no longer crashes due an infrequent race when initialzing per-interpreter interned strings. The crash would manifest when the interpreter was finalized. - Python no longer crashes due to an infrequent race in setting Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors (both deprecated), when simultaneously initializing two isolated subinterpreters. Now they are only set during runtime initialization. - Fix a segmentation fault caused by a use-after-free bug in frame_dealloc when the trashcan delays the deallocation of a PyFrameObject. - No longer suppress arbitrary errors in the __annotations__ getter and setter in the type and module types. - Propagate frozen_modules to multiprocessing spawned process interpreters. - Prevent out-of-bounds memory access during mmap.find() calls. - Seems that in some conditions, OpenSSL will return SSL_ERROR_SYSCALL instead of SSL_ERROR_SSL when a certification verification has failed, but the error parameters will still contain ERR_LIB_SSL and SSL_R_CERTIFICATE_VERIFY_FAILED. We are now detecting this situation and raising the appropiate ssl.SSLCertVerificationError. Patch by Pablo Galindo - Fix :func:`types.get_original_bases` to only return :attr:`!__orig_bases__` if it is present on cls directly. Patch by James Hilton-Balfe. - Prevent memory leak and use-after-free when using pointers to pointers with ctypes - Make :func:`gettext.pgettext` search plural definitions when translation is not found. - Document behavior of :func:`shutil.disk_usage` for non-mounted filesystems on Unix. - Do not report MultipartInvariantViolationDefect defect when the :class:`email.parser.Parser` class is used to parse emails with headersonly=True. - Fix invalid result from :meth:`PurePath.relative_to` method when attempting to walk a ".." segment in other with walk_up enabled. A :exc:`ValueError` exception is now raised in this case. - Fix potential missing NULL check of d2i_SSL_SESSION result in _ssl.c. - Update the bundled copy of pip to version 23.2.1. - Fixed several bugs in zipfile.Path, including: in Path.match`, Windows separators are no longer honored (and never were meant to be); Fixed ``name/suffix/suffixes/stem operations when no filename is present and the Path is not at the root of the zipfile; Reworked glob for performance and more correct matching behavior. - Add __copy__ and __deepcopy__ in :mod:`enum` - Revert a change to :func:`colorsys.rgb_to_hls` that caused division by zero for certain almost-white inputs. Patch by Terry Jan Reedy. - Instances of :class:`typing.TypeVar`, :class:`typing.ParamSpec`, :class:`typing.ParamSpecArgs`, :class:`typing.ParamSpecKwargs`, and :class:`typing.TypeVarTuple` once again support weak references, fixing a regression introduced in Python 3.12.0 beta 1. Patch by Jelle Zijlstra. - Detect possible memory allocation failure in the libtommath function :c:func:`mp_init` used by the _tkinter module. - Fix crash when calling repr with a manually constructed SignalDict object. Patch by Charlie Zhao. - Change the default return value of :meth:`http.client.HTTPConnection.get_proxy_response_headers` to be None and not {}. - Ensure gettext(msg) retrieve translations even if a plural form exists. In other words: gettext(msg) == ngettext(msg, '', 1). - Add documentation for :c:type:`PyInterpreterConfig` and :c:func:`Py_NewInterpreterFromConfig`. Also clarify some of the nearby docs relative to per-interpreter GIL. - Document the :mod:`curses` module variables :const:`~curses.LINES` and :const:`~curses.COLS`. - Add a number of standard external names to nitpick_ignore. - Add documentation on how to localize the :mod:`argparse` module. - test_logging: Fix test_udp_reconnection() by increasing the timeout from 100 ms to 5 minutes (LONG_TIMEOUT). Patch by Victor Stinner. - test_capi: Fix test_no_FatalError_infinite_loop() to no longer write a coredump, by using test.support.SuppressCrashReport. Patch by Victor Stinner. - Avoid creating a reference to the test object in :meth:`~unittest.TestResult.collectedDurations`. - Moved tests for zipfile.Path into Lib/test/test_zipfile/_path. Made zipfile._path a package. - Check for linux/limits.h before including it in Modules/posixmodule.c. - Detect MPI compilers in :file:`configure`. - Add experimental wasi-threads support. Patch by Takashi Yamamoto. - Update Windows build to use OpenSSL 3.0.9 - Update macOS installer to use OpenSSL 3.0.9. - Fix bugs in the Argument Clinic destination <name> clear command; the destination buffers would never be cleared, and the destination directive parser would simply continue to the fault handler after processing the command. Patch by Erlend E. Aasland. - freeze now fetches CONFIG_ARGS from the original CPython instance the Makefile uses to call utility scripts. Patch by Ijtaba Hussain. - :c:func:`PyModule_AddObjectRef` is now only available in the limited API version 3.10 or later. OBS-URL: https://build.opensuse.org/request/show/1102652 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:Factory/python312?expand=0&rev=19
2023-08-07 17:58:04 +02:00
--- Python-3.12.0rc1.orig/Lib/site.py
+++ Python-3.12.0rc1/Lib/site.py
@@ -377,8 +377,15 @@ def getsitepackages(prefixes=None):
return sitepackages
def addsitepackages(known_paths, prefixes=None):
- """Add site-packages to sys.path"""
+ """Add site-packages to sys.path
+
+ '/usr/local' is included in PREFIXES if RPM build is not detected
+ to make packages installed into this location visible.
+
+ """
_trace("Processing global site-packages")
+ if ENABLE_USER_SITE and 'RPM_BUILD_ROOT' not in os.environ:
+ PREFIXES.insert(0, "/usr/local")
for sitedir in getsitepackages(prefixes):
if os.path.isdir(sitedir):
addsitedir(sitedir, known_paths)
Accepting request 1102652 from home:dgarcia:branches:devel:languages:python:Factory - Refresh all patches - Drop Revert-gh105127-left-tests.patch, in upstream now - Update to 3.12.0rc1: - Reverted the :mod:`email.utils` security improvement change released in 3.12beta4 that unintentionally caused :mod:`email.utils.getaddresses` to fail to parse email addresses with a comma in the quoted name field. See :gh:`106669`. - Start initializing ob_digit during creation of :c:type:`PyLongObject` objects. Patch by Illia Volochii. - Increase C recursion limit for functions other than the main interpreter from 800 to 1500. This should allow functions like list.__repr__ and json.dumps to handle all the inputs that they could prior to 3.12 - Fix potential unaligned memory access on C APIs involving returned sequences of char * pointers within the :mod:`grp` and :mod:`socket` modules. These were revealed using a -fsaniziter=alignment build on ARM macOS. Patch by Christopher Chavez. - Add the exception as the third argument to PY_UNIND callbacks in sys.monitoring. This makes the PY_UNWIND callback consistent with the other exception hanlding callbacks. - Raise a ValueError when a monitoring callback funtion returns DISABLE for events that cannot be disabled locally. - Add a RERAISE event to sys.monitoring, which occurs when an exception is reraised, either explicitly by a plain raise statement, or implicitly in an except or finally block. - Unsupported modules now always fail to be imported. - Fix classmethod-style :func:`super` method calls (i.e., where the second argument to :func:`super`, or the implied second argument drawn from self/cls in the case of zero-arg super, is a type) when the target of the call is not a classmethod. - Python no longer crashes due an infrequent race when initialzing per-interpreter interned strings. The crash would manifest when the interpreter was finalized. - Python no longer crashes due to an infrequent race in setting Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors (both deprecated), when simultaneously initializing two isolated subinterpreters. Now they are only set during runtime initialization. - Fix a segmentation fault caused by a use-after-free bug in frame_dealloc when the trashcan delays the deallocation of a PyFrameObject. - No longer suppress arbitrary errors in the __annotations__ getter and setter in the type and module types. - Propagate frozen_modules to multiprocessing spawned process interpreters. - Prevent out-of-bounds memory access during mmap.find() calls. - Seems that in some conditions, OpenSSL will return SSL_ERROR_SYSCALL instead of SSL_ERROR_SSL when a certification verification has failed, but the error parameters will still contain ERR_LIB_SSL and SSL_R_CERTIFICATE_VERIFY_FAILED. We are now detecting this situation and raising the appropiate ssl.SSLCertVerificationError. Patch by Pablo Galindo - Fix :func:`types.get_original_bases` to only return :attr:`!__orig_bases__` if it is present on cls directly. Patch by James Hilton-Balfe. - Prevent memory leak and use-after-free when using pointers to pointers with ctypes - Make :func:`gettext.pgettext` search plural definitions when translation is not found. - Document behavior of :func:`shutil.disk_usage` for non-mounted filesystems on Unix. - Do not report MultipartInvariantViolationDefect defect when the :class:`email.parser.Parser` class is used to parse emails with headersonly=True. - Fix invalid result from :meth:`PurePath.relative_to` method when attempting to walk a ".." segment in other with walk_up enabled. A :exc:`ValueError` exception is now raised in this case. - Fix potential missing NULL check of d2i_SSL_SESSION result in _ssl.c. - Update the bundled copy of pip to version 23.2.1. - Fixed several bugs in zipfile.Path, including: in Path.match`, Windows separators are no longer honored (and never were meant to be); Fixed ``name/suffix/suffixes/stem operations when no filename is present and the Path is not at the root of the zipfile; Reworked glob for performance and more correct matching behavior. - Add __copy__ and __deepcopy__ in :mod:`enum` - Revert a change to :func:`colorsys.rgb_to_hls` that caused division by zero for certain almost-white inputs. Patch by Terry Jan Reedy. - Instances of :class:`typing.TypeVar`, :class:`typing.ParamSpec`, :class:`typing.ParamSpecArgs`, :class:`typing.ParamSpecKwargs`, and :class:`typing.TypeVarTuple` once again support weak references, fixing a regression introduced in Python 3.12.0 beta 1. Patch by Jelle Zijlstra. - Detect possible memory allocation failure in the libtommath function :c:func:`mp_init` used by the _tkinter module. - Fix crash when calling repr with a manually constructed SignalDict object. Patch by Charlie Zhao. - Change the default return value of :meth:`http.client.HTTPConnection.get_proxy_response_headers` to be None and not {}. - Ensure gettext(msg) retrieve translations even if a plural form exists. In other words: gettext(msg) == ngettext(msg, '', 1). - Add documentation for :c:type:`PyInterpreterConfig` and :c:func:`Py_NewInterpreterFromConfig`. Also clarify some of the nearby docs relative to per-interpreter GIL. - Document the :mod:`curses` module variables :const:`~curses.LINES` and :const:`~curses.COLS`. - Add a number of standard external names to nitpick_ignore. - Add documentation on how to localize the :mod:`argparse` module. - test_logging: Fix test_udp_reconnection() by increasing the timeout from 100 ms to 5 minutes (LONG_TIMEOUT). Patch by Victor Stinner. - test_capi: Fix test_no_FatalError_infinite_loop() to no longer write a coredump, by using test.support.SuppressCrashReport. Patch by Victor Stinner. - Avoid creating a reference to the test object in :meth:`~unittest.TestResult.collectedDurations`. - Moved tests for zipfile.Path into Lib/test/test_zipfile/_path. Made zipfile._path a package. - Check for linux/limits.h before including it in Modules/posixmodule.c. - Detect MPI compilers in :file:`configure`. - Add experimental wasi-threads support. Patch by Takashi Yamamoto. - Update Windows build to use OpenSSL 3.0.9 - Update macOS installer to use OpenSSL 3.0.9. - Fix bugs in the Argument Clinic destination <name> clear command; the destination buffers would never be cleared, and the destination directive parser would simply continue to the fault handler after processing the command. Patch by Erlend E. Aasland. - freeze now fetches CONFIG_ARGS from the original CPython instance the Makefile uses to call utility scripts. Patch by Ijtaba Hussain. - :c:func:`PyModule_AddObjectRef` is now only available in the limited API version 3.10 or later. OBS-URL: https://build.opensuse.org/request/show/1102652 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:Factory/python312?expand=0&rev=19
2023-08-07 17:58:04 +02:00
Index: Python-3.12.0rc1/Lib/sysconfig.py
===================================================================
Accepting request 1102652 from home:dgarcia:branches:devel:languages:python:Factory - Refresh all patches - Drop Revert-gh105127-left-tests.patch, in upstream now - Update to 3.12.0rc1: - Reverted the :mod:`email.utils` security improvement change released in 3.12beta4 that unintentionally caused :mod:`email.utils.getaddresses` to fail to parse email addresses with a comma in the quoted name field. See :gh:`106669`. - Start initializing ob_digit during creation of :c:type:`PyLongObject` objects. Patch by Illia Volochii. - Increase C recursion limit for functions other than the main interpreter from 800 to 1500. This should allow functions like list.__repr__ and json.dumps to handle all the inputs that they could prior to 3.12 - Fix potential unaligned memory access on C APIs involving returned sequences of char * pointers within the :mod:`grp` and :mod:`socket` modules. These were revealed using a -fsaniziter=alignment build on ARM macOS. Patch by Christopher Chavez. - Add the exception as the third argument to PY_UNIND callbacks in sys.monitoring. This makes the PY_UNWIND callback consistent with the other exception hanlding callbacks. - Raise a ValueError when a monitoring callback funtion returns DISABLE for events that cannot be disabled locally. - Add a RERAISE event to sys.monitoring, which occurs when an exception is reraised, either explicitly by a plain raise statement, or implicitly in an except or finally block. - Unsupported modules now always fail to be imported. - Fix classmethod-style :func:`super` method calls (i.e., where the second argument to :func:`super`, or the implied second argument drawn from self/cls in the case of zero-arg super, is a type) when the target of the call is not a classmethod. - Python no longer crashes due an infrequent race when initialzing per-interpreter interned strings. The crash would manifest when the interpreter was finalized. - Python no longer crashes due to an infrequent race in setting Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors (both deprecated), when simultaneously initializing two isolated subinterpreters. Now they are only set during runtime initialization. - Fix a segmentation fault caused by a use-after-free bug in frame_dealloc when the trashcan delays the deallocation of a PyFrameObject. - No longer suppress arbitrary errors in the __annotations__ getter and setter in the type and module types. - Propagate frozen_modules to multiprocessing spawned process interpreters. - Prevent out-of-bounds memory access during mmap.find() calls. - Seems that in some conditions, OpenSSL will return SSL_ERROR_SYSCALL instead of SSL_ERROR_SSL when a certification verification has failed, but the error parameters will still contain ERR_LIB_SSL and SSL_R_CERTIFICATE_VERIFY_FAILED. We are now detecting this situation and raising the appropiate ssl.SSLCertVerificationError. Patch by Pablo Galindo - Fix :func:`types.get_original_bases` to only return :attr:`!__orig_bases__` if it is present on cls directly. Patch by James Hilton-Balfe. - Prevent memory leak and use-after-free when using pointers to pointers with ctypes - Make :func:`gettext.pgettext` search plural definitions when translation is not found. - Document behavior of :func:`shutil.disk_usage` for non-mounted filesystems on Unix. - Do not report MultipartInvariantViolationDefect defect when the :class:`email.parser.Parser` class is used to parse emails with headersonly=True. - Fix invalid result from :meth:`PurePath.relative_to` method when attempting to walk a ".." segment in other with walk_up enabled. A :exc:`ValueError` exception is now raised in this case. - Fix potential missing NULL check of d2i_SSL_SESSION result in _ssl.c. - Update the bundled copy of pip to version 23.2.1. - Fixed several bugs in zipfile.Path, including: in Path.match`, Windows separators are no longer honored (and never were meant to be); Fixed ``name/suffix/suffixes/stem operations when no filename is present and the Path is not at the root of the zipfile; Reworked glob for performance and more correct matching behavior. - Add __copy__ and __deepcopy__ in :mod:`enum` - Revert a change to :func:`colorsys.rgb_to_hls` that caused division by zero for certain almost-white inputs. Patch by Terry Jan Reedy. - Instances of :class:`typing.TypeVar`, :class:`typing.ParamSpec`, :class:`typing.ParamSpecArgs`, :class:`typing.ParamSpecKwargs`, and :class:`typing.TypeVarTuple` once again support weak references, fixing a regression introduced in Python 3.12.0 beta 1. Patch by Jelle Zijlstra. - Detect possible memory allocation failure in the libtommath function :c:func:`mp_init` used by the _tkinter module. - Fix crash when calling repr with a manually constructed SignalDict object. Patch by Charlie Zhao. - Change the default return value of :meth:`http.client.HTTPConnection.get_proxy_response_headers` to be None and not {}. - Ensure gettext(msg) retrieve translations even if a plural form exists. In other words: gettext(msg) == ngettext(msg, '', 1). - Add documentation for :c:type:`PyInterpreterConfig` and :c:func:`Py_NewInterpreterFromConfig`. Also clarify some of the nearby docs relative to per-interpreter GIL. - Document the :mod:`curses` module variables :const:`~curses.LINES` and :const:`~curses.COLS`. - Add a number of standard external names to nitpick_ignore. - Add documentation on how to localize the :mod:`argparse` module. - test_logging: Fix test_udp_reconnection() by increasing the timeout from 100 ms to 5 minutes (LONG_TIMEOUT). Patch by Victor Stinner. - test_capi: Fix test_no_FatalError_infinite_loop() to no longer write a coredump, by using test.support.SuppressCrashReport. Patch by Victor Stinner. - Avoid creating a reference to the test object in :meth:`~unittest.TestResult.collectedDurations`. - Moved tests for zipfile.Path into Lib/test/test_zipfile/_path. Made zipfile._path a package. - Check for linux/limits.h before including it in Modules/posixmodule.c. - Detect MPI compilers in :file:`configure`. - Add experimental wasi-threads support. Patch by Takashi Yamamoto. - Update Windows build to use OpenSSL 3.0.9 - Update macOS installer to use OpenSSL 3.0.9. - Fix bugs in the Argument Clinic destination <name> clear command; the destination buffers would never be cleared, and the destination directive parser would simply continue to the fault handler after processing the command. Patch by Erlend E. Aasland. - freeze now fetches CONFIG_ARGS from the original CPython instance the Makefile uses to call utility scripts. Patch by Ijtaba Hussain. - :c:func:`PyModule_AddObjectRef` is now only available in the limited API version 3.10 or later. OBS-URL: https://build.opensuse.org/request/show/1102652 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:Factory/python312?expand=0&rev=19
2023-08-07 17:58:04 +02:00
--- Python-3.12.0rc1.orig/Lib/sysconfig.py
+++ Python-3.12.0rc1/Lib/sysconfig.py
@@ -104,6 +104,11 @@ if os.name == 'nt':
else:
_INSTALL_SCHEMES['venv'] = _INSTALL_SCHEMES['posix_venv']
+# For a brief period of time in the Fedora 36 life cycle,
+# this installation scheme existed and was documented in the release notes.
+# For backwards compatibility, we keep it here (at least on 3.10 and 3.11).
+_INSTALL_SCHEMES['rpm_prefix'] = _INSTALL_SCHEMES['posix_prefix']
+
# NOTE: site.py has copy of this function.
# Sync it when modify this function.
@@ -163,6 +168,19 @@ if _HAS_USER_BASE:
},
}
+# This is used by distutils.command.install in the stdlib
+# as well as pypa/distutils (e.g. bundled in setuptools).
+# The self.prefix value is set to sys.prefix + /local/
+# if neither RPM build nor virtual environment is
+# detected to make distutils install packages
+# into the separate location.
+# https://fedoraproject.org/wiki/Changes/Making_sudo_pip_safe
+if (not (hasattr(sys, 'real_prefix') or
+ sys.prefix != sys.base_prefix) and
+ 'RPM_BUILD_ROOT' not in os.environ):
+ _prefix_addition = '/local'
+
+
_SCHEME_KEYS = ('stdlib', 'platstdlib', 'purelib', 'platlib', 'include',
'scripts', 'data')
@@ -263,11 +281,40 @@ def _extend_dict(target_dict, other_dict
target_dict[key] = value
+_CONFIG_VARS_LOCAL = None
+
+
+def _config_vars_local():
+ # This function returns the config vars with prefixes amended to /usr/local
+ # https://fedoraproject.org/wiki/Changes/Making_sudo_pip_safe
+ global _CONFIG_VARS_LOCAL
+ if _CONFIG_VARS_LOCAL is None:
+ _CONFIG_VARS_LOCAL = dict(get_config_vars())
+ _CONFIG_VARS_LOCAL['base'] = '/usr/local'
+ _CONFIG_VARS_LOCAL['platbase'] = '/usr/local'
+ return _CONFIG_VARS_LOCAL
+
+
def _expand_vars(scheme, vars):
res = {}
if vars is None:
vars = {}
- _extend_dict(vars, get_config_vars())
+
+ # when we are not in a virtual environment or an RPM build
+ # we change '/usr' to '/usr/local'
+ # to avoid surprises, we explicitly check for the /usr/ prefix
+ # Python virtual environments have different prefixes
+ # we only do this for posix_prefix, not to mangle the venv scheme
+ # posix_prefix is used by sudo pip install
+ # 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
+ _PREFIX == '/usr' and
+ 'RPM_BUILD_ROOT' not in os.environ):
+ _extend_dict(vars, _config_vars_local())
+ else:
+ _extend_dict(vars, get_config_vars())
+
if os.name == 'nt':
# On Windows we want to substitute 'lib' for schemes rather
# than the native value (without modifying vars, in case it
Accepting request 1102652 from home:dgarcia:branches:devel:languages:python:Factory - Refresh all patches - Drop Revert-gh105127-left-tests.patch, in upstream now - Update to 3.12.0rc1: - Reverted the :mod:`email.utils` security improvement change released in 3.12beta4 that unintentionally caused :mod:`email.utils.getaddresses` to fail to parse email addresses with a comma in the quoted name field. See :gh:`106669`. - Start initializing ob_digit during creation of :c:type:`PyLongObject` objects. Patch by Illia Volochii. - Increase C recursion limit for functions other than the main interpreter from 800 to 1500. This should allow functions like list.__repr__ and json.dumps to handle all the inputs that they could prior to 3.12 - Fix potential unaligned memory access on C APIs involving returned sequences of char * pointers within the :mod:`grp` and :mod:`socket` modules. These were revealed using a -fsaniziter=alignment build on ARM macOS. Patch by Christopher Chavez. - Add the exception as the third argument to PY_UNIND callbacks in sys.monitoring. This makes the PY_UNWIND callback consistent with the other exception hanlding callbacks. - Raise a ValueError when a monitoring callback funtion returns DISABLE for events that cannot be disabled locally. - Add a RERAISE event to sys.monitoring, which occurs when an exception is reraised, either explicitly by a plain raise statement, or implicitly in an except or finally block. - Unsupported modules now always fail to be imported. - Fix classmethod-style :func:`super` method calls (i.e., where the second argument to :func:`super`, or the implied second argument drawn from self/cls in the case of zero-arg super, is a type) when the target of the call is not a classmethod. - Python no longer crashes due an infrequent race when initialzing per-interpreter interned strings. The crash would manifest when the interpreter was finalized. - Python no longer crashes due to an infrequent race in setting Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors (both deprecated), when simultaneously initializing two isolated subinterpreters. Now they are only set during runtime initialization. - Fix a segmentation fault caused by a use-after-free bug in frame_dealloc when the trashcan delays the deallocation of a PyFrameObject. - No longer suppress arbitrary errors in the __annotations__ getter and setter in the type and module types. - Propagate frozen_modules to multiprocessing spawned process interpreters. - Prevent out-of-bounds memory access during mmap.find() calls. - Seems that in some conditions, OpenSSL will return SSL_ERROR_SYSCALL instead of SSL_ERROR_SSL when a certification verification has failed, but the error parameters will still contain ERR_LIB_SSL and SSL_R_CERTIFICATE_VERIFY_FAILED. We are now detecting this situation and raising the appropiate ssl.SSLCertVerificationError. Patch by Pablo Galindo - Fix :func:`types.get_original_bases` to only return :attr:`!__orig_bases__` if it is present on cls directly. Patch by James Hilton-Balfe. - Prevent memory leak and use-after-free when using pointers to pointers with ctypes - Make :func:`gettext.pgettext` search plural definitions when translation is not found. - Document behavior of :func:`shutil.disk_usage` for non-mounted filesystems on Unix. - Do not report MultipartInvariantViolationDefect defect when the :class:`email.parser.Parser` class is used to parse emails with headersonly=True. - Fix invalid result from :meth:`PurePath.relative_to` method when attempting to walk a ".." segment in other with walk_up enabled. A :exc:`ValueError` exception is now raised in this case. - Fix potential missing NULL check of d2i_SSL_SESSION result in _ssl.c. - Update the bundled copy of pip to version 23.2.1. - Fixed several bugs in zipfile.Path, including: in Path.match`, Windows separators are no longer honored (and never were meant to be); Fixed ``name/suffix/suffixes/stem operations when no filename is present and the Path is not at the root of the zipfile; Reworked glob for performance and more correct matching behavior. - Add __copy__ and __deepcopy__ in :mod:`enum` - Revert a change to :func:`colorsys.rgb_to_hls` that caused division by zero for certain almost-white inputs. Patch by Terry Jan Reedy. - Instances of :class:`typing.TypeVar`, :class:`typing.ParamSpec`, :class:`typing.ParamSpecArgs`, :class:`typing.ParamSpecKwargs`, and :class:`typing.TypeVarTuple` once again support weak references, fixing a regression introduced in Python 3.12.0 beta 1. Patch by Jelle Zijlstra. - Detect possible memory allocation failure in the libtommath function :c:func:`mp_init` used by the _tkinter module. - Fix crash when calling repr with a manually constructed SignalDict object. Patch by Charlie Zhao. - Change the default return value of :meth:`http.client.HTTPConnection.get_proxy_response_headers` to be None and not {}. - Ensure gettext(msg) retrieve translations even if a plural form exists. In other words: gettext(msg) == ngettext(msg, '', 1). - Add documentation for :c:type:`PyInterpreterConfig` and :c:func:`Py_NewInterpreterFromConfig`. Also clarify some of the nearby docs relative to per-interpreter GIL. - Document the :mod:`curses` module variables :const:`~curses.LINES` and :const:`~curses.COLS`. - Add a number of standard external names to nitpick_ignore. - Add documentation on how to localize the :mod:`argparse` module. - test_logging: Fix test_udp_reconnection() by increasing the timeout from 100 ms to 5 minutes (LONG_TIMEOUT). Patch by Victor Stinner. - test_capi: Fix test_no_FatalError_infinite_loop() to no longer write a coredump, by using test.support.SuppressCrashReport. Patch by Victor Stinner. - Avoid creating a reference to the test object in :meth:`~unittest.TestResult.collectedDurations`. - Moved tests for zipfile.Path into Lib/test/test_zipfile/_path. Made zipfile._path a package. - Check for linux/limits.h before including it in Modules/posixmodule.c. - Detect MPI compilers in :file:`configure`. - Add experimental wasi-threads support. Patch by Takashi Yamamoto. - Update Windows build to use OpenSSL 3.0.9 - Update macOS installer to use OpenSSL 3.0.9. - Fix bugs in the Argument Clinic destination <name> clear command; the destination buffers would never be cleared, and the destination directive parser would simply continue to the fault handler after processing the command. Patch by Erlend E. Aasland. - freeze now fetches CONFIG_ARGS from the original CPython instance the Makefile uses to call utility scripts. Patch by Ijtaba Hussain. - :c:func:`PyModule_AddObjectRef` is now only available in the limited API version 3.10 or later. OBS-URL: https://build.opensuse.org/request/show/1102652 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:Factory/python312?expand=0&rev=19
2023-08-07 17:58:04 +02:00
Index: Python-3.12.0rc1/Lib/test/test_sysconfig.py
===================================================================
Accepting request 1102652 from home:dgarcia:branches:devel:languages:python:Factory - Refresh all patches - Drop Revert-gh105127-left-tests.patch, in upstream now - Update to 3.12.0rc1: - Reverted the :mod:`email.utils` security improvement change released in 3.12beta4 that unintentionally caused :mod:`email.utils.getaddresses` to fail to parse email addresses with a comma in the quoted name field. See :gh:`106669`. - Start initializing ob_digit during creation of :c:type:`PyLongObject` objects. Patch by Illia Volochii. - Increase C recursion limit for functions other than the main interpreter from 800 to 1500. This should allow functions like list.__repr__ and json.dumps to handle all the inputs that they could prior to 3.12 - Fix potential unaligned memory access on C APIs involving returned sequences of char * pointers within the :mod:`grp` and :mod:`socket` modules. These were revealed using a -fsaniziter=alignment build on ARM macOS. Patch by Christopher Chavez. - Add the exception as the third argument to PY_UNIND callbacks in sys.monitoring. This makes the PY_UNWIND callback consistent with the other exception hanlding callbacks. - Raise a ValueError when a monitoring callback funtion returns DISABLE for events that cannot be disabled locally. - Add a RERAISE event to sys.monitoring, which occurs when an exception is reraised, either explicitly by a plain raise statement, or implicitly in an except or finally block. - Unsupported modules now always fail to be imported. - Fix classmethod-style :func:`super` method calls (i.e., where the second argument to :func:`super`, or the implied second argument drawn from self/cls in the case of zero-arg super, is a type) when the target of the call is not a classmethod. - Python no longer crashes due an infrequent race when initialzing per-interpreter interned strings. The crash would manifest when the interpreter was finalized. - Python no longer crashes due to an infrequent race in setting Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors (both deprecated), when simultaneously initializing two isolated subinterpreters. Now they are only set during runtime initialization. - Fix a segmentation fault caused by a use-after-free bug in frame_dealloc when the trashcan delays the deallocation of a PyFrameObject. - No longer suppress arbitrary errors in the __annotations__ getter and setter in the type and module types. - Propagate frozen_modules to multiprocessing spawned process interpreters. - Prevent out-of-bounds memory access during mmap.find() calls. - Seems that in some conditions, OpenSSL will return SSL_ERROR_SYSCALL instead of SSL_ERROR_SSL when a certification verification has failed, but the error parameters will still contain ERR_LIB_SSL and SSL_R_CERTIFICATE_VERIFY_FAILED. We are now detecting this situation and raising the appropiate ssl.SSLCertVerificationError. Patch by Pablo Galindo - Fix :func:`types.get_original_bases` to only return :attr:`!__orig_bases__` if it is present on cls directly. Patch by James Hilton-Balfe. - Prevent memory leak and use-after-free when using pointers to pointers with ctypes - Make :func:`gettext.pgettext` search plural definitions when translation is not found. - Document behavior of :func:`shutil.disk_usage` for non-mounted filesystems on Unix. - Do not report MultipartInvariantViolationDefect defect when the :class:`email.parser.Parser` class is used to parse emails with headersonly=True. - Fix invalid result from :meth:`PurePath.relative_to` method when attempting to walk a ".." segment in other with walk_up enabled. A :exc:`ValueError` exception is now raised in this case. - Fix potential missing NULL check of d2i_SSL_SESSION result in _ssl.c. - Update the bundled copy of pip to version 23.2.1. - Fixed several bugs in zipfile.Path, including: in Path.match`, Windows separators are no longer honored (and never were meant to be); Fixed ``name/suffix/suffixes/stem operations when no filename is present and the Path is not at the root of the zipfile; Reworked glob for performance and more correct matching behavior. - Add __copy__ and __deepcopy__ in :mod:`enum` - Revert a change to :func:`colorsys.rgb_to_hls` that caused division by zero for certain almost-white inputs. Patch by Terry Jan Reedy. - Instances of :class:`typing.TypeVar`, :class:`typing.ParamSpec`, :class:`typing.ParamSpecArgs`, :class:`typing.ParamSpecKwargs`, and :class:`typing.TypeVarTuple` once again support weak references, fixing a regression introduced in Python 3.12.0 beta 1. Patch by Jelle Zijlstra. - Detect possible memory allocation failure in the libtommath function :c:func:`mp_init` used by the _tkinter module. - Fix crash when calling repr with a manually constructed SignalDict object. Patch by Charlie Zhao. - Change the default return value of :meth:`http.client.HTTPConnection.get_proxy_response_headers` to be None and not {}. - Ensure gettext(msg) retrieve translations even if a plural form exists. In other words: gettext(msg) == ngettext(msg, '', 1). - Add documentation for :c:type:`PyInterpreterConfig` and :c:func:`Py_NewInterpreterFromConfig`. Also clarify some of the nearby docs relative to per-interpreter GIL. - Document the :mod:`curses` module variables :const:`~curses.LINES` and :const:`~curses.COLS`. - Add a number of standard external names to nitpick_ignore. - Add documentation on how to localize the :mod:`argparse` module. - test_logging: Fix test_udp_reconnection() by increasing the timeout from 100 ms to 5 minutes (LONG_TIMEOUT). Patch by Victor Stinner. - test_capi: Fix test_no_FatalError_infinite_loop() to no longer write a coredump, by using test.support.SuppressCrashReport. Patch by Victor Stinner. - Avoid creating a reference to the test object in :meth:`~unittest.TestResult.collectedDurations`. - Moved tests for zipfile.Path into Lib/test/test_zipfile/_path. Made zipfile._path a package. - Check for linux/limits.h before including it in Modules/posixmodule.c. - Detect MPI compilers in :file:`configure`. - Add experimental wasi-threads support. Patch by Takashi Yamamoto. - Update Windows build to use OpenSSL 3.0.9 - Update macOS installer to use OpenSSL 3.0.9. - Fix bugs in the Argument Clinic destination <name> clear command; the destination buffers would never be cleared, and the destination directive parser would simply continue to the fault handler after processing the command. Patch by Erlend E. Aasland. - freeze now fetches CONFIG_ARGS from the original CPython instance the Makefile uses to call utility scripts. Patch by Ijtaba Hussain. - :c:func:`PyModule_AddObjectRef` is now only available in the limited API version 3.10 or later. OBS-URL: https://build.opensuse.org/request/show/1102652 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:Factory/python312?expand=0&rev=19
2023-08-07 17:58:04 +02:00
--- Python-3.12.0rc1.orig/Lib/test/test_sysconfig.py
+++ Python-3.12.0rc1/Lib/test/test_sysconfig.py
@@ -110,8 +110,19 @@ class TestSysConfig(unittest.TestCase):
for scheme in _INSTALL_SCHEMES:
for name in _INSTALL_SCHEMES[scheme]:
expected = _INSTALL_SCHEMES[scheme][name].format(**config_vars)
+ tested = get_path(name, scheme)
+ # https://fedoraproject.org/wiki/Changes/Making_sudo_pip_safe
+ if tested.startswith('/usr/local'):
+ # /usr/local should only be used in posix_prefix
+ self.assertEqual(scheme, 'posix_prefix')
+ # Fedora CI runs tests for venv and virtualenv that check for other prefixes
+ self.assertEqual(sys.prefix, '/usr')
+ # When building the RPM of Python, %check runs this with RPM_BUILD_ROOT set
+ # Fedora CI runs this with RPM_BUILD_ROOT unset
+ self.assertNotIn('RPM_BUILD_ROOT', os.environ)
+ tested = tested.replace('/usr/local', '/usr')
self.assertEqual(
- os.path.normpath(get_path(name, scheme)),
+ os.path.normpath(tested),
os.path.normpath(expected),
)
@@ -335,7 +346,7 @@ class TestSysConfig(unittest.TestCase):
self.assertTrue(os.path.isfile(config_h), config_h)
def test_get_scheme_names(self):
- wanted = ['nt', 'posix_home', 'posix_prefix', 'posix_venv', 'nt_venv', 'venv']
+ wanted = ['nt', 'posix_home', 'posix_prefix', 'posix_venv', 'nt_venv', 'venv', 'rpm_prefix']
if HAS_USER_BASE:
wanted.extend(['nt_user', 'osx_framework_user', 'posix_user'])
self.assertEqual(get_scheme_names(), tuple(sorted(wanted)))
@@ -347,6 +358,8 @@ class TestSysConfig(unittest.TestCase):
cmd = "-c", "import sysconfig; print(sysconfig.get_platform())"
self.assertEqual(py.call_real(*cmd), py.call_link(*cmd))
+ @unittest.skipIf('RPM_BUILD_ROOT' not in os.environ,
+ "Test doesn't expect Fedora's paths")
def test_user_similar(self):
# Issue #8759: make sure the posix scheme for the users
# is similar to the global posix_prefix one