grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/20263 ¡ fd¸ã@sBdZdZdZddlZddlZddlZddlZddlZddlZy ej Z Wn(e k rnej dškrfdZ nd Z YnXd Z d d d d d ddddddœ ZejdƒZdd„ZejdejƒZejdddfdd„Zdd„ZejdejƒZejdejƒZejdejƒZd›Zd.d/„Zddded0fd1d2„Zd3d4„Zdddefd5d6„Zd�d8d9„Zdžd:d;„Z ejd<ƒZ!d d=d>„Z"d¡d@d¢dAd£dCd¤dDd¥dFd¦dGd§dHd¨dJd©dKdªdLd«dMi Z#d¬dCd­dNd®dOd¯dPd°dQd±dRiZ$d²dSdT„Z%dUdV„Z&d´dWdX„Z'dYdZ„Z(d·d[d\„Z)d]d^„Z*d_d`„Z+d¸dadb„Z,dcdd„Z-d¹dedf„Z.dºdgdh„Z/d»d¼d½dlœZ0ejddfdmdn„Z1ej2dodpƒZ3da4dqdr„Z5dsdt„Z6dudv„Z7dwdx„Z8dydz„Z9d{d|„Z:d}d~„Z;ejdejƒZejd‚ƒZ?iZ@d¾dƒd„„ZAd…d†„ZBd‡dˆ„ZCd‰dŠ„ZDd‹dŒ„ZEd�dŽ„ZFd�d�„ZGd‘d’„ZHiZId¿d“d”„Z eJd•k�r>d–ejKk�pd—ejKkZLd˜ejKk�o$d™ejKkZMeNe eMeLƒƒejOdƒdS)Àa8 This module tries to retrieve as much platform-identifying data as possible. It makes this information available via function APIs. If called from the command line, it prints the platform information concatenated as single string to stdout. The output format is useable as part of a filename. a Copyright (c) 1999-2000, Marc-Andre Lemburg; mailto:mal@lemburg.com Copyright (c) 2000-2010, eGenix.com Software GmbH; mailto:info@egenix.com Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee or royalty is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation or portions thereof, including modifications, that you make. EGENIX.COM SOFTWARE GMBH DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE ! z1.0.8éNÚdosÚwin32Úwin16ZNULz /dev/nullz/etcé ééé(é2éÈ) ZdevZalphaÚaZbetaÚbÚcZRCÚrcÚplÚpz([0-9]+|[._+-])c Csfg}x\tj|ƒD]N}|dkryt|dƒ}d}Wn tk rNtj|dƒ}YnX|j||fƒqW|S)Nz._+-rédr)Ú _component_reÚsplitÚintÚ ValueErrorÚ _ver_stagesÚgetÚextend)ÚversionÚresultÚvÚt©rú-/opt/alt/python36/lib64/python3.6/platform.pyÚ_comparable_versionœs rsC(__libc_init)|(GLIBC_([0-9.]+))|(libc(_\w+)?\.so(?:\.(\d[0-9.]*))?)Úi@c Cs–t}ttjdƒrtjj|ƒ}t|dƒ��`}|j|ƒ}d}�xH|t|ƒk�r‚d|ksZd|krhtj ||ƒ}nd}| s‚|j ƒt|ƒkrº|j|ƒ} | r´|t |t|ƒdƒd…| }d}q<|sºPdd „|j ƒDƒ\} } } } }}| rè| rèd }n�| �r|d k�rd }| }n|| ƒ||ƒk�rx| }n^| �rx|d k�rxd }|�rR| �sN||ƒ||ƒk�rR|}|�rx|t|ƒ d…|k�rx||}|j ƒ}qÖszlibc_ver..ZlibcÚglibc) rÚhasattrÚosÚpathr!ÚopenÚreadÚlenÚ _libc_searchÚsearchÚendÚmaxÚgroups)Ú executableÚlibrZ chunksizeÚVÚfZbinaryÚposÚmÚchunkZlibcinitr(Z glibcversionZsoZthreadsZ soversionrrrÚlibc_ver°sJ        r;c Csptjjdƒrˆd}tdƒ�`}xX|D]P}|jƒ}t|ƒdkr |\}}nq |dkrV|jƒ}q |dkr |jdƒ}|d}q WWdQRX|||fStjjdƒrætdƒ�D}x<|D]4}|jdƒ} t| ƒdkr¤| d d kr¤d | d |fSq¤WWdQRXtjjd ƒ�rftjd ƒ} x:t t| ƒd ddƒD]"} | | dd …dk�r| | =�qW| �rf| j ƒd}| dd d…}|||fS|||fS)zÙ Tries some special tricks to get the distribution information in case the default method fails. Currently supports older SuSE Linux, Caldera OpenLinux and Slackware Linux distributions. z/var/adm/inst-log/infoÚSuSEéZMIN_DIST_VERSIONZ DIST_IDENTú-Nz/etc/.installedrZ OpenLinuxéz/usr/lib/setupézslack-version-Ú slackwareéÿÿÿÿrBrB) r*r+Úexistsr,rr.ÚstripÚisdirÚlistdirÚrangeÚsort) ÚdistnamerÚidr7ÚlineZtvÚtagÚvalueÚvaluesZpkgZverfilesÚnrrrÚ_dist_try_harderês>               rPz(\w+)[-_](release|version)z'(.+) release ([\d.]+)[^(]*(?:\((.+)\))?z1([^0-9]+)(?: release )?([\d.]+)[^(]*(?:\((.+)\))?r<ÚdebianÚfedoraÚredhatÚcentosÚmandrakeÚmandrivaÚrocksrAÚ yellowdogÚgentooÚ UnitedLinuxÚ turbolinuxÚarchÚmageiacCszd}d}tj|ƒ}|dk r&t|jƒƒStj|ƒ}|dk rDt|jƒƒS|jƒjƒ}|rp|d}t|ƒdkrp|d}d||fS)Nr rr?)Ú_lsb_release_versionÚmatchÚtupler3Ú_release_versionrDrr.)Ú firstlinerrJr9ÚlrrrÚ_parse_release_file0s      rdr?cCs(ddl}|jdtdd�t|||||ƒS)NrzFdist() and linux_distribution() functions are deprecated in Python 3.5r=)Ú stacklevel)ÚwarningsÚwarnÚPendingDeprecationWarningÚ_linux_distribution)rIrrJÚsupported_distsÚfull_distribution_namerfrrrÚlinux_distributionKs   rlcCsÚytjtƒ}Wntk r(|||fSX|jƒxD|D]0}tj|ƒ}|dk r8|jƒ\}} ||kr8|}Pq8Wt|||ƒSt tj j t|ƒdddd��} | j ƒ} WdQRXt | ƒ\}} } |rÀ|rÀ|}| rÈ| }| rÐ| }|||fS)aæ Tries to determine the name of the Linux OS distribution name. The function first looks for a distribution release file in /etc and then reverts to _dist_try_harder() in case no suitable files are found. supported_dists may be given to define the set of Linux distributions to look for. It defaults to a list of currently supported Linux distributions identified by their release file name. If full_distribution_name is true (default), the full distribution read from the OS is returned. Otherwise the short name taken from supported_dists is used. Returns a tuple (distname, version, id) which default to the args given as parameters. NÚrzutf-8Úsurrogateescape)ÚencodingÚerrors)r*rFÚ _UNIXCONFDIRÚOSErrorrHÚ_release_filenamer_r3rPr,r+ÚjoinÚreadlinerd)rIrrJrjrkZetcÚfiler9Z _distnameZdummyr7rbZ_versionZ_idrrrriUs0      ricCs*ddl}|jdtdd�t||||dd�S)aS Tries to determine the name of the Linux OS distribution name. The function first looks for a distribution release file in /etc and then reverts to _dist_try_harder() in case no suitable files are found. Returns a tuple (distname, version, id) which default to the args given as parameters. rNzFdist() and linux_distribution() functions are deprecated in Python 3.5r=)re)rjrk)rfrgrhri)rIrrJrjrfrrrÚdist‹s  rwrmcCs&ddl}|jdtdd�tj|||ƒS)z! Portable popen() interface. rNzuse os.popen insteadr=)re)rfrgÚDeprecationWarningr*Úpopen)ÚcmdÚmodeÚbufsizerfrrrry sryc Csd|jdƒ}|r|j|ƒytt|ƒ}Wntk r>|}YnXttt|ƒƒ}dj|dd…ƒ}|S)zŒ Normalize the version and build strings and return a single version string using the format major.minor.build (or patchlevel). Ú.Né)rÚappendÚmaprrÚlistÚstrrt)rÚbuildrcZintsZstringsrrrÚ _norm_version©s   r„z'(?:([\w ]+) ([\w.]+) .*\[.* ([\d.]+)\])c Csätj|kr|||fSxddD]R}y&tj|ƒ}|jƒ}|jƒrBtdƒ‚Wn$tk rh}zwWYdd}~XqXPqW|||fS|jƒ}tj |ƒ}|dk rÚ|j ƒ\}}}|d dkrº|dd …}|d dkrÒ|dd …}t |ƒ}|||fS) a+ Tries to figure out the OS version used and returns a tuple (system, release, version). It uses the "ver" shell command for this which is known to exists on Windows, DOS. XXX Others too ? In case this fails, the given parameters are used as defaults. Úverúcommand /c verú cmd /c verzcommand failedNr?r})r…r†r‡rBrBrBrB) ÚsysÚplatformr*ryr-ÚcloserrrDÚ _ver_outputr_r3r„) ÚsystemÚreleaserZsupported_platformsrzÚpipeÚinfoZwhyr9rrrÚ _syscmd_verÇs,           r�éZ2000ZXPr=Z 2003ServerZpost2003éÚVistaÚ7Ú8r~z8.1zpost8.1Z10Zpost10Z 2008ServerZ 2008ServerR2Z 2012ServerZ 2012ServerR2Zpost2012ServerR2c(Csªyddlm}Wntk r,||||fSXyddlm}m}m}m}Wn,tk rvddlm}m}m}m}YnX|ƒ} | j pŽ| dd…\} } } dj | | | ƒ}t j | | fƒpÂt j | dfƒpÂ|}| dd…| | fk�r$ydj | j ƒ}Wn8tk �r"|dd…d k�rd |dd…}YnXt| d dƒdk�rZtj | | fƒ�pXtj | dfƒ�pX|}d} z.y||d ƒ} || d ƒd}Wn YnXWd| �rœ|| ƒX||||fS)Nr)Úgetwindowsversion)Ú OpenKeyExÚ QueryValueExÚCloseKeyÚHKEY_LOCAL_MACHINEr~z {0}.{1}.{2}r=zSP{}é z Service Pack ZSPZ product_typez,SOFTWARE\Microsoft\Windows NT\CurrentVersionZ CurrentType)rˆr–Ú ImportErrorÚwinregr—r˜r™ršÚ_winregZplatform_versionÚformatÚ_WIN32_CLIENT_RELEASESrZservice_pack_majorÚAttributeErrorÚgetattrÚ_WIN32_SERVER_RELEASES)r�rÚcsdÚptyper–r—r˜r™ršZwinverZmajÚminrƒÚkeyrrrÚ win32_versD  r¨cCs‚d}tjj|ƒsdSy ddl}Wntk r4dSXt|dƒ�}|j|ƒ}WdQRX|d}d }tjƒj}|d krxd}|||fS) Nz0/System/Library/CoreServices/SystemVersion.plistrr"ZProductVersionr ÚppcúPower MacintoshZPowerPC)r r r )r©rª) r*r+rCÚplistlibrœr,ÚloadÚunameÚmachine)Úfnr«r7rr�Ú versioninfor®rrrÚ _mac_ver_xmlEs    r±cCstƒ}|dk r|S|||fS)a< Get MacOS version information and return it as tuple (release, versioninfo, machine) with versioninfo being a tuple (version, dev_stage, non_release_version). Entries which cannot be determined are set to the parameter values which default to ''. All tuple entries are strings. N)r±)r�r°r®r�rrrÚmac_ver[s r²c Cs@ddlm}y|j|ƒ}|dkr$|S|Stk r:|SXdS)Nr)ÚSystem)Ú java.langr³Z getPropertyr¡)ÚnameÚdefaultr³rMrrrÚ _java_getpropns  r·c Cs®y ddl}Wntk r(||||fSXtd|ƒ}td|ƒ}|\}}}td|ƒ}td|ƒ}td|ƒ}|||f}|\}} } td| ƒ} td |ƒ}td | ƒ} || | f}||||fS) a] Version interface for Jython. Returns a tuple (release, vendor, vminfo, osinfo) with vminfo being a tuple (vm_name, vm_release, vm_vendor) and osinfo being a tuple (os_name, os_version, os_arch). Values which cannot be determined are set to the defaults given as parameters (which all default to ''). rNz java.vendorz java.versionz java.vm.namezjava.vm.vendorzjava.vm.versionz java.os.archz java.os.namezjava.os.version)r´rœr·) r�ÚvendorÚvminfoÚosinfoÚjavaZvm_nameZ vm_releaseZ vm_vendorÚos_nameÚ os_versionÚos_archrrrÚjava_verys"              r¿c CsÌ|dkrd|||fS|dkr–|dkr0|||fS|jdƒ}|r‚yt|dƒ}Wntk rbYn X|d}t|ƒ|d<dj|ƒ}|dkr�d }qÂd }n,|d kr¶d }|r°|d }qÂd }n |dkrÂd}|||fS)zã Returns (system, release, version) aliased to common marketing names used for some systems. It also does some reordering of the information in some cases where it would otherwise cause confusion. ZRhapsodyzMacOS X ServerZSunOSÚ5r}rr~Ú6ZSolarisZIRIX64ZIRIXz (64bit)Ú64bitrrÚWindows)rr)rrrr‚rt)rŒr�rrcÚmajorrrrÚ system_aliasœs2      rÅcGsÈdjdd„tt|ƒDƒƒ}|jddƒ}|jddƒ}|jddƒ}|jddƒ}|jd dƒ}|jd dƒ}|jd dƒ}|jd dƒ}|jd dƒ}x|jddƒ}||kržP|}qˆWx|ddkrÂ|dd…}q¨W|S)zq Helper to format the platform string in a filename compatible format e.g. "system-version-machine". r>css|]}|jƒVqdS)N)rD)r%Úxrrrú Øsz_platform..ú Ú_ú/ú\ú:ú;ú"ú(ú)Úunknownr z--r?NrBrB)rtÚfilterr.Úreplace)Úargsr‰ZcleanedrrrÚ _platformÒs$          rÕcCsDy ddl}Wntk r |SXy|jƒStk r>|SXdS)z8 Helper to determine the node name of this machine. rN)ÚsocketrœZ gethostnamerr)r¶rÖrrrÚ_nodeòs r×cCsFtjj|ƒ}x4tjj|ƒr@tjjtjjtjj|ƒtj|ƒƒƒ}qW|S)zT In case filepath is a symlink, follow it until a real file is reached. )r*r+ÚabspathÚislinkÚnormpathrtÚdirnameÚreadlink)ÚfilepathrrrÚ_follow_symlinkss  "rÞc Cshtjdkr|Sytjd|tfƒ}Wnttfk r<|SX|jƒjƒ}|j ƒ}| s\|r`|S|SdS)z. Interface to the system's uname command. rrrzuname %s 2> %sN)rrr) rˆr‰r*ryÚDEV_NULLr¡rrr-rDrŠ)Zoptionr¶r7ÚoutputrrrrÚ _syscmd_uname s   rác Cs|tjd kr|St|ƒ}ytjd|gtjtjd�}Wnttfk rJ|SX|j ƒdj dƒ}|j ƒ}| sp|rt|S|SdS) zð Interface to the system's file command. The function uses the -b option of the file command to have it omit the filename in its output. Follow the symlinks. It returns default in case the command should fail. rrrrv)ÚstdoutÚstderrrzlatin-1N)rrr) rˆr‰rÞÚ subprocessÚPopenÚPIPEZSTDOUTr¡rrZ communicater$Úwait)Útargetr¶ÚprocràrrrrÚ _syscmd_files   rêÚ WindowsPErÃÚMSDOS)rrrc Cs.|sLddl}y|jdƒ}Wn |jk r:|jdƒ}YnXt|dƒd}|r\t|dƒ}nd}| r |tjkr tjtkr˜ttj\}}|r�|}|r˜|}||fSd|kr°||fSd |kr¾d }nd |krÌd }n d |krØd}d|kræd}n@d|k�rd|k�rd}nd}n d|k�rd}nd|k�r&d}n||fS)a” Queries the given executable (defaults to the Python interpreter binary) for various architecture information. Returns a tuple (bits, linkage) which contains information about the bit architecture and the linkage format used for the executable. Both values are returned as strings. Values that cannot be determined are returned as given by the parameter presets. If bits is given as '', the sizeof(pointer) (or sizeof(long) on Python version < 1.5.2) is used as indicator for the supported pointer size. The function relies on the system's "file" command to do the actual work. This is available on most if not all Unix platforms. On some non-Unix platforms where the "file" command does not exist and the executable is set to the Python interpreter binary defaults from _default_architecture are used. rNÚPrcéÚbitr r4z32-bitÚ32bitZN32Zn32bitz64-bitrÂZELFZPErÃrëZCOFFzMS-DOSrì) ÚstructZcalcsizeÚerrorr‚rêrˆr4r‰Ú_default_architecture)r4ÚbitsÚlinkagerñÚsizeZfileoutr rcrrrÚ architectureBsL       r÷Ú uname_resultz-system node release version machine processorcCs d}tdk rtSd}ytjƒ\}}}}}Wntk rBd}YnX|sdttd|||||fƒƒ �rž|r€tj}d}d}tƒ}d}d}|dkrät ƒ\}}}} |r¦|r¦d}|sÒdtj krÄtj j ddƒ}ntj j ddƒ}|sätj j d|ƒ}|�r sâe      :2 6    0 0  #6   T       k      [