Ë •¨”_-à‹ãó—dZddlZddlZddlZddlZddlmZmZmZm Z m Z m Z m Z ddl mZmZddlmZddlmZddlmZddlmZmZej2Ze d e«Zerd nd Zd Zed dddd¬«Zej>ej@ejBejDejFfZ$ej@ej>ejBfZ%ee&«Z'dedefd„Z(dede efd„Z)deee effd„Z*Gd„d«Z+y)a Configuration management setup Some terminology: - name As written in config files. - value Value associated with a name - key Name combined with it's section (section.name) - variant A single word describing where the configuration key-value pair came from éN)ÚAnyÚDictÚIterableÚListÚNewTypeÚOptionalÚTuple)ÚConfigurationErrorÚ!ConfigurationFileCouldNotBeLoaded)Úappdirs)ÚWINDOWS)Ú getLogger)Ú ensure_dirÚenumÚKindzpip.inizpip.conf)ÚversionÚhelpÚuserÚglobalÚsiteÚenvzenv-var)ÚUSERÚGLOBALÚSITEÚENVÚENV_VARÚnameÚreturncór—|j«jdd«}|jd«r|dd}|S)zAMake a name consistent regardless of source (environment or file)Ú_Ú-z--éN)ÚlowerÚreplaceÚ startswith)rs ú@/usr/lib/python3.12/site-packages/pip/_internal/configuration.pyÚ_normalize_namer'2s6€à �:‰:‹<× Ñ   SÓ )€DØ ‡��tÔØ�A�BˆxˆØ €KócóP—d|vrd|›d�}t|«‚|jdd«S)NÚ.zVKey does not contain dot separated section and key. Perhaps you wanted to use 'global.z ' instead?é)r Úsplit)rÚ error_messages r&Ú_disassemble_keyr.:s>€Ø �$�ð 1Ø15°°jð Bð ô! Ó/Ð/Ø �:‰:�c˜1Ó Ðr(cód—tjd«D�cgc]&}tjj |t «‘Œ(}}tjj t jt «}tjj tjjd«trdndt «}tjj tjd«t «}tj|tj|gtj||giScc}w)NÚpipÚ~z.pip)r Úsite_config_dirsÚosÚpathÚjoinÚCONFIG_BASENAMEÚsysÚprefixÚ expanduserr Úuser_config_dirÚkindsrrr)r4Úglobal_config_filesÚsite_config_fileÚlegacy_config_fileÚnew_config_files r&Úget_configuration_filesr@DsÚ€ä8?×8PÑ8PÐQVÔ8WóÙ8W°Œ�‰� ‰ �Tœ?Õ+Ð8Wððô—w‘w—|‘|¤C§J¡J´Ó@ÐÜŸ™Ÿ™Ü �‰×ј3Ó݉˜fÜóÐô —g‘g—l‘l¤7×#:Ñ#:¸5Ó#AÄ?ÓS€Oä � ‰ Ð)Ü � ‰ Ð%Ð&Ü � ‰ Ð'¨Ð9ð ðùòs˜+D-có‡—eZdZdZd"dedeeddfˆfd„ Zd#d„Zdee fd„Z de e e e ffd „Zd e de fd „Zd e d e ddfd „Zd e ddfd„Zd#d„Zd#d„Zedee e ffd„«Zd#d„Zdede defd„Zde defd„Zd#d„Zde de e e e fdee e ffd„Zde e e e ffd„Zde e eee ffd„Zdedee e ffd„Z de e effd„Z!de deddfd „Z"de fd!„Z#ˆxZ$S)$Ú ConfigurationaâHandles management of configuration. Provides an interface to accessing and managing configuration files. This class converts provides an API that takes "section.key-name" style keys and stores the value associated with it as "key-name" under the section "section". This allows for a clean interface wherein the both the section and the key-name are preserved in an easy to manage form in the configuration files and the data stored is also nice. NÚisolatedÚ load_onlyrc óR•—t‰|�«|�C|tvr;tdj dj t tt««««‚||_||_ tD�cic]}|g“Œc}|_ tD�cic]}|i“Œc}|_ g|_ ycc}wcc}w)Nz5Got invalid value for load_only - should be one of {}z, )ÚsuperÚ__init__ÚVALID_LOAD_ONLYr Úformatr5ÚmapÚreprrCrDÚOVERRIDE_ORDERÚ_parsersÚ_configÚ_modified_parsers)ÚselfrCrDÚvariantÚ __class__s €r&rGzConfiguration.__init__es´ø€Ü ‰ÑÔà Ð  Y´oÑ%EÜ$ØG×NÑNØ—I‘Iœc¤$¬Ó8Ó9óóð ð !ˆŒ Ø"ˆŒõ(6óH Ù'5˜GˆG�R‰K ~ñH ˆŒ õ(6ó4 Ù'5˜GˆG�R‰K ~ñ4 ˆŒ ðEGˆÕùò H ùò4 s Á+ B B$có^—|j«|js|j«yy)z¡>Ñ2Ñ 2Ü$ ~°h°ZÐ%@ÓAÐ Aà×2Ñ2Ó4‰ ˆˆvà Ð Ü,¨SÓ1‰MˆG�Tà×"Ñ" 7Ô+°×0DÑ0DÀWÈdÔ0Sô)ØJóðð —<‘< Ô(Ø×%Ñ% gÔ.Ø × "Ñ " 5¨&Ô 1à �L‰L˜Ÿ™Ñ (¨Ñ -r(cór—|j«|jD]j\}}tjd|«t t j j|«« t|d«5}|j|«ddd«Œly#1swYŒ xYw#t$r}td|›d|›�«‚d}~wwxYw)z!Save the current in-memory state.z Writing to %sÚwNz:An error occurred while writing to the configuration file z: ) rgrOÚloggerÚinforr3r4ÚdirnameÚopenÚwriteÚOSErrorr )rPrlrmÚfÚerrors r&ÚsavezConfiguration.saveËs¡€à ×#Ñ#Ô%à!×3Ô3‰MˆE�6Ü �K‰K˜¨Ô /ô ”r—w‘w—‘ uÓ-Ô .ð ܘ% Ô%¨Ø—L‘L ”O÷&øñ4÷&Ð%ûäò Ü(ØPØ�g˜R ˜wð(óðûð ús0Á" BÁ.B ÂB B ÂB B6 B1Â1B6cór—|j€ td«‚tjd|j«y)Nz'Needed a specific file to be modifying.z$Will be working with %s variant only)rDr rvÚdebugrVs r&rgz$Configuration._ensure_have_load_onlyãs+€Ø �>‰>Ð !Ü$Ð%NÓOÐ OÜ� ‰ Ð;¸T¿^¹^ÕLr(có\—i}tD] }|j|j|«Œ"|S)z3A dictionary representing the loaded configuration.)rLÚupdaterN)rPÚretvalrQs r&r]zConfiguration._dictionaryès/€ð ˆç%ˆGØ �M‰M˜$Ÿ,™, wÑ/Õ 0ð&ðˆ r(cóº—t|j««}|tjddtj gk(rt jd«y|j«D]q\}}|D]g}|j�'||jk7rt jd||«Œ6|j||«}|j|j||f«ŒiŒsy)z,Loads configuration from configuration filesrr+zZSkipping loading configuration files due to environment's PIP_CONFIG_FILE being os.devnullNz Skipping file '%s' (variant: %s)) ÚdictÚiter_config_filesr;rr3Údevnullrvr€r^rDÚ _load_filerMÚappend)rPÚ config_filesrQÚfilesrlrms r&rTz Configuration._load_config_filesôsÀä˜D×2Ñ2Ó4Ó5ˆ Ø œŸ ™ Ñ " 1 QÐ '¬B¯J©J¨<Ò 7Ü �L‰LðAô ð à*×0Ñ0Ö2‰NˆG�UÛ�ð—>‘>Ð-°'¸T¿^¹^Ò2KÜ—L‘LÐ!CÀUÈGÔTØàŸ™¨°%Ó8�ð— ‘ ˜gÑ&×-Ñ-¨u°f¨oÕ>ññ3r(rQrlcóþ—tjd||«|j|«}|j«D]A}|j |«}|j |j |j||««ŒC|S)Nz'For variant '%s', will try loading '%s')rvÚverboseÚ_construct_parserÚsectionsr^rNr‚Ú_normalized_keys)rPrQrlrmrnr^s r&rˆzConfiguration._load_file sm€Ü�‰Ð@À'È5ÔQØ×'Ñ'¨Ó.ˆà—‘Ö(ˆGØ—L‘L Ó)ˆEØ �L‰L˜Ñ !× (Ñ (¨×)>Ñ)>¸wÈÓ)NÕ Oð)ðˆ r(cóB—tj«}tjj |«r+t j d«} |j||¬«|S|S#t$rtd|›d�|¬«‚tj$r}t|¬«‚d}~wwxYw)NF)Úencodingzcontains invalid z characters)Úreasonrl)r}) Ú configparserÚRawConfigParserr3r4ÚexistsÚlocaleÚgetpreferredencodingÚreadÚUnicodeDecodeErrorr ÚError)rPrlrmÚlocale_encodingr}s r&rŽzConfiguration._construct_parsersŸ€Ü×-Ñ-Ó/ˆô �7‰7�>‰>˜%Ô Ü$×9Ñ9¸%Ó@ˆOð EØ— ‘ ˜E¨O� Ô<ðˆ ˆvˆ øô&ò ä7Ø.¨Ð.?¸{ÐKØôðô ×%Ñ%ò Eä7¸eÔDÐDûð EúsÁ A!Á!,B BÂBcó˜—|jtjj|j d|j «««y)z.Loads configuration from environment variablesz:env:N)rNr;rr‚r�Úget_environ_varsrVs r&rUz$Configuration._load_environment_vars*s6€à � ‰ ”U—]‘]Ñ#×*Ñ*Ø × !Ñ ! '¨4×+@Ñ+@Ó+BÓ Cõ r(rnr^cóJ—i}|D]\}}|dzt|«z}|||<Œ|S)z×Normalizes items to construct a dictionary with normalized keys. This routine is where the names become keys and are made the same regardless of source - configuration files or environment. r*)r')rPrnr^Ú normalizedrÚvalr_s r&r�zConfiguration._normalized_keys0s;€ðˆ Û‰IˆD�#ؘC‘-¤/°$Ó"7Ñ7ˆCØ!ˆJ�sŠOððÐr(c#óÀK—tjj«D]9\}}|jd«sŒ|ddj «}|t vsŒ4||f–—Œ;y­w)z@Returns a generator with all environmental vars with prefix PIP_ÚPIP_éN)r3Úenvironr^r%r#ÚENV_NAMES_IGNORED)rPr_r¡rs r&ržzConfiguration.get_environ_vars>sPèø€äŸ ™ ×(Ñ(Ö*‰HˆC�Ø�~‰~˜fÕ%ؘ1˜2�w—}‘}“�ØÔ0Ò0Ø ˜)“Oñ +ùs‚6A¹AÁ Ac#óK—tjjdd«}t«}tj |tj f–—|j xr$|xrtjj|« }|r%tj|tjf–—tj|tjf–—|�tj|gf–—ytjgf–—y­w)a‘Yields variant and configuration files associated with it. This should be treated like items of a dictionary. The order here doesn't affect what gets overridden. That is controlled by OVERRIDE_ORDER. However this does control the order they are displayed to the user. It's probably most ergononmic to display things in the same order as OVERRIDE_ORDER ÚPIP_CONFIG_FILEN) r3r¥Úgetr@r;rrCr4r–rrr)rPÚenv_config_filerŠÚshould_load_user_configs r&r†zConfiguration.iter_config_filesGsÈèø€ôŸ*™*Ÿ.™.Ð):¸DÓAˆÜ.Ó0ˆ ä�l‰l˜L¬¯©Ñ6Ð6Ò6ð'+§m¡mÐ"3ò# Ø Ò ?¤§¡§¡¨Ó ?ð9 Ðñ #ä—*‘*˜l¬5¯:©:Ñ6Ð6Ò 6ô�j‰j˜,¤u§z¡zÑ2Ð2Ò2à Ð &Ü—)‘)˜oÐ.Ð.Ó .ä—)‘)˜R�-Ó ùs‚Ccó —|j|S)z#Get values present in a config file)rN)rPrQs r&Úget_values_in_configz"Configuration.get_values_in_configgs€à�|‰|˜GÑ$Ð$r(cót—|jsJ‚|j|j}|s td«‚|dS)Nz4Fatal Internal error [id=2]. Please report as a bug.éÿÿÿÿ)rDrMr )rPÚparserss r&rYz#Configuration._get_parser_to_modifyks?€à�~Š~Ј~Ø—-‘- §¡Ñ/ˆÙä$ØFóð ð �r‰{Ðr(rmcó`—||f}||jvr|jj|«yy©N)rOr‰)rPrlrmÚfile_parser_tuples r&rkzConfiguration._mark_as_modifiedys4€Ø" F˜OÐØ  D×$:Ñ$:Ñ :Ø × "Ñ "× )Ñ )Ð*;Õ <ð ;r(cóN—|jj›d|j›d�S)NÚ(Ú))rRÚ__name__r]rVs r&Ú__repr__zConfiguration.__repr__~s'€Ø—.‘.×)Ñ)Ð*¨!¨D×,<Ñ,<Ð+?¸qÐAÐAr(r²)rN)%r·Ú __module__Ú __qualname__Ú__doc__ÚboolrrrGrWÚstrr[rr rr^rdrorsr~rgÚpropertyrr]rTr•rˆrŽrUr�ržrr†r­rYrkr¸Ú __classcell__)rRs@r&rBrBWsÃø„ñ ñG ðG°(¸4±.ðGÈDõGó**ð  (¨3¡-óð(�x  c¨3 h¡Ñ0ó(ð B˜Sð B Só Bð.˜Sð.¨ð.°ó.ð&.˜sð. tó.ó:ó0Mð ð ˜T # s (™^ò óð ó?ð. $ð¨sð°óð sð¨óó* ð Øð Ø#+¨E°#°s°(©OÑ#<ð à ˆc�3ˆh‰ó ð$ (¨5°°c°©?Ñ";ó$ð  8¨E°$¸¸S¹ °/Ñ,BÑ#Có ð@%¨Dð%°T¸#¸s¸(±^ó%ð  u¨S°/Ð-AÑ'Bó ð= sð=°Oð=Èó=ð B˜#÷Br(rB),r»r”r—r3r7Útypingrrrrrrr Úpip._internal.exceptionsr r Úpip._internal.utilsr Úpip._internal.utils.compatr Úpip._internal.utils.loggingrÚpip._internal.utils.miscrrr•r½rr6r¦r;rrrrrrLrHr·rvr'r.r@rB©r(r&ÚrÇsðñ óÛ Û Û ßF×FÑF÷õ(Ý.Ý1ß5à×.Ñ.€Ùˆv�sÓ€á&‘)¨J€Ø%Ðñ Ø Ø Ø Ø Ø ô  €ð—‘˜uŸz™z¨5¯:©:°u·y±yÀ%Ç-Á-ÐO€Ø—*‘*˜eŸl™l¨E¯J©JÐ6€á �8Ó €ð˜#ð #óð˜3ð 4¨¡9óð  d¨D°©I oÑ!6ó÷&hBòhBr(