forked from pool/python312
Matej Cepl
c86d523da5
- 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
174 lines
6.9 KiB
Diff
174 lines
6.9 KiB
Diff
From 5754521af1d51aa8e445cba07a093bbc0c88596d Mon Sep 17 00:00:00 2001
|
|
From: Zackery Spytz <zspytz@gmail.com>
|
|
Date: Mon, 16 Dec 2019 18:24:08 -0700
|
|
Subject: [PATCH] bpo-31046: ensurepip does not honour the value of $(prefix)
|
|
|
|
Co-Authored-By: Xavier de Gaye <xdegaye@gmail.com>
|
|
---
|
|
Doc/library/ensurepip.rst | 9 +++--
|
|
Lib/ensurepip/__init__.py | 18 +++++++---
|
|
Lib/test/test_ensurepip.py | 11 ++++++
|
|
Makefile.pre.in | 4 +-
|
|
Misc/NEWS.d/next/Build/2019-12-16-17-50-42.bpo-31046.XA-Qfr.rst | 1
|
|
5 files changed, 34 insertions(+), 9 deletions(-)
|
|
create mode 100644 Misc/NEWS.d/next/Build/2019-12-16-17-50-42.bpo-31046.XA-Qfr.rst
|
|
|
|
Index: Python-3.12.0rc1/Doc/library/ensurepip.rst
|
|
===================================================================
|
|
--- Python-3.12.0rc1.orig/Doc/library/ensurepip.rst
|
|
+++ Python-3.12.0rc1/Doc/library/ensurepip.rst
|
|
@@ -59,8 +59,9 @@ is at least as recent as the one availab
|
|
By default, ``pip`` is installed into the current virtual environment
|
|
(if one is active) or into the system site packages (if there is no
|
|
active virtual environment). The installation location can be controlled
|
|
-through two additional command line options:
|
|
+through some additional command line options:
|
|
|
|
+* ``--prefix <dir>``: Installs ``pip`` using the given directory prefix.
|
|
* ``--root <dir>``: Installs ``pip`` relative to the given root directory
|
|
rather than the root of the currently active virtual environment (if any)
|
|
or the default root for the current Python installation.
|
|
@@ -92,7 +93,7 @@ Module API
|
|
Returns a string specifying the available version of pip that will be
|
|
installed when bootstrapping an environment.
|
|
|
|
-.. function:: bootstrap(root=None, upgrade=False, user=False, \
|
|
+.. function:: bootstrap(root=None, prefix=None, upgrade=False, user=False, \
|
|
altinstall=False, default_pip=False, \
|
|
verbosity=0)
|
|
|
|
@@ -102,6 +103,8 @@ Module API
|
|
If *root* is ``None``, then installation uses the default install location
|
|
for the current environment.
|
|
|
|
+ *prefix* specifies the directory prefix to use when installing.
|
|
+
|
|
*upgrade* indicates whether or not to upgrade an existing installation
|
|
of an earlier version of ``pip`` to the available version.
|
|
|
|
@@ -122,6 +125,8 @@ Module API
|
|
*verbosity* controls the level of output to :data:`sys.stdout` from the
|
|
bootstrapping operation.
|
|
|
|
+ .. versionchanged:: 3.9 the *prefix* parameter was added.
|
|
+
|
|
.. audit-event:: ensurepip.bootstrap root ensurepip.bootstrap
|
|
|
|
.. note::
|
|
Index: Python-3.12.0rc1/Lib/ensurepip/__init__.py
|
|
===================================================================
|
|
--- Python-3.12.0rc1.orig/Lib/ensurepip/__init__.py
|
|
+++ Python-3.12.0rc1/Lib/ensurepip/__init__.py
|
|
@@ -120,27 +120,27 @@ def _disable_pip_configuration_settings(
|
|
os.environ['PIP_CONFIG_FILE'] = os.devnull
|
|
|
|
|
|
-def bootstrap(*, root=None, upgrade=False, user=False,
|
|
+def bootstrap(*, root=None, prefix=None, upgrade=False, user=False,
|
|
altinstall=False, default_pip=False,
|
|
verbosity=0):
|
|
"""
|
|
Bootstrap pip into the current Python installation (or the given root
|
|
- directory).
|
|
+ and directory prefix).
|
|
|
|
Note that calling this function will alter both sys.path and os.environ.
|
|
"""
|
|
# Discard the return value
|
|
- _bootstrap(root=root, upgrade=upgrade, user=user,
|
|
+ _bootstrap(root=root, prefix=prefix, upgrade=upgrade, user=user,
|
|
altinstall=altinstall, default_pip=default_pip,
|
|
verbosity=verbosity)
|
|
|
|
|
|
-def _bootstrap(*, root=None, upgrade=False, user=False,
|
|
+def _bootstrap(*, root=None, prefix=None, upgrade=False, user=False,
|
|
altinstall=False, default_pip=False,
|
|
verbosity=0):
|
|
"""
|
|
Bootstrap pip into the current Python installation (or the given root
|
|
- directory). Returns pip command status code.
|
|
+ and directory prefix). Returns pip command status code.
|
|
|
|
Note that calling this function will alter both sys.path and os.environ.
|
|
"""
|
|
@@ -190,6 +190,8 @@ def _bootstrap(*, root=None, upgrade=Fal
|
|
args = ["install", "--no-cache-dir", "--no-index", "--find-links", tmpdir]
|
|
if root:
|
|
args += ["--root", root]
|
|
+ if prefix:
|
|
+ args += ["--prefix", prefix]
|
|
if upgrade:
|
|
args += ["--upgrade"]
|
|
if user:
|
|
@@ -265,6 +267,11 @@ def _main(argv=None):
|
|
help="Install everything relative to this alternate root directory.",
|
|
)
|
|
parser.add_argument(
|
|
+ "--prefix",
|
|
+ default=None,
|
|
+ help="Install everything using this prefix.",
|
|
+ )
|
|
+ parser.add_argument(
|
|
"--altinstall",
|
|
action="store_true",
|
|
default=False,
|
|
@@ -283,6 +290,7 @@ def _main(argv=None):
|
|
|
|
return _bootstrap(
|
|
root=args.root,
|
|
+ prefix=args.prefix,
|
|
upgrade=args.upgrade,
|
|
user=args.user,
|
|
verbosity=args.verbosity,
|
|
Index: Python-3.12.0rc1/Lib/test/test_ensurepip.py
|
|
===================================================================
|
|
--- Python-3.12.0rc1.orig/Lib/test/test_ensurepip.py
|
|
+++ Python-3.12.0rc1/Lib/test/test_ensurepip.py
|
|
@@ -105,6 +105,17 @@ class TestBootstrap(EnsurepipMixin, unit
|
|
unittest.mock.ANY,
|
|
)
|
|
|
|
+ def test_bootstrapping_with_prefix(self):
|
|
+ ensurepip.bootstrap(prefix="/foo/bar/")
|
|
+ self.run_pip.assert_called_once_with(
|
|
+ [
|
|
+ "install", "--no-cache-dir", "--no-index", "--find-links",
|
|
+ unittest.mock.ANY, "--prefix", "/foo/bar/",
|
|
+ "pip",
|
|
+ ],
|
|
+ unittest.mock.ANY,
|
|
+ )
|
|
+
|
|
def test_bootstrapping_with_user(self):
|
|
ensurepip.bootstrap(user=True)
|
|
|
|
Index: Python-3.12.0rc1/Makefile.pre.in
|
|
===================================================================
|
|
--- Python-3.12.0rc1.orig/Makefile.pre.in
|
|
+++ Python-3.12.0rc1/Makefile.pre.in
|
|
@@ -1909,7 +1909,7 @@ install: @FRAMEWORKINSTALLFIRST@ commoni
|
|
install|*) ensurepip="" ;; \
|
|
esac; \
|
|
$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
|
|
- $$ensurepip --root=$(DESTDIR)/ ; \
|
|
+ $$ensurepip --root=$(DESTDIR)/ --prefix=$(prefix) ; \
|
|
fi
|
|
|
|
.PHONY: altinstall
|
|
@@ -1920,7 +1920,7 @@ altinstall: commoninstall
|
|
install|*) ensurepip="--altinstall" ;; \
|
|
esac; \
|
|
$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
|
|
- $$ensurepip --root=$(DESTDIR)/ ; \
|
|
+ $$ensurepip --root=$(DESTDIR)/ --prefix=$(prefix) ; \
|
|
fi
|
|
|
|
.PHONY: commoninstall
|
|
Index: Python-3.12.0rc1/Misc/NEWS.d/next/Build/2019-12-16-17-50-42.bpo-31046.XA-Qfr.rst
|
|
===================================================================
|
|
--- /dev/null
|
|
+++ Python-3.12.0rc1/Misc/NEWS.d/next/Build/2019-12-16-17-50-42.bpo-31046.XA-Qfr.rst
|
|
@@ -0,0 +1 @@
|
|
+A directory prefix can now be specified when using :mod:`ensurepip`.
|