zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
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ü?ã@sâdZddlZddlZddlZddlmZmZmZddlZddl    m
Z
ddl m Z ddl mZmZmZmZddlmZddlmZd    d
„ZGd d „d e
ƒZGd d„deƒZdZdZdZdd„Ze d¡Zdd„Zdd„Z dd„Z!dS)adistutils.cygwinccompiler
 
Provides the CygwinCCompiler class, a subclass of UnixCCompiler that
handles the Cygwin port of the GNU C compiler to Windows.  It also contains
the Mingw32CCompiler class which handles the mingw32 port of GCC (same as
cygwin in no-cygwin mode).
éN)ÚPopenÚPIPEÚ check_output)Ú UnixCCompiler)Ú
write_file)ÚDistutilsExecErrorÚCCompilerErrorÚ CompileErrorÚUnknownFileError)Ú LooseVersion)Úfind_executablecCs€tj d¡}|dkr|tj|d|d…}|dkr8dgS|dkrFdgS|d    krTd
gS|d krbd gS|d krpdgStd|ƒ‚dS)zaInclude the appropriate MSVC runtime library if Python was built
    with MSVC 7.0 or later.
    zMSC v.éÿÿÿÿéé
Z1300Zmsvcr70Z1310Zmsvcr71Z1400Zmsvcr80Z1500Zmsvcr90Z1600Zmsvcr100zUnknown MS Compiler version %s N)ÚsysÚversionÚfindÚ
ValueError)Zmsc_posZmsc_ver©rú\D:\z\workplace\VsCode\pyvenv\venv\Lib\site-packages\setuptools/_distutils/cygwinccompiler.pyÚ    get_msvcr=s rc
@sReZdZdZdZdZdZdZdZdZ    dZ
dd
d „Z d d „Z ddd„Z ddd„ZdS)ÚCygwinCCompilerz? Handles the Cygwin port of the GNU C compiler to Windows.
    Úcygwinz.oú.az.dllzlib%s%sz%s%sz.exercCsèt ||||¡tƒ\}}| d||f¡|tk    rB| d|¡tƒ\|_|_|_    | |j
d|j|j|j    f¡|jdkr†d|_ nd|_ |jdkrœd}nd    }|j d
d d d d|j |fd|jdkrÜdg|_ | d¡ntƒ|_ dS)Nz%Python's GCC status: %s (details: %s)zƒPython's pyconfig.h doesn't seem to support your compiler. Reason: %s. Compiling may fail because of undefined preprocessor macros.z: gcc %s, ld %s, dllwrap %s
z2.10.90ÚgccÚdllwrapú2.13ú-sharedú -mdll -staticzgcc -mcygwin -O -Wallzgcc -mcygwin -mdll -O -Wallzg++ -mcygwin -O -Wallz gcc -mcygwinz%s -mcygwin %s©ÚcompilerÚ compiler_soÚ compiler_cxxÚ
linker_exeÚ    linker_soú2.91.57Úmsvcrtz,Consider upgrading to a newer version of gcc)rÚ__init__Úcheck_config_hÚ debug_printÚ CONFIG_H_OKÚwarnÚ get_versionsÚ gcc_versionÚ
ld_versionZdllwrap_versionÚ compiler_typeÚ
linker_dllÚset_executablesÚ dll_librariesr)ÚselfÚverboseÚdry_runÚforceÚstatusÚdetailsÚ shared_optionrrrr'bsN
ÿýÿÿ
þÿ
 
 
ÿü
ÿzCygwinCCompiler.__init__c
Cs¨|dks|dkrVz| dd|d|g¡Wq¤tk
rR}z t|ƒ‚W5d}~XYq¤XnNz"| |j||d|g|¡Wn*tk
r¢}z t|ƒ‚W5d}~XYnXdS)z:Compiles the source by spawning GCC and windres if needed.ú.rcú.resZwindresz-iz-oN)Úspawnrr    r!)r3ÚobjÚsrcÚextZcc_argsÚextra_postargsZpp_optsÚmsgrrrÚ_compilesÿ
zCygwinCCompiler._compileNcCsPt |
p
g¡}
t |pg¡}t |p&g¡}| |j¡|dk    r||jksV|jdkrtj |d¡}tj tj     |¡¡\}}tj 
||d¡}tj 
|d|d¡}dtj     |¡dg}|D]}|  |¡q¾|  t ||fd    |¡|jd
kr|
 d |g¡|
 d |g¡n
|  |¡|    s(|
  d ¡t ||||||||d|    |
| | | ¡dS)zLink the objects.Nrrz.defÚlibrz
LIBRARY %sZEXPORTSz
writing %srz --output-libz--defz-s)ÚcopyÚextendr2Z
EXECUTABLEr0ÚosÚpathÚdirnameÚsplitextÚbasenameÚjoinÚappendÚexecuterrÚlink)r3Z target_descZobjectsZoutput_filenameÚ
output_dirÚ    librariesÚ library_dirsÚruntime_library_dirsÚexport_symbolsÚdebugZ extra_preargsr@Ú
build_tempZ target_langÚtemp_dirZdll_nameZ dll_extensionZdef_fileZlib_fileÚcontentsÚsymrrrrN¬sR 
ÿÿ
 
ÿþ  ÿ 
 
 ûzCygwinCCompiler.linkÚcCsª|dkr d}g}|D]}tj tj |¡¡\}}||jddgkrRtd||fƒ‚|rbtj |¡}|dkrŠ| tj ||||j    ¡¡q| tj |||j    ¡¡q|S)z#Adds supports for rc and res files.NrYr:r;z"unknown file type '%s' (from '%s'))r;r:)
rFrGrIÚnormcaseZsrc_extensionsr
rJrLrKÚ obj_extension)r3Zsource_filenamesZ    strip_dirrOZ    obj_namesÚsrc_nameÚbaser?rrrÚobject_filenamesús&ÿ   ÿ ÿz CygwinCCompiler.object_filenames)rrr)
NNNNNrNNNN)rrY)Ú__name__Ú
__module__Ú __qualname__Ú__doc__r/r[Zstatic_lib_extensionÚshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ exe_extensionr'rBrNr^rrrrrWs,
;ý
Nrc@seZdZdZdZddd„ZdS)ÚMingw32CCompilerz@ Handles the Mingw32 port of the GNU C compiler to Windows.
    Zmingw32rc    Csxt ||||¡|jdkr d}nd}|jdkr4d}nd}tƒrFtdƒ‚|jdd    d
d d |j||fd g|_t    ƒ|_dS)Nrrrr%z--entry _DllMain@12rYz1Cygwin gcc cannot be used with --compiler=mingw32z gcc -O -Wallzgcc -mdll -O -Wallz g++ -O -Wallrz%s %s %sr)
rr'r.r-Ú is_cygwingccrr1r0r2r)r3r4r5r6r9Ú entry_pointrrrr's.
 
ÿÿÿü zMingw32CCompiler.__init__N)rrr)r_r`rarbr/r'rrrrrdsrdÚokznot okZ    uncertainc
Cs°ddlm}dtjkrtdfS| ¡}zLt|ƒ}z4d| ¡krPtd|fW¢WSt    d|fW¢WSW5| ¡XWn8t
k
rª}zt d||j ffWY¢Sd    }~XYnXd    S)
awCheck if the current Python installation appears amenable to building
    extensions with GCC.
 
    Returns a tuple (status, details), where 'status' is one of the following
    constants:
 
    - CONFIG_H_OK: all is well, go ahead and compile
    - CONFIG_H_NOTOK: doesn't look good
    - CONFIG_H_UNCERTAIN: not sure -- unable to read pyconfig.h
 
    'details' is a human-readable string explaining the situation.
 
    Note there are two ways to conclude "OK": either 'sys.version' contains
    the string "GCC" (implying that this Python was built with GCC), or the
    installed "pyconfig.h" contains the string "__GNUC__".
    r)Ú    sysconfigZGCCzsys.version mentions 'GCC'Z__GNUC__z'%s' mentions '__GNUC__'z '%s' does not mention '__GNUC__'zcouldn't read '%s': %sN) Ú    distutilsrhrrr*Úget_config_h_filenameÚopenÚcloseÚreadÚCONFIG_H_NOTOKÚOSErrorÚCONFIG_H_UNCERTAINÚstrerror)rhÚfnÚconfig_hÚexcrrrr(Fs 
  ÿr(s(\d+\.\d+(\.\d+)*)cCsl| ¡d}t|ƒdkrdSt|dtdj}z | ¡}W5| ¡Xt |¡}|dkrZdSt    | 
d¡  ¡ƒS)z¤Find the version of an executable by running `cmd` in the shell.
 
    If the command is not found, or the output does not match
    `RE_VERSION`, returns None.
    rNT)ÚshellÚstdouté) Úsplitr rrrvrlrmÚ
RE_VERSIONÚsearchr ÚgroupÚdecode)ÚcmdÚ
executableÚoutÚ
out_stringÚresultrrrÚ_find_exe_versionss   
 
r‚cCsdddg}tdd„|DƒƒS)zg Try to find out the versions of gcc, ld and dllwrap.
 
    If not possible it returns None for it.
    zgcc -dumpversionzld -vzdllwrap --versioncSsg|] }t|ƒ‘qSr)r‚)Ú.0r}rrrÚ
<listcomp>Žsz get_versions.<locals>.<listcomp>)Útuple)Úcommandsrrrr,ˆs
r,cCstddgƒ}| ¡ d¡S)z>Try to determine if the gcc that would be used is from cygwin.rz -dumpmachinescygwin)rÚstripÚendswith)r€rrrres re)"rbrFrrDÚ
subprocessrrrÚreZdistutils.unixccompilerrÚdistutils.file_utilrÚdistutils.errorsrrr    r
Zdistutils.versionr Údistutils.spawnr rrrdr*rnrpr(Úcompileryr‚r,rerrrrÚ<module>s,/    ;1+