Reu4`ddlZddlmZddlZddlmZmZddlZddl m Z m Z m Z ddl Z ddlmZddlmZddlmZgd Zed ZGd d eZGd deZGddeZGddeZddZddZdZGddeZGddej Z!dS)N)contextmanager)abspathjoin) check_call check_outputSTDOUT)mkdtemp)compat)_in_proc_script_path)BackendUnavailableBackendInvalid HookMissingUnsupportedOperationdefault_subprocess_runnerquiet_subprocess_runnerPep517HookCallerc#Kt} |Vtj|dS#tj|wxYwN)r shutilrmtree)tds /builddir/build/BUILDROOT/alt-python311-pip-21.3.1-3.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_vendor/pep517/wrappers.pytempdirrsI B b bs ,AceZdZdZdZdS)r zEWill be raised if the backend cannot be imported in the hook process.c||_dSr tracebackselfrs r__init__zBackendUnavailable.__init__# "N__name__ __module__ __qualname____doc__r!r#rr r !s)OO#####r#r ceZdZdZdZdS)rz)Will be raised if the backend is invalid.c0||_||_||_dSr backend_name backend_pathmessage)r r-r.r/s rr!zBackendInvalid.__init__)s(( r#Nr$r)r#rrr's)33r#rc"eZdZdZfdZxZS)rz Will be raised on missing hooks.cftt||||_dSr)superrr! hook_name)r r3 __class__s rr!zHookMissing.__init__1s, k4  )))444"r#)r%r&r'r(r! __classcell__)r4s@rrr/s>**#########r#rceZdZdZdZdS)rzDMay be raised by build_sdist if the backend indicates that it can't.c||_dSrrrs rr!zUnsupportedOperation.__init__8r"r#Nr$r)r#rrr6s)NN#####r#rctj}|r||t |||dS)z5The default method of calling the wrapper subprocess.)cwdenvN)osenvironcopyupdatercmdr9 extra_environr:s rrr<sH *//  C" =!!!s%%%%%%r#ctj}|r||t |||t dS)zDA method of calling the wrapper subprocess while suppressing output.)r9r:stderrN)r;r<r=r>rrr?s rrrEsJ *//  C" =!!!#3v666666r#ctj|rtdtj|}tjtj||}tj|}tj|}tj||g|krtd|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) r;pathisabs ValueErrorrnormpathrnormcase commonprefix) source_tree requested abs_source abs_requested norm_sourcenorm_requesteds rnorm_and_checkrQNs w}}Y31222--JG$$RW\\*i%H%HIIM'"":..KW%%m44N w[.9::kII;<<< r#ceZdZdZ ddZedZdZddZ ddZ dd Z dd Z dd Z dd Z dd ZddZdZdS)raA wrapper around a source directory to be built with a PEP 517 backend. :param source_dir: The path to the source directory, containing pyproject.toml. :param build_backend: The build backend spec, as per PEP 517, from pyproject.toml. :param backend_path: The backend path, as per PEP 517, from pyproject.toml. :param runner: A callable that invokes the wrapper subprocess. :param python_executable: The Python executable used to invoke the backend The 'runner', if provided, must expect the following: - cmd: a list of strings representing the command and arguments to execute, as would be passed to e.g. 'subprocess.check_call'. - cwd: a string representing the working directory that must be used for the subprocess. Corresponds to the provided source_dir. - extra_environ: a dict mapping environment variable names to values which must be set for the subprocess execution. Nc|t}t|_|_|rfd|D}|_|_|s t j}|_dS)Nc:g|]}tj|Sr))rQ source_dir).0pr s r z-Pep517HookCaller.__init__..s278t22r#) rrrU build_backendr._subprocess_runnersys executablepython_executable)r rUrYr.runnerr]s` rr!zPep517HookCaller.__init__zs >.F!*--*  Return the list of optional features supported by the backend._supported_features _call_hookr s rrcz$Pep517HookCaller._supported_featuress4b999r#c2|dd|iS)aIIdentify packages required for building a wheel Returns a list of dependency specifications, e.g.:: ["wheel >= 0.25", "setuptools"] This does not include requirements specified in pyproject.toml. It returns the result of calling the equivalently named hook in a subprocess. get_requires_for_build_wheelconfig_settingsrdr ris rrhz-Pep517HookCaller.get_requires_for_build_wheel(= @    r#TcP|dt|||dS)auPrepare a ``*.dist-info`` folder with metadata for this project. Returns the name of the newly created folder. If the build backend defines a hook with this name, it will be called in a subprocess. If not, the backend will be asked to build a wheel, and the dist-info extracted from that (unless _allow_fallback is False). prepare_metadata_for_build_wheelmetadata_directoryri_allow_fallbackrerr rorirps rrmz1Pep517HookCaller.prepare_metadata_for_build_wheels;A")*<"="=..D D    r#cr|t|}|dt|||dS)avBuild a wheel from this project. Returns the name of the newly created file. In general, this will call the 'build_wheel' hook in the backend. However, if that was previously called by 'prepare_metadata_for_build_wheel', and the same metadata_directory is used, the previously built wheel will be copied to wheel_directory. N build_wheelwheel_directoryrirorrer rvriros rrtzPep517HookCaller.build_wheelsL  )!();!= 0.25", "setuptools"] This does not include requirements specified in pyproject.toml. It returns the result of calling the equivalently named hook in a subprocess. get_requires_for_build_editablerirdrjs rrzz0Pep517HookCaller.get_requires_for_build_editables(@ C    r#cP|dt|||dS)aPrepare a ``*.dist-info`` folder with metadata for this project. Returns the name of the newly created folder. If the build backend defines a hook with this name, it will be called in a subprocess. If not, the backend will be asked to build an editable wheel, and the dist-info extracted from that (unless _allow_fallback is False). #prepare_metadata_for_build_editablernrqrrs rr|z4Pep517HookCaller.prepare_metadata_for_build_editables;D")*<"="=..G G    r#cr|t|}|dt|||dS)aBuild an editable wheel from this project. Returns the name of the newly created file. In general, this will call the 'build_editable' hook in the backend. However, if that was previously called by 'prepare_metadata_for_build_editable', and the same metadata_directory is used, the previously built wheel will be copied to wheel_directory. Nbuild_editablerurwrxs rr~zPep517HookCaller.build_editablesM  )!();!Identify packages required for building a wheel Returns a list of dependency specifications, e.g.:: ["setuptools >= 26"] This does not include requirements specified in pyproject.toml. It returns the result of calling the equivalently named hook in a subprocess. get_requires_for_build_sdistrirdrjs rrz-Pep517HookCaller.get_requires_for_build_sdist rkr#cN|dt||dS)zBuild an sdist from this project. Returns the name of the newly created file. This calls the 'build_sdist' backend hook in a subprocess. build_sdist)sdist_directoryrirq)r rris rrzPep517HookCaller.build_sdists4}&77./ /    r#c tjddkr|jd}n|j}d|i}|jret j|j}tjddkr&|tj}||d<t5}d|i}tj |t|ddt5}|j} || t!t#|||g|j| dddn #1swxYwYtjt|d } | d r#t+| d d | dr#t-| d d | dr0t/|j|j| dd | dr$t1| dp|| dcdddS#1swxYwYdS)NrASCIIPEP517_BUILD_BACKENDPEP517_BACKEND_PATHkwargsz input.json)indent)r9rAz output.json unsupportedr no_backendbackend_invalid backend_errorr, hook_missingmissing_hook_name return_val)r[ version_inforYencoder.r;pathseprgetfilesystemencodingrr write_jsonpjoinr r]rZrstrrU read_jsongetrr rr) r r3rrYrAr.r hook_inputscriptpythondatas rrezPep517HookCaller._call_hook&s  A ! # # .55g>>MM .M/?   @:??4+<==L"a''+2233L3N3NOO 3?M/ 0 YY &""F+J  j%L*A*A%& ( ( ( (&'' 6/''WS[[119bA"/(               #E"m$<$<==Dxx && F*488K+D+DEEExx %% D(+r)B)BCCCxx)** $!%!3!%!2 HH_b99 xx'' N!$((+>"?"?"L9MMM %7 & & & & & & & & & & & & & & & & & &s878I-/AD>2 I->E I-E DI--I14I1)NNNrNTNN)r%r&r'r(r!rrarcrhrmrtrzr|r~rrrer)r#rrrfs6." 3333. + +^ +:::     7;     &48#    (     7;     &48#    (          /&/&/&/&/&r#rc@eZdZdZdZdZedZdZdZ dS) LoggerWrapperzd Read messages from a pipe and redirect them to a logger (see python's logging module). ctj|d|_||_||_t j\|_|_ t j |j|_ | dSr) threadingThreadr!daemonloggerlevelr;pipefd_readfd_writefdopenreaderstart)r rrs rr!zLoggerWrapper.__init__^sh!!$'''   ')gii# dmi --  r#c|jSr)rrfs rfilenozLoggerWrapper.filenoks }r#cX|tjr |ddn|S)N)endswithr;linesep)msgs rremove_newlinezLoggerWrapper.remove_newlinens'<< 33rs%%%%%% ******** 7777777777 ,,,,,,   ######## Y#####)########9### &&&&77770o&o&o&o&o&vo&o&o&d-----I$-----r#