zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
U
H=®d*ã@s4ddlZddlmZddlZddlmZmZmZddl    Z    ddl
m Z m Z m Z ddlZddlmZddlmZzddlmZdd    „ZWn ek
r¤ed
d    „ƒZYnXed d „ƒZGd d„deƒZGdd„deƒZGdd„deƒZGdd„deƒZddd„Zd dd„Zdd„ZGdd„de ƒZ!Gdd„dej"ƒZ#dS)!éN)Úcontextmanager)ÚdirnameÚabspathÚjoin)Ú
check_callÚ check_outputÚSTDOUT)Úmkdtempé)ÚcompatcCs t td¡S©Nz_in_process.py)Ú    resourcesÚpathÚ __package__©rrúRD:\z\workplace\VsCode\pyvenv\venv\Lib\site-packages\pip/_vendor/pep517/wrappers.pyÚ_in_proc_script_pathsrccsttttƒƒdƒVdSr )ÚpjoinrrÚ__file__rrrrrsc    cs"tƒ}z
|VW5t |¡XdS©N)r    ÚshutilÚrmtree)ÚtdrrrÚtempdirs
rc@seZdZdZdd„ZdS)ÚBackendUnavailablezEWill be raised if the backend cannot be imported in the hook process.cCs
||_dSr©Ú    traceback©ÚselfrrrrÚ__init__#szBackendUnavailable.__init__N©Ú__name__Ú
__module__Ú __qualname__Ú__doc__rrrrrr!src@seZdZdZdd„ZdS)ÚBackendInvalidz)Will be raised if the backend is invalid.cCs||_||_||_dSr©Ú backend_nameÚ backend_pathÚmessage)rr'r(r)rrrr)szBackendInvalid.__init__Nr rrrrr%'sr%cs eZdZdZ‡fdd„Z‡ZS)Ú HookMissingz Will be raised on missing hooks.cstt|ƒ |¡||_dSr)Úsuperr*rÚ    hook_name)rr,©Ú    __class__rrr1szHookMissing.__init__)r!r"r#r$rÚ __classcell__rrr-rr*/sr*c@seZdZdZdd„ZdS)ÚUnsupportedOperationzDMay be raised by build_sdist if the backend indicates that it can't.cCs
||_dSrrrrrrr8szUnsupportedOperation.__init__Nr rrrrr06sr0cCs*tj ¡}|r| |¡t|||ddS)z5The default method of calling the wrapper subprocess.)ÚcwdÚenvN)ÚosÚenvironÚcopyÚupdater©Úcmdr1Ú extra_environr2rrrÚdefault_subprocess_runner<s
 
r:cCs,tj ¡}|r| |¡t|||tddS)zDA method of calling the wrapper subprocess while suppressing output.)r1r2ÚstderrN)r3r4r5r6rrr7rrrÚquiet_subprocess_runnerEs
 
r<cCsntj |¡rtdƒ‚tj |¡}tj tj ||¡¡}tj |¡}tj |¡}tj ||g¡|krjtdƒ‚|S)zèNormalise 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)    r3rÚisabsÚ
ValueErrorrÚnormpathrÚnormcaseÚ commonprefix)Ú source_treeÚ    requestedÚ
abs_sourceÚ abs_requestedÚ norm_sourceÚnorm_requestedrrrÚnorm_and_checkNs    rHc@s`eZdZdZddd„Zedd„ƒZddd„Zdd
d „Zdd d „Z    ddd„Z
ddd„Z dd„Z dS)ÚPep517HookCalleraeA wrapper around a source directory to be built with a PEP 517 backend.
 
    source_dir : The path to the source directory, containing pyproject.toml.
    build_backend : The build backend spec, as per PEP 517, from
        pyproject.toml.
    backend_path : The backend path, as per PEP 517, from pyproject.toml.
    runner : A callable that invokes the wrapper subprocess.
 
    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.
    NcsB|dkr t}t|ƒˆ_|ˆ_|r2‡fdd„|Dƒ}|ˆ_|ˆ_dS)Ncsg|]}tˆj|ƒ‘qSr)rHÚ
source_dir)Ú.0Úp©rrrÚ
<listcomp>„sz-Pep517HookCaller.__init__.<locals>.<listcomp>)r:rrJÚ build_backendr(Ú_subprocess_runner)rrJrOr(ÚrunnerrrMrrws
 
ÿzPep517HookCaller.__init__ccs$|j}||_z
dVW5||_XdS)z\A context manager for temporarily overriding the default subprocess
        runner.
        N)rP)rrQÚprevrrrÚsubprocess_runnerŠs
 
z"Pep517HookCaller.subprocess_runnercCs| dd|i¡S)aGIdentify 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_wheelÚconfig_settings©Ú
_call_hook©rrUrrrrT–s
ÿz-Pep517HookCaller.get_requires_for_build_wheelTcCs| dt|ƒ||dœ¡S)aqPrepare 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_wheel)Úmetadata_directoryrUÚ_allow_fallback©rWr)rrZrUr[rrrrY¤s
ýz1Pep517HookCaller.prepare_metadata_for_build_wheelcCs(|dk    rt|ƒ}| dt|ƒ||dœ¡S)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_wheel)Úwheel_directoryrUrZ)rrW)rr^rUrZrrrr]¶s ýzPep517HookCaller.build_wheelcCs| dd|i¡S)a<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_sdistrUrVrXrrrr_Ês
ÿz-Pep517HookCaller.get_requires_for_build_sdistcCs| dt|ƒ|dœ¡S)z£Build 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_directoryrUr\)rrarUrrrr`ØsþzPep517HookCaller.build_sdistc
 
CsVtjddkr|j d¡}n|j}d|i}|jrbtj |j¡}tjddkrZ| t ¡¡}||d<t    ƒä}d|i}t
j |t |dƒddt ƒ&}|jtjt|ƒ||g|j|d    W5QRXt
 t |d
ƒ¡}    |     d ¡rät|     d d ¡ƒ‚|     d¡rþt|     d d ¡ƒ‚|     d¡r$t|j|j|     dd ¡d‚|     d¡r8t|ƒ‚|    dW5QR£SQRXdS)NréÚASCIIÚPEP517_BUILD_BACKENDÚPEP517_BACKEND_PATHÚkwargsz
input.json)Úindent)r1r9z output.jsonÚ unsupportedrÚÚ
no_backendÚbackend_invalidÚ backend_errorr&Ú hook_missingÚ
return_val)ÚsysÚ version_inforOÚencoder(r3ÚpathseprÚgetfilesystemencodingrr Ú
write_jsonrrrPÚ
executableÚstrrJÚ    read_jsonÚgetr0rr%r*)
rr,rfrOr9r(rÚ
hook_inputÚscriptÚdatarrrrWäsDÿý
 
 
ý zPep517HookCaller._call_hook)NN)N)NT)NN)N)N) r!r"r#r$rrrSrTrYr]r_r`rWrrrrrIfs û
 
 
þ
þ
 
 
rIc@s<eZdZdZdd„Zdd„Zedd„ƒZdd    „Zd
d „Z    d S) Ú LoggerWrapperzd
    Read messages from a pipe and redirect them
    to a logger (see python's logging module).
    cCsHtj |¡d|_||_||_t ¡\|_|_    t 
|j¡|_ |  ¡dS)NT) Ú    threadingÚThreadrÚdaemonÚloggerÚlevelr3ÚpipeÚfd_readÚfd_writeÚfdopenÚreaderÚstart)rr€rrrrrs zLoggerWrapper.__init__cCs|jSr)r„rMrrrÚfileno(szLoggerWrapper.filenocCs| tj¡r|dd…S|S)Néÿÿÿÿ)Úendswithr3Úlinesep)ÚmsgrrrÚremove_newline+szLoggerWrapper.remove_newlinecCs |jD]}| | |¡¡qdSr)r†Ú_writer)rÚlinerrrÚrun/s
zLoggerWrapper.runcCs|j |j|¡dSr)r€Úlogr)rr)rrrrŽ3szLoggerWrapper._writeN)
r!r"r#r$rrˆÚ staticmethodrrrŽrrrrr|s 
r|)NN)NN)$r}Ú
contextlibrr3Úos.pathrrrrrÚ
subprocessrrrroÚtempfiler    rir Úimportlib.resourcesr rÚ ImportErrorrÚ    Exceptionrr%r*r0r:r<rHÚobjectrIr~r|rrrrÚ<module>s4     
 
    
    0