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
U
G=®d½&ã@sdZddlZddlZddlZddlZddlZddlZddlZddlZddl    m
Z
ddl m Z ddddd    d
d gZ Gd d „d eƒZGd d„dejjƒZdd„Zdd„Zdd„Zdd„ZGdd„deƒZGdd„deƒZeƒZejZejZejZejZejZeƒZdS)a-A PEP 517 interface to setuptools
 
Previously, when a user or a command line tool (let's call it a "frontend")
needed to make a request of setuptools to take a certain action, for
example, generating a list of installation requirements, the frontend would
would call "setup.py egg_info" or "setup.py bdist_wheel" on the command line.
 
PEP 517 defines a different method of interfacing with setuptools. Rather
than calling "setup.py" directly, the frontend should:
 
  1. Set the current directory to the directory with a setup.py file
  2. Import this module into a safe python interpreter (one in which
     setuptools can potentially set global variables or crash hard).
  3. Call one of the functions defined in PEP 517.
 
What each function does is defined in PEP 517. However, here is a "casual"
definition of the functions (this definition should not be relied on for
bug reports or API stability):
 
  - `build_wheel`: build a wheel in the folder and return the basename
  - `get_requires_for_build_wheel`: get the `setup_requires` to build
  - `prepare_metadata_for_build_wheel`: get the `install_requires`
  - `build_sdist`: build an sdist in the folder and return the basename
  - `get_requires_for_build_sdist`: get the `setup_requires` to build
 
Again, this is not a formal definition! Just a "taste" of the module.
éN)ÚTemporaryDirectory)Úparse_requirementsÚget_requires_for_build_sdistÚget_requires_for_build_wheelÚ prepare_metadata_for_build_wheelÚ build_wheelÚ build_sdistÚ
__legacy__ÚSetupRequirementsErrorc@seZdZdd„ZdS)r
cCs
||_dS©N)Ú
specifiers)Úselfr ©rúLD:\z\workplace\VsCode\pyvenv\venv\Lib\site-packages\setuptools/build_meta.pyÚ__init__4szSetupRequirementsError.__init__N)Ú__name__Ú
__module__Ú __qualname__rrrrrr
3sc@s&eZdZdd„Zeejdd„ƒƒZdS)Ú DistributioncCstttt|ƒƒƒ}t|ƒ‚dSr )ÚlistÚmapÚstrrr
)r r Zspecifier_listrrrÚfetch_build_eggs9szDistribution.fetch_build_eggsccs*tjj}|tj_z
dVW5|tj_XdS)zw
        Replace
        distutils.dist.Distribution with this class
        for the duration of this context.
        N)Ú    distutilsÚcorer)ÚclsÚorigrrrÚpatch>s
 
zDistribution.patchN)rrrrÚ classmethodÚ
contextlibÚcontextmanagerrrrrrr8srcCs*tjddkr&t|tƒs&| t ¡¡S|S)z‘
    Convert a filename to a string (on Python 2, explicitly
    a byte string, not Unicode) as distutils checks for the
    exact type str.
    ré)ÚsysÚ version_infoÚ
isinstancerÚencodeÚgetfilesystemencoding)ÚsrrrÚ_to_strNsr(cs‡fdd„t ˆ¡DƒS)Ncs&g|]}tj tj ˆ|¡¡r|‘qSr)ÚosÚpathÚisdirÚjoin)Ú.0Úname©Za_dirrrÚ
<listcomp>\sÿz1_get_immediate_subdirectories.<locals>.<listcomp>©r)Úlistdirr/rr/rÚ_get_immediate_subdirectories[sr3cs"‡fdd„t |¡Dƒ}|\}|S)Nc3s|]}| ˆ¡r|VqdSr ©Úendswith©r-Úf©Ú    extensionrrÚ    <genexpr>as
ÿz'_file_with_extension.<locals>.<genexpr>r1)Ú    directoryr9ZmatchingÚfilerr8rÚ_file_with_extension`s
 
ÿr=cCs&tj |¡st d¡Sttdtƒ|ƒS)Nz%from setuptools import setup; setup()Úopen)r)r*ÚexistsÚioÚStringIOÚgetattrÚtokenizer>©Ú setup_scriptrrrÚ_open_setup_scriptis 
rFc@s`eZdZdd„Zdd„Zddd„Zdd    d
„Zdd d „Zdd d„Zdd„Z    ddd„Z
ddd„Z dS)Ú_BuildMetaBackendcCs|pi}| dg¡|S)Nú--global-option)Ú
setdefault©r Úconfig_settingsrrrÚ _fix_configss z_BuildMetaBackend._fix_configc
Csz| |¡}tjdd…dg|dt_z t ¡| ¡W5QRXWn,tk
rt}z||j7}W5d}~XYnX|S)NéÚegg_inforH)rLr"ÚargvrrÚ    run_setupr
r )r rKÚ requirementsÚerrrÚ_get_build_requiresxs
ÿ
z%_BuildMetaBackend._get_build_requiresúsetup.pyc    CsD|}d}t|ƒ}| ¡ dd¡}W5QRXtt||dƒtƒƒdS)NÚ__main__z\r\nz\nÚexec)rFÚreadÚreplacerVÚcompileÚlocals)r rEÚ__file__rr7ÚcoderrrrP…s
 
z_BuildMetaBackend.run_setupNcCs| |¡}|j|dgdS)NÚwheel©rQ©rLrSrJrrrrs
 
ÿz._BuildMetaBackend.get_requires_for_build_wheelcCs| |¡}|j|gdS)Nr^r_rJrrrr•s
z._BuildMetaBackend.get_requires_for_build_sdistcCsÀtjdd…ddt|ƒgt_| ¡|}dd„t |¡Dƒ}t|ƒdkrttt|ƒƒdkrttj     |t |¡d¡}q*t|ƒdksˆt
‚qˆq*||kr¸t   tj     ||d¡|¡t j |dd|dS)    NrMZ    dist_infoz
--egg-basecSsg|]}| d¡r|‘qS)z
.dist-infor4r6rrrr0¡s
ÿzF_BuildMetaBackend.prepare_metadata_for_build_wheel.<locals>.<listcomp>rT)Ú ignore_errors)r"rOr(rPr)r2Úlenr3r*r,ÚAssertionErrorÚshutilÚmoveÚrmtree)r Úmetadata_directoryrKZdist_info_directoryZ
dist_infosrrrr™s0ÿ
ÿþ ÿþz2_BuildMetaBackend.prepare_metadata_for_build_wheelc    Cs®| |¡}tj |¡}tj|ddt|dv}tjdd…|d|g|dt_| ¡t    ||ƒ}tj 
||¡}tj  |¡rŠt  |¡t  tj 
||¡|¡W5QRX|S)NT)Úexist_ok)ÚdirrMz
--dist-dirrH)rLr)r*ÚabspathÚmakedirsrr"rOrPr=r,r?ÚremoveÚrename)r Z setup_commandZresult_extensionZresult_directoryrKZ tmp_dist_dirZresult_basenameÚ result_pathrrrÚ_build_with_temp_dirºs&
  ÿþÿ 
 z&_BuildMetaBackend._build_with_temp_dircCs| dgd||¡S)NÚ bdist_wheelz.whl©rn)r Úwheel_directoryrKrfrrrrÑs
ÿz_BuildMetaBackend.build_wheelcCs| dddgd||¡S)NÚsdistz    --formatsÚgztarz.tar.gzrp)r Úsdist_directoryrKrrrrÖs
 þz_BuildMetaBackend.build_sdist)rT)N)N)N)NN)N) rrrrLrSrPrrrrnrrrrrrrGqs
 
 
ÿ
!ÿ
rGcs"eZdZdZd‡fdd„    Z‡ZS)Ú_BuildMetaLegacyBackendaOCompatibility backend for setuptools
 
    This is a version of setuptools.build_meta that endeavors
    to maintain backwards
    compatibility with pre-PEP 517 modes of invocation. It
    exists as a temporary
    bridge between the old packaging mechanism and the new
    packaging mechanism,
    and will eventually be removed.
    rTc
s€ttjƒ}tj tj |¡¡}|tjkr6tj d|¡tjd}|tjd<ztt    |ƒj
|dW5|tjdd…<|tjd<XdS)NrrD) rr"r*r)ÚdirnameriÚinsertrOÚsuperrurP)r rEÚsys_pathZ
script_dirZ
sys_argv_0©Ú    __class__rrrPçs
 
 
 
ÿÿ
z!_BuildMetaLegacyBackend.run_setup)rT)rrrÚ__doc__rPÚ __classcell__rrrzrruÜs
ru) r|r@r)r"rCrcrÚ
setuptoolsrZsetuptools.py31compatrÚ pkg_resourcesrÚ__all__Ú BaseExceptionr
Údistrr(r3r=rFÚobjectrGruZ_BACKENDrrrrrr    rrrrÚ<module>sB  ú         k)