U ÀÒ.eTiã @s¢dZddlZddlZddlZddlZddlmZmZz ddlZWne k r\ddl ZYnXdddddd d d d d dg Z dd„Z ej ršej e ej ƒ¡Zn e e ¡ƒZejdkrÖdedd… ¡krÖe ej ee¡ƒZejdkr dedd… ¡kr e ej eee¡ƒZejdkrBdedd… ¡krBe ej eee¡ƒZdd„ZeƒZdadd„Ze ¡Ze d¡Zdd„Zej ¡dZ ejdd …Z!e de d!Z"ej #ej$¡Z%ej #ej&¡Z'da(dZ)d"d#„Z*d$d%„Z+d&d'„Z,d(d)„Z-d*d+„Z.d,d-„Z/dEd.d/„Z0d0d„Z1d1d2„Z2d3d4„Z3dFd5d„Z4d6d„Z5d7d „Z6d8d „Z7e.ƒdd9fd:d „Z8e.ƒdd9fd;d„Z9dd „ZdBdC„Z?e@dDkrže?ƒdS)Gz-Access to Python's configuration information.éN)ÚpardirÚrealpathÚget_config_h_filenameÚget_config_varÚget_config_varsÚget_makefile_filenameÚget_pathÚget_path_namesÚ get_pathsÚ get_platformÚget_python_versionÚget_scheme_namesÚparse_config_hcCs(z t|ƒWStk r"|YSXdS©N)rÚOSError)Úpath©rúK/usr/lib/python3.8/site-packages/pip/_vendor/distlib/_backport/sysconfig.pyÚ_safe_realpath"s rÚntZpcbuildiøÿÿÿz\pc\viöÿÿÿz\pcbuild\amd64iòÿÿÿcCs,dD]"}tj tj td|¡¡rdSqdS)N)z Setup.distz Setup.localZModulesTF)ÚosrÚisfileÚjoinÚ _PROJECT_BASE)ÚfnrrrÚis_python_build:srFc CsŽtsŠddlm}t dd¡d}||ƒ}| d¡}|s>tdƒ‚| ¡}t  |¡W5QRXt r†dD] }t  |d d ¡t  |d d ¡qdd adS)Né)ÚfinderÚ.érz sysconfig.cfgzsysconfig.cfg exists)Ú posix_prefixZ posix_homeÚincludez{srcdir}/IncludeÚ platincludez{projectbase}/.T) Ú _cfg_readZ resourcesrÚ__name__ÚrsplitÚfindÚAssertionErrorZ as_streamÚ_SCHEMESZreadfpÚ _PYTHON_BUILDÚset)rZbackport_packageZ_finderZ_cfgfileÚsÚschemerrrÚ_ensure_cfg_readDs    r-z \{([^{]*?)\}c sÈtƒ| d¡r| d¡}ntƒ}| ¡}|D]8}|dkr._replacer) r-Z has_sectionÚitemsÚtupleÚsectionsZ has_optionr*Zremove_sectionÚdictÚ _VAR_REPLÚsub)Úconfigr.r9ZsectionZoptionÚvaluer6rr4rÚ_expand_globalsYs$       r?ércs‡fdd„}t ||¡S)z»In the string `path`, replace tokens like {some.thing} with the corresponding value from the map `local_vars`. If there is no corresponding value, leave the token unchanged. cs8| d¡}|ˆkrˆ|S|tjkr.tj|S| d¡Sr/)r1rÚenvironr2©Ú local_varsrrr6‹s    z_subst_vars.._replacer©r;r<)rrCr6rrBrÚ _subst_vars…s rEcCs0| ¡}| ¡D]\}}||kr"q|||<qdSr)Úkeysr7)Z target_dictZ other_dictZ target_keysÚkeyr>rrrÚ _extend_dict•s rHcCs`i}|dkri}t|tƒƒt |¡D]4\}}tjdkrDtj |¡}tj t ||ƒ¡||<q&|S)N)Úposixr) rHrr(r7rr3rÚ expanduserÚnormpathrE)r,ÚvarsÚresrGr>rrrÚ _expand_varss   rNcs‡fdd„}t ||¡S)Ncs$| d¡}|ˆkrˆ|S| d¡Sr/r0r2©rLrrr6«s zformat_value.._replacerrD)r>rLr6rrOrÚ format_valueªs rPcCstjdkrdStjS)NrIr )rr3rrrrÚ_get_default_scheme³s rQcCs’tj dd¡}dd„}tjdkrBtj d¡p.d}|r8|S||dƒStjdkr|td ƒ}|r||r`|S|dd |d tjdd …ƒS|r„|S|dd ƒSdS)NÚPYTHONUSERBASEcWstj tjj|Ž¡Sr)rrrJr)ÚargsrrrÚjoinuser½sz_getuserbase..joinuserrÚAPPDATAú~ÚPythonÚdarwinZPYTHONFRAMEWORKÚLibraryz%d.%drz.local)rrAÚgetr3ÚsysÚplatformrÚ version_info)Úenv_baserTÚbaseZ frameworkrrrÚ _getuserbaseºs$     ÿr`c Cst d¡}t d¡}t d¡}|dkr*i}i}i}tj|ddd}| ¡}W5QRX|D]š} |  d¡sZ|  ¡d krvqZ| | ¡} | rZ|  d d ¡\} } |  ¡} |   d d ¡} d | krº| || <qZz t | ƒ} Wn$t k rê|   d d ¡|| <YqZX| || <qZt |  ¡ƒ}d}t|ƒdkrÔt|ƒD]°}||}| |¡p>| |¡} | dk rº|  d ¡} d}| |krpt|| ƒ}nˆ| |kr€d}nx| tjkr˜tj| }n`| |krì| d¡rÆ|dd…|krÆd }n$d| |krÚd}nt|d| ƒ}n d || <}|rÌ||  ¡d…}|d|  ¡…||}d |kr:|||<n~z t |ƒ}Wn"t k rh| ¡||<Yn X|||<| |¡| d¡rÌ|dd…|krÌ|dd…}||krÌ|||<n|||<| |¡qq| ¡D]"\}} t| tƒrÜ|  ¡||<qÜ| |¡|S)zÌParse a Makefile-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary. z"([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)z\$\(([A-Za-z][A-Za-z0-9_]*)\)z\${([A-Za-z][A-Za-z0-9_]*)}Nzutf-8Úsurrogateescape)ÚencodingÚerrorsú#Úrrz$$ú$)ÚCFLAGSÚLDFLAGSZCPPFLAGSrTFZPY_r@)ÚreÚcompileÚcodecsÚopenÚ readlinesÚ startswithÚstripÚmatchr1ÚreplaceÚintÚ ValueErrorÚlistrFÚlenr8ÚsearchÚstrrrAÚendÚstartÚremover7Ú isinstanceÚupdate)ÚfilenamerLZ _variable_rxZ _findvar1_rxZ _findvar2_rxZdoneZnotdoneÚfÚlinesÚlineÚmÚnÚvZtmpvr5Zrenamed_variablesr3r>ÚfoundÚitemZafterÚkrrrÚ_parse_makefile×s                 ÿ      ÿ     r‡cCsDtrtj td¡Sttdƒr,dttjf}nd}tj t dƒ|d¡S)z Return the path of the Makefile.ZMakefileÚabiflagsz config-%s%sr=Ústdlib) r)rrrrÚhasattrr[Ú_PY_VERSION_SHORTrˆr)Zconfig_dir_namerrrrMs  c Csètƒ}zt||ƒWnJtk r^}z,d|}t|dƒrF|d|j}t|ƒ‚W5d}~XYnXtƒ}z"t|ƒ}t||ƒW5QRXWnJtk rÒ}z,d|}t|dƒrº|d|j}t|ƒ‚W5d}~XYnXträ|d|d<dS)z7Initialize the module as appropriate for POSIX systems.z.invalid Python installation: unable to open %sÚstrerrorz (%s)NÚ BLDSHAREDZLDSHARED) rr‡ÚIOErrorrŠrŒrrlrr))rLZmakefileÚeÚmsgZconfig_hr~rrrÚ _init_posixXs&   r‘cCsVtdƒ|d<tdƒ|d<tdƒ|d<d|d<d |d <t|d <tj ttjƒ¡|d <d S)z+Initialize the module as appropriate for NTr‰ZLIBDESTZ platstdlibZ BINLIBDESTr!Z INCLUDEPYz.pydZSOz.exeZEXEZVERSIONZBINDIRN)rÚ_PY_VERSION_SHORT_NO_DOTrrÚdirnamerr[Ú executablerOrrrÚ_init_non_posixts   r•cCsš|dkr i}t d¡}t d¡}| ¡}|s.q–| |¡}|rx| dd¡\}}z t|ƒ}Wntk rlYnX|||<q | |¡}|r d|| d¡<q |S)zÌParse a config.h-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary. Nz"#define ([A-Z][A-Za-z0-9_]+) (.*) z&/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/ rrr)rirjÚreadlinerpr1rrrs)ÚfprLZ define_rxZundef_rxr€rr‚rƒrrrr„s&      cCs:tr$tjdkrtj td¡}q,t}ntdƒ}tj |d¡S)zReturn the path of pyconfig.h.rZPCr"z pyconfig.h)r)rr3rrrr)Zinc_dirrrrr£s  cCsttt ¡ƒƒS)z,Return a tuple containing the schemes names.)r8Úsortedr(r9rrrrr ¯scCs t d¡S)z*Return a tuple containing the paths names.r )r(Zoptionsrrrrr ´sTcCs&tƒ|rt||ƒStt |¡ƒSdS)z°Return a mapping containing an install scheme. ``scheme`` is the install scheme name. If not provided, it will return the default scheme for the current platform. N)r-rNr:r(r7)r,rLÚexpandrrrr ºs cCst|||ƒ|S)z[Return a path corresponding to the scheme. ``scheme`` is the install scheme name. )r )r3r,rLr™rrrrÇscGs¬tdkrziattd<ttd<ttd<ttd<tdtdtd<ttd <ttd <ttd <ztjtd <Wntk r„d td <YnXt j dkr˜t tƒt j dkrªt tƒtj dkr¾tƒtd<dtkrÐttd<nttdƒtd<tr\t j dkr\t}z t  ¡}Wntk rd}YnXt j td¡s\||kr\t j |td¡}t j |¡td<tjdkrzt  ¡d}t| d¡dƒ}|dkrÊdD]2}t|}t dd|¡}t dd|¡}|t|<q”n°dt jkrt jd}dD]0}t|}t dd|¡}|d|}|t|<qät dd ¡} t d| ¡} | dk rz|   d¡} t j !| ¡szdD]$}t|}t dd|¡}|t|<qT|r¤g} |D]} |  "t | ¡¡qˆ| StSdS)ayWith no arguments, return a dictionary of all configuration variables relevant for the current platform. On Unix, this means every variable defined in Python's installed Makefile; On Windows and Mac OS it's a much smaller set. With arguments, return a list of values that result from looking up each argument in the configuration variable dictionary. NÚprefixÚ exec_prefixZ py_versionZpy_version_shortrrZpy_version_nodotr_ZplatbaseZ projectbaserˆre)rZos2rIz2.6ÚuserbaseÚsrcdirrXré)rhZ BASECFLAGSrgZ PY_CFLAGSrz -arch\s+\w+\sú z-isysroot [^ ]*Z ARCHFLAGSrgz-isysroot\s+(\S+)rz-isysroot\s+\S+(\s|$))#Ú _CONFIG_VARSÚ_PREFIXÚ _EXEC_PREFIXÚ _PY_VERSIONr‹rr[rˆÚAttributeErrorrr3r•r‘Úversionr`rr)ÚgetcwdrrÚisabsrrKr\ÚunamerrÚsplitrir<rArZrvr1ÚexistsÚappend)rSr_ÚcwdrZkernel_versionZ major_versionrGÚflagsZarchrgrZsdkZvalsr3rrrrÏs‚        ÿ           cCs tƒ |¡S)z“Return the value of a single variable using the dictionary returned by 'get_config_vars()'. Equivalent to get_config_vars().get(name) )rrZ)r3rrrrRscCs^tjdkrnd}tj |¡}|dkr(tjStj d|¡}tj|t|ƒ|… ¡}|dkr\dS|dkrhdStjStjd ks‚ttd ƒsˆtjSt  ¡\}}}}}| ¡  d d ¡}|  d d¡}|  d d¡}|dd…dkrÞd||fS|dd…dkr&|ddkrPd}dt |dƒd|dd…f}n*|dd…dkrDd||fS|dd…dkrdd|||fS|dd…d kr d }t   d!¡} |  |¡} | rP|  ¡}n°|dd…d"krPtƒ} |  d#¡} | } z td$ƒ}Wntk rèYnJXzt  d%| ¡¡} W5| ¡X| dk r2d& |  d'¡ d&¡dd…¡} | s<| } | rP| }d(}| d&d)krd*tƒ d+d ¡ ¡krd,}tƒ d+¡}t  d-|¡}ttt|ƒƒƒ}t|ƒd'kr´|d}n^|d.krÄd,}nN|d/krÔd0}n>|d1kräd2}n.|d3krôd4}n|d5krd6}ntd7|fƒ‚n<|d8kr0tjd9krPd:}n |d;krPtjd9krLd<}nd=}d>|||fS)?a«Return a string that identifies the current platform. This is used mainly to distinguish platform-specific build directories and platform-specific built distributions. Typically includes the OS name and version and the architecture (as supplied by 'os.uname()'), although the exact information included depends on the OS; eg. for IRIX the architecture isn't particularly important (IRIX only runs on SGI hardware), but for Linux the kernel version isn't particularly important. Examples of returned values: linux-i586 linux-alpha (?) solaris-2.6-sun4u irix-5.3 irix64-6.2 Windows will return one of: win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc) win-ia64 (64bit Windows on Itanium) win32 (all others - specifically, sys.platform is returned) For other non-POSIX platforms, currently just returns 'sys.platform'. rz bit (éÿÿÿÿú)Zamd64z win-amd64Zitaniumzwin-ia64rIr¨ú/rerŸÚ_ú-NéZlinuxz%s-%sZsunosrÚ5Zsolarisz%d.%sr@réZirixZaixz%s-%s.%séÚcygwinz[\d.]+rXZMACOSX_DEPLOYMENT_TARGETz0/System/Library/CoreServices/SystemVersion.plistz=ProductUserVisibleVersion\s*(.*?)rrZmacosxz10.4.z-archrgZfatz -arch\s+(\S+))Úi386Úppc)r¸Úx86_64Zintel)r¸r¹rºZfat3)Úppc64rºZfat64)r¸r¹r»rºZ universalz%Don't know machine value for archs=%rr¸lrº)ZPowerPCZPower_Macintoshr»r¹z%s-%s-%s) rr3r[r¥r&r\ruÚlowerrŠr¨rqrrrirjrpr1rrZrlrŽÚcloservÚreadrr©roÚfindallr8r˜r*rsÚmaxsize)ršÚiÚjZlookZosnameZhostÚreleaser¥ÚmachineZrel_rerZcfgvarsZmacverZ macreleaser~ZcflagsZarchsrrrr [s¨     $      ÿ  ÿ        ÿ    cCstSr)r‹rrrrr ýscCsFtt| ¡ƒƒD]0\}\}}|dkr0td|ƒtd||fƒqdS)Nrz%s: z %s = "%s")Ú enumerater˜r7Úprint)ÚtitleÚdataÚindexrGr>rrrÚ _print_dicts rÊcCsRtdtƒƒtdtƒƒtdtƒƒtƒtdtƒƒtƒtdtƒƒdS)z*Display all information sysconfig detains.zPlatform: "%s"zPython version: "%s"z!Current installation scheme: "%s"ZPathsZ VariablesN)rÆr r rQrÊr rrrrrÚ_mains rËÚ__main__)N)N)AÚ__doc__rkrrir[Zos.pathrrZ configparserÚ ImportErrorZ ConfigParserÚ__all__rr”rr“rr¦r3r¼rrr)r#r-ZRawConfigParserr(rjr;r?r¥r©r£r‹r’rKršr¡r›r¢r Z _USER_BASErErHrNrPrQr`r‡rr‘r•rrr r r rrrr r rÊrËr$rrrrÚsŽ õ "" #   v     #