Repository URL to install this package:
|
Version:
0.1.31-1 ▾
|
odigos-demo-inventory
/
opt
/
odigos-demo-inventory
/
site-packages
/
installer
/
__pycache__
/
utils.cpython-311.pyc
|
|---|
§
hµµh0 ã
ó" d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl m
Z
ddlmZ ddl
mZ ddlmZ ddlmZ ddlmZmZmZmZmZmZmZmZmZmZ dd lmZ erdd
l m!Z!m"Z" ede#¦ « Z$ee$df Z%g d
¢Z&ej' dk Z(e(rdndZ) ej* dej+ ej, z ¦ « Z- e
dg d¢¦ « Z. ej* dej+ ej, z ¦ « Z/ ee%d¦ « Z0de#defdZ1de#de#fdZ2de#de.fdZ3dedede#dee#e4f fd Z5d1d"Z6ej7 d#ed$e#dee fd%¦ « Z8d& fd'eee$ef d(ee$gee# f defd)Z9d*e#deee#e#e#d+f fd,Z:de4fd-Z;d.ee#d/f ddfd0Z<dS )2z=Utilities related to handling / interacting with wheel files.é N)Ú
namedtuple)ÚConfigParser)ÚMessage)Ú
FeedParser)Úcompat32)
Ú
TYPE_CHECKINGÚBinaryIOÚCallableÚIterableÚIteratorÚNewTypeÚOptionalÚTupleÚUnionÚcast)ÚRecordEntry)ÚLauncherKindÚ
ScriptSectionÚScheme.)
Úparse_metadata_fileÚparse_wheel_filenameÚcopyfileobj_with_hashingÚget_launcher_kindÚfix_shebangÚconstruct_record_fileÚparse_entrypointsÚmake_file_executableÚ
WheelFilenameÚSCHEME_NAMESÚnti i z
^
(?P<distribution>.+?)
-(?P<version>.*?)
(?:-(?P<build_tag>\d[^-]*?))?
-(?P<tag>.+?-.+?-.+?)
\.whl
$
r )ÚdistributionÚversionÚ build_tagÚtagzZ
(?P<module>[\w.]+)\s*
(:\s*(?P<attrs>[\w.]+))\s*
(?P<extras>\[.*\])?\s*$
)ÚpurelibÚplatlibÚheadersÚscriptsÚdataÚcontentsÚreturnc ó~ t t ¬¦ « }| | ¦ « | ¦ « S )zìParse :pep:`376` ``PKG-INFO``-style metadata files.
``METADATA`` and ``WHEEL`` files (as per :pep:`427`) use the same syntax
and can also be parsed using this function.
:param contents: The entire contents of the file
)Úpolicy)r r ÚfeedÚclose)r* Úfeed_parsers ú:/usr/local/lib/python3.11/site-packages/installer/utils.pyr r U s: õ ¥HÐ-Ñ-Ô-KØ×ÒXÑÔÐØ×ÒÑÔÐó Únamec óR t j dd| ¦ « ¦ « S )ziCanonicalize a project name according to PEP-503.
:param name: The project name to canonicalize
z[-_.]+ú-)ÚreÚsubÚlower)r3 s r1 Úcanonicalize_namer9 b s$ õ
6)S $Ñ'Ô'×-Ò-Ñ/Ô/Ð/r2 Úfilenamec ó t | ¦ « }|st d| ¦ « t | ¦ « S )zfParse a wheel filename, into it's various components.
:param filename: The filename to parse
zNot a valid wheel filename: )Ú_WHEEL_FILENAME_REGEXÚmatchÚ
ValueErrorr Úgroups)r: Ú
wheel_infos r1 r r j sN õ
'×,Ò,¨XÑ6Ô6JØð DÝÐB¸ÐBÐBÑCÔCÐCÝ*×+Ò+Ñ-Ô-Ð.Ð.r2 ÚsourceÚdestÚhash_algorithmc ó t j |¦ « }d} | t ¦ « }|sn=| |¦ « | |¦ « |t
|¦ « z
}Zt j | ¦ « ¦ «
d¦ « d¦ « |fS )a Copy a buffer while computing the content's hash and size.
Copies the source buffer into the destination buffer while computing the
hash of the contents. Adapted from :any:`shutil.copyfileobj`.
:param source: buffer holding the source data
:param dest: destination buffer
:param hash_algorithm: hashing algorithm
:return: size, hash digest of the contents
r TÚasciiú=)ÚhashlibÚnewÚreadÚ
_COPY_BUFSIZEÚupdateÚwriteÚlenÚbase64Úurlsafe_b64encodeÚdigestÚdecodeÚrstrip)rA rB rC ÚhasherÚsizeÚbufs r1 r r u s¬ õ [Ñ
(Ô
(FØDðØkk-Ñ(Ô(Øð ØØ
cÑÔÐØ
3ØCÑð
õ Ô# F§M¢M¡O¤OÑ4Ô4×;Ò;¸GÑDÔD×KÒKÈCÑPÔPÐRVÐVÐVr2 r c ó4 t j dk rdS dt j ¦ « v rdS dt j ¦ « v rdS dt j ¦ « v rdS t j d k rd
S t
d¦ « )z.Get the launcher kind for the current machine.r ÚposixÚamd64z win-amd64z(arm64)z win-arm64z(arm)zwin-armÚwin32zwin-ia32z&Unknown launcher kind for this machine)Úosr3 Úsysr" r8 ÚplatformÚNotImplementedError© r2 r1 r r s å w$Øwà#+×#Ò#Ñ%Ô%Ð%Ð%Ø{ØCK×%Ò%Ñ'Ô'Ð'Ð'Ø{Ø#+×#Ò#Ñ%Ô%Ð%Ð%ØyÝ
|wÒÐØzå
ÐFÑ
GÔ
GÐGr2 ÚstreamÚinterpreterc # ó, K | d¦ « | d¦ « dk rÊt j ¦ « }| d| d ¦ « ¦ « | d¦ « | ¦ « | t ¦ « }|sn| |¦ « 3| d¦ « |V | ¦ « dS | d¦ « | V dS )a Replace ``#!python`` shebang in a stream with the correct interpreter.
:param stream: stream to modify
:param interpreter: "correct interpreter" to substitute the shebang with
:returns: A context manager, that provides an appropriately modified stream.
r é s #!pythonz#!ú
TN) ÚseekrI ÚioÚBytesIOrL ÚencodeÚreadlinerJ r/ )r_ r` Ú
new_streamrU s r1 r r £ s è è ð KKNNNØ
{{1~~Ò$Ð$ÝZ\\
à×ÒÐ-kÐ-Ð-Ð-×4Ò4Ñ6Ô6Ñ7Ô7Ð7àAØÑÔÐð "Ø++mÑ,Ô,CØð
ØØ×ÒSÑ!Ô!Ð!ð "ð
ÑÔÐØÐÐÐØ×ÒÑÔÐÐÐàAØr2 c ó d S )Nr^ )Ú_s r1 ú<lambda>rl à s ÀT r2 ÚrecordsÚprefix_for_schemec óH t j t j ¦ « ddd¬¦ « }t j |ddd¬¦ « }| D ]6\ }}| | ||¦ « ¦ « ¦ « 7| d ¦ « | ¦ « S )
a? Construct a RECORD file.
:param records:
``records`` as passed into :any:`WheelDestination.finalize_installation`
:param prefix_for_scheme:
function to get a prefix to add for RECORD entries, within a scheme
:return: A stream that can be written to file. Must be closed by the caller.
zutf-8TÚ )ÚencodingÚ
write_throughÚnewlineú,ú"rc )Ú delimiterÚ quotecharÚlineterminatorr ) re Ú
TextIOWrapperrf ÚcsvÚwriterÚwriterowÚto_rowrd Údetach)rm rn r_ r{ ÚschemeÚrecords r1 r r Á s£ õ Ô
Ý
w°dÀBðñ ô Fõ Z¨#¸ÈTÐ
RÑ
RÔ
RFØ!ð Bð BØ
Ð&7Ð&7¸Ñ&?Ô&?Ñ@Ô@ÑAÔAÐAÐAØ
KKNNNØ==??Ðr2 Útextr c
# óX K t d¬¦ « }t |_ | | ¦ « | ¦ « D ]á}|dvr| |¦ « D ]Ä\ }}t
|t ¦ « sJ t |¦ « }|sJ | d¦ « }t
|t ¦ « sJ | d¦ « }|J t
|t ¦ « sJ t d|dt d¦ «
¦ « }||||fV ŌâdS ) zÀParse ``entry_points.txt``-style files.
:param text: entire contents of the file
:return:
name of the script, module to use, attribute to call, kind of script (cli / gui)
rF )Ú
delimiters)Úconsole_scriptsÚgui_scriptsÚmoduleÚattrsNr Ú_scripts)r ÚstrÚoptionxformÚread_stringÚsectionsÚitemsÚ
isinstanceÚ_ENTRYPOINT_REGEXr= Úgroupr rM ) r ÚconfigÚsectionr3 Úvaluer= r r Úscript_sections r1 r r Ø sQ è è õ SÐ
)Ñ
)Ô
)FÝFÔØ
×ÒtÑÔÐà??Ñ$Ô$ð 6ð 6ØÐ<Ð<Ð<Øà!<<¨Ñ0Ô0ð 6ð 6KD%Ýd¥CÑ(Ô(Ð(Ð(Ð(Ý%×+Ò+¨EÑ2Ô2EØLL5à[[ Ñ*Ô*FÝf¥cÑ*Ô*Ð*Ð*Ð*àKK Ñ(Ô(EàÐ$Ð$Ð$Ýe¥SÑ)Ô)Ð)Ð)Ð)å! /°7Ð;M½cÀ*¹o¼oÐ=MÐ;MÔ3NÑOÔONà ~Ð5Ð5Ð5Ð5Ð5ð 6ð 6ð 6r2 c óV t j d¦ « } t j | ¦ « | S )zBGet the current umask which involves having to set it temporarily.r )rZ Úumask)Úmasks r1 Ú_current_umaskr ú s! å
8A;;DÝHTNNNØKr2 Úpathzos.PathLike[str]c óV t j | dt ¦ « z dz ¦ « dS )z.Make the file at the provided path executable.iÿ éI N)rZ Úchmodr )r s r1 r r s- åHTE^Ñ-Ô-Ð-Ñ-°Ñ5Ñ7Ô7Ð7Ð7Ð7r2 )r+ r )=Ú__doc__rN Ú
contextlibrz rG re rZ r6 r[ Úcollectionsr Úconfigparserr Ú
email.messager Úemail.parserr Úemail.policyr Útypingr r r
r r r
r r r r Úinstaller.recordsr Úinstaller.scriptsr r r r Ú
AllSchemesÚ__all__r3 Ú_WINDOWSrJ ÚcompileÚVERBOSEÚUNICODEr<