VULN_CHECK_I913V6 j.ddlZddlZddlZddlZddlmZddlmZddlmZ ddl m Z m Z m Z ddlmZdZd ZGd d eZGd d eZGddeZGddeZddZddZdZGddZy)N)contextmanager)abspath)join)STDOUT check_call check_output)_in_proc_script_pathc xt|dd5}tj||fi|dddy#1swYyxYw)Nwutf-8encoding)openjsondump)objpathkwargsfs F/usr/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_impl.py write_jsonr s/ dC' *a #q#F# + * *s09crt|d5}tj|cdddS#1swYyxYw)Nr r)rrload)rrs r read_jsonrs% dW %yy| & % %s-6ceZdZdZdZy)BackendUnavailablezEWill be raised if the backend cannot be imported in the hook process.c||_yN tracebackselfr!s r__init__zBackendUnavailable.__init__ "N__name__ __module__ __qualname____doc__r$r&rrrs O#r&rc"eZdZdZfdZxZS)BackendInvalidz)Will be raised if the backend is invalid.c@t||||_||_yr)superr$ backend_name backend_path)r#r1r2message __class__s rr$zBackendInvalid.__init__s  !((r&r(r)r*r+r$ __classcell__r4s@rr.r.s3))r&r.c"eZdZdZfdZxZS) HookMissingz>Will be raised on missing hooks (if a fallback can't be used).c2t||||_yr)r0r$ hook_name)r#r;r4s rr$zHookMissing.__init__'s #"r&r5r7s@rr9r9%sH##r&r9ceZdZdZdZy)UnsupportedOperationzDMay be raised by build_sdist if the backend indicates that it can't.c||_yrr r"s rr$zUnsupportedOperation.__init__.r%r&Nr'r,r&rr=r=,s N#r&r=ctjj}|r|j|t |||y)zwThe default method of calling the wrapper subprocess. This uses :func:`subprocess.check_call` under the hood. )cwdenvN)osenvironcopyupdatercmdr@ extra_environrAs rdefault_subprocess_runnerrI2s/ **// C =!s%r&ctjj}|r|j|t |||t y)zqCall the subprocess while suppressing output. This uses :func:`subprocess.check_output` under the hood. )r@rAstderrN)rBrCrDrErrrFs rquiet_subprocess_runnerrL>s1 **// C =!#3v6r&ctjj|r tdtjj |}tjj tjj ||}tjj|}tjj|}tjj||g|k7r td|S)zNormalise and check a backend path. Ensure that the requested backend path is specified as a relative path, and resolves to a location under the given source tree. Return an absolute version of the requested path. zpaths must be relativez paths must be inside source tree) rBrisabs ValueErrorrnormpathrnormcase commonprefix) source_tree requested abs_source abs_requested norm_sourcenorm_requesteds rnorm_and_checkrYJs ww}}Y122-JGG$$RWW\\*i%HIM''"":.KWW%%m4N ww[.9:kI;<< r&ceZdZdZ ddZedZdZddZ ddZ ddZ dd Z dd Z dd Z dd Zdd ZdZy)BuildBackendHookCallerzFA wrapper to call the build backend hooks for a source directory. Nc|t}t||_||_|r#|Dcgc]}t |j|}}||_||_|stj}||_ ycc}w)a :param source_dir: The source directory to invoke the build backend for :param build_backend: The build backend spec :param backend_path: Additional path entries for the build backend spec :param runner: The :ref:`subprocess runner ` to use :param python_executable: The Python executable used to invoke the build backend N) rIr source_dir build_backendrYr2_subprocess_runnersys executablepython_executable)r#r]r^r2runnerrbps rr$zBuildBackendHookCaller.__init__fsx >.F!*-* `. .. code-block:: python hook_caller = BuildBackendHookCaller(...) with hook_caller.subprocess_runner(quiet_subprocess_runner): ... N)r_)r#rcprevs rsubprocess_runnerz(BuildBackendHookCaller.subprocess_runners3&&"( + &*D #dD #s/#/ ,/c&|jdiS)z>Return the list of optional features supported by the backend._supported_features _call_hook)r#s rriz*BuildBackendHookCaller._supported_featuress4b99r&c*|jdd|iS)a6Get additional dependencies required for building a wheel. :returns: A list of :pep:`dependency specifiers <508>`. :rtype: list[str] .. admonition:: Fallback If the build backend does not defined a hook with this name, an empty list will be returned. get_requires_for_build_wheelconfig_settingsrjr#rns rrmz3BuildBackendHookCaller.get_requires_for_build_wheels#= @   r&c@|jdt|||dS)aPrepare a ``*.dist-info`` folder with metadata for this project. :returns: Name of the newly created subfolder within ``metadata_directory``, containing the metadata. :rtype: str .. admonition:: Fallback If the build backend does not define a hook with this name and ``_allow_fallback`` is truthy, the backend will be asked to build a wheel via the ``build_wheel`` hook and the dist-info extracted from that will be returned. prepare_metadata_for_build_wheelmetadata_directoryrn_allow_fallbackrkrr#rsrnrts rrqz7BuildBackendHookCaller.prepare_metadata_for_build_wheels- A")*<"=..D   r&cZ| t|}|jdt|||dS)aBuild a wheel from this project. :returns: The name of the newly created wheel within ``wheel_directory``. .. admonition:: Interaction with fallback If the ``build_wheel`` hook was called in the fallback for :meth:`prepare_metadata_for_build_wheel`, the build backend would not be invoked. Instead, the previously built wheel will be copied to ``wheel_directory`` and the name of that file will be returned. build_wheelwheel_directoryrnrsrrkr#rzrnrss rrxz"BuildBackendHookCaller.build_wheels<  )!();!< }&7."4/   r&c*|jdd|iS)a@Get additional dependencies required for building an editable wheel. :returns: A list of :pep:`dependency specifiers <508>`. :rtype: list[str] .. admonition:: Fallback If the build backend does not defined a hook with this name, an empty list will be returned. get_requires_for_build_editablernrjros rr~z6BuildBackendHookCaller.get_requires_for_build_editables#@ C   r&c@|jdt|||dS)aPrepare a ``*.dist-info`` folder with metadata for this project. :returns: Name of the newly created subfolder within ``metadata_directory``, containing the metadata. :rtype: str .. admonition:: Fallback If the build backend does not define a hook with this name and ``_allow_fallback`` is truthy, the backend will be asked to build a wheel via the ``build_editable`` hook and the dist-info extracted from that will be returned. #prepare_metadata_for_build_editablerrrurvs rrz:BuildBackendHookCaller.prepare_metadata_for_build_editables- D")*<"=..G   r&cZ| t|}|jdt|||dS)a Build an editable wheel from this project. :returns: The name of the newly created wheel within ``wheel_directory``. .. admonition:: Interaction with fallback If the ``build_editable`` hook was called in the fallback for :meth:`prepare_metadata_for_build_editable`, the build backend would not be invoked. Instead, the previously built wheel will be copied to ``wheel_directory`` and the name of that file will be returned. build_editableryr{r|s rrz%BuildBackendHookCaller.build_editables=  )!();!< /&7."42   r&c*|jdd|iS)zGet additional dependencies required for building an sdist. :returns: A list of :pep:`dependency specifiers <508>`. :rtype: list[str] get_requires_for_build_sdistrnrjros rrz3BuildBackendHookCaller.get_requires_for_build_sdists# = @   r&c>|jdt||dS)zBuild an sdist from this project. :returns: The name of the newly created sdist within ``wheel_directory``. build_sdist)sdist_directoryrnru)r#rrns rrz"BuildBackendHookCaller.build_sdists' }&7./   r&c d|ji}|jr.tjj |j}||d<t j 5}d|i}t|t|ddt5}|j}|j|tt|||g|j|dddtt|d} | j!d rt#| j!d d | j!d rt%| j!d d | j!d r2t'|j|j| j!dd | j!drt)| j!dxs|| dcdddS#1swYxYw#1swYyxYw)NPEP517_BUILD_BACKENDPEP517_BACKEND_PATHrz input.json)indent)r@rHz output.json unsupportedr! no_backendbackend_invalid backend_error)r1r2r3 hook_missingmissing_hook_name return_val)r^r2rBpathseprtempfileTemporaryDirectoryrpjoinr rbr_rstrr]rgetr=rr.r9) r#r;rrHr2td hook_inputscriptpythondatas rrkz!BuildBackendHookCaller._call_hook)s/1C1CD   ::??4+<+<=L3?M/ 0  ( ( *b"F+J z5\#:1 E&'6//''WS[19bA"/((U2}56Dxx &*488K+DEExx %(+r)BCCxx)*$!%!3!3!%!2!2 HH_b9 xx'!$((+>"?"L9MM %5+ * (' + *s&'GAF:C+G:G ?GG)NNNr)NTNN)r(r)r*r+r$rrgrirmrqrxr~rrrrrkr,r&rr[r[bs}" 3>++":  7;  .48# .  7;  .48# 0   !&r&r[r)rrBr`r contextlibros.pathrrr subprocessrrr _in_processr rr Exceptionrr.r9r=rIrLrYr[r,r&rrsx %!77-$  ## )Y)#)##9# & 70h&h&r&