+
    SBiB                       ^ RI Ht ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RIt^ RIHt ^ RIt^ RIt^ RIHtHtHt ^ RIt^ RIt ! R R]4      t ! R R4      t ! R	 R
4      tR tR tR t]P:                  P=                  R!RR]3RR]3.4      ]P:                  P?                  ]	P@                  R,          R"8H  ;'       d    ]	P@                  PB                  R8g  RR7      R 4       4       t"]P:                  P?                  ]	P@                  R,          R"8H  ;'       d    ]	P@                  PB                  R8g  RR7      R 4       t#]P:                  P=                  RRR.4      R 4       t$R t% ! R R4      t& ! R R 4      t'R# )#    )annotationsN)mock)DistInfoDistributionDistributionEggInfoDistributionc                      ] tR t^tR tRtR# )
EggRemoverc                	    V \         P                  9   d    \         P                  P                  V 4       \        P                  P	                  V 4      '       d   \        P                  ! V 4       R # R # N)syspathremoveosexists)selfs   &K/usr/lib/python3.14/site-packages/pkg_resources/tests/test_pkg_resources.py__call__EggRemover.__call__   sA    388HHOOD!77>>$IIdO       N)__name__
__module____qualname____firstlineno__r   __static_attributes__r   r   r   r	   r	      s    r   r	   c                      ] tR t^ t$ . tR]R&   ]P                  ! R^^^^^ 4      t ]R 4       t	]R 4       t
R tR tRtR	# )
TestZipProviderzlist[EggRemover]
finalizersi  c                   \         P                  ! RRR7      p\        P                  ! VR4      p\        P                  ! 4       pRVn        V P                  P                  4       Vn        VP                  VR4       \        P                  ! 4       pRVn        V P                  P                  4       Vn        VP                  VR4       \        P                  ! 4       pR	Vn        V P                  P                  4       Vn        VP                  VR
4       \        P                  ! 4       pRVn        V P                  P                  4       Vn        VP                  VR4       VP                  4        VP                  4        \        P                  P                  VP                  4       \        P                  P!                  VP                  R4      p\        P                  P                  V4       V P"                  P                  \%        V4      4       V P"                  P                  \%        VP                  4      4       R# )z'create a zip egg and add it to sys.pathz.eggF)suffixdeletewmod.pyzx = 3
data.dathello, world!zsubdir/mod2.pyzx = 6
zsubdir/data2.datzgoodbye, world!subdirN)tempfileNamedTemporaryFilezipfileZipFileZipInfofilenameref_time	timetuple	date_timewritestrcloser   r   appendnamer   joinr   r	   )clseggzip_eggzip_infor&   s   &    r   setup_classTestZipProvider.setup_class&   s    ))F//#s+??$$ \\3359-??$& \\335?3??$, \\3359-??$. \\335#45		!chh1j01j23r   c                	:    V P                    F
  pV! 4        K  	  R # r   )r   )r5   	finalizers   & r   teardown_classTestZipProvider.teardown_classD   s    IK (r   c                	F   ^ RI p\        P                  ! V4      p. R	Op\        VP	                  R4      4      V8X  g   Q hRR.p\        VP	                  R4      4      V8X  g   Q h\        VP	                  R4      4      V8X  g   Q hVP	                  R4      . 8X  g   Q hVP	                  R4      . 8X  g   Q h^ RIp\        P                  ! V4      p\        VP	                  R4      4      V8X  g   Q hVP	                  R4      . 8X  g   Q hVP	                  R4      . 8X  g   Q hR# )
r   Nr&    z	data2.datzmod2.pyzsubdir/nonexistentznonexistent/)r$   r#   r&   )modpkg_resourcesZipProvidersortedresource_listdirmod2)r   rB   zpexpected_rootexpected_subdirrG   zp2s   &      r   test_resource_listdir%TestZipProvider.test_resource_listdirI   s   &&s+8b))"-.-???&	2b))(34GGGb)))45HHH""=1R777"">2b888''-c**2./?BBB##H-333##I."444r   c                   ^ RI p\        P                  ! 4       p\        P                  ! V4      pVP	                  VR4      p\
        P
                  P                  \        P                  ! V4      P                  4      pWPP                  8X  g   Q h\        VRRR7      pVP                  R4       VP                  4        V P                  P                  4       p\        P                  ! WGV34       VP	                  VR4      p\        VRR7      ;_uu_ 4       pVP!                  4       R8X  g   Q h RRR4       VP#                  4        R#   + '       g   i     L"; i)z
If a previous call to get_resource_filename has saved the file, but
the file has been subsequently mutated with different file of the
same size and modification time, it should not be overwritten on a
subsequent call to get_resource_filename.
Nr$   r"   utf-8encodingzhello, world?r%   )rB   rC   ResourceManagerrD   get_resource_filenamedatetimefromtimestampr   statst_mtimer-   openwriter1   	timestamputimereadcleanup_resources)r   rB   managerrH   r,   actualftss   &       r   )test_resource_filename_rewrites_on_change9TestZipProvider.test_resource_filename_rewrites_on_changea   s     	//1&&s+++GZ@""001B1K1KL&&&31	 		]]$$&
8$++GZ@(W--668... .!!# .-s   EE	r   N)r   r   r   r   r   __annotations__rT   r-   classmethodr9   r=   rL   rb   r   r   r   r   r   r       sZ    #%J %  q"b"a8H.4 4:  50$r   r   c                  *    ] tR t^ztR tR t R tRtR# )TestResourceManagerc                	    \         P                  ! 4       pVP                  R 4      p\        \	        V4      4      pRV,           p\        V\        4      '       g   Q V4       hR# )fooz%Unexpected type from get_cache_path: N)rC   rR   get_cache_pathstrtype
isinstance)r   mgrr   type_messages   &    r   test_get_cache_path'TestResourceManager.test_get_cache_path{   sO    ++-!!%(DJ9EA$$$-g-$r   c                	  a \         P                  3V3R  llo. Sn        \         P                  ! 4       pVP	                  \        V4      4       \        P                  P                  R4      p\        P                  P                  \         RSR7      ;_uu_ 4        VP                  V4       RRR4       SP                  p\        V4      ^8X  g   Q hV^ ,          P                  \        P                  4      RR RR.8X  g   Q hV^,          P                  \        P                  4      RR R.8X  g   Q hR#   + '       g   i     L; i)	c                   < SP                   P                  V 4       V! V 4      pV'       g   \        P                  ! V 4       V# r   )dirnamesr2   r   makedirs)dirnameunpatched_isdirwas_dirpatched_isdirs   && r   rz   CTestResourceManager.test_get_cache_path_race.<locals>.patched_isdir   s5    ""))'2%g.GG$Nr   ri   barisdir)newN)ri   r|   baz)rC   r}   ru   rR   set_extraction_pathrk   r   sepr4   r   patchobjectrj   lensplit)r   tmpdirrn   archive_namecalled_dirnamesrz   s   &&   @r   test_get_cache_path_race,TestResourceManager.test_get_cache_path_race   s   3@3F3F 	 "$ ++-F,vv{{#89ZZ}g=II|, J (00?#q(((q!''/4FFFq!''/4??? JIs   D99E		c                z    Rp\         P                  RRP                  V4      .p\        P                  ! V4       R# )zx
In a separate Python environment, import pkg_resources and assert
that action doesn't cause setuptools to be imported.
z-cz; N)zimport pkg_resourcesz
import syszAassert "setuptools" not in sys.modules, "setuptools was imported")r   
executabler4   
subprocess
check_call)r   linescmds   &  r   test_setuptools_not_imported0TestResourceManager.test_setuptools_not_imported   s2    


 ~~tTYYu%56c"r   r   N)r   r   r   r   rq   r   r   r   r   r   r   rg   rg   z   s    .@8#r   rg   c                8   \         P                  P                  V 4      p\         P                  ! V4       \	        V R4      ;_uu_ 4       pVP                  V4       RRR4       \        \        P                  ! V4      4      pVw  pV#   + '       g   i     L5; i)aj  
Make a test Distribution object, and return it.

:param metadata_path: the path to the metadata file that should be
    created. This should be inside a distribution directory that should
    also be created. For example, an argument value might end with
    "<project>.dist-info/METADATA".
:param metadata: the desired contents of the metadata file, as bytes.
wbN)	r   r   rw   mkdirrX   rY   listrC   distributions_from_metadata)metadata_pathmetadatadist_dirr`   distsdists   &&    r   make_test_distributionr      sl     ww}-HHHX	mT	"	"a	 
#::8DEEGTK 
#	"s   
B		B	c                   Rp\         P                  P                  \        V 4      RV4      pRP	                  R4      p\        W#R7      p\        P                  ! \        4      ;_uu_ 4       pVP                  V4       RRR4       XP                  p\        V4      pRpW9   g   Q RV 24       hVP                  V4      '       g   Q RV 24       hR#   + '       g   i     L\; i)	zA
Test a metadata file with bytes that can't be decoded as utf-8.
METADATAzfoo.dist-infou   néez
iso-8859-1)r   Nz`codec can't decode byte 0xe9 in position 1: invalid continuation byte in METADATA file at path: zactual: )r   r   r4   rk   encoder   pytestraisesUnicodeDecodeErrorget_metadatavalueendswith)	r   r,   r   r   r   excinfoexcr_   expecteds	   &        r   test_get_metadata__bad_utf8r      s     HGGLLVoxHM}}\*H!-CD	)	*	*g(# 
+ --CXF	?  2&22??=))>XfX+>>) 
+	*s   ,CC"	c                    W,          pVP                  4        VP                  R4      P                  4        \        \        P
                  ! V4      4      p\        V4      ^8X  g   Q hVw  pWB3# )zF
Create a distribution directory with no file containing the version.
ztemp.txt)
ensure_dirr4   ensurer   rC   r   r   )r   basenamer   r   r   s   &&   r   make_distribution_no_versionr      sc      H MM*$$&::8DEEu:??GT>r   zegg-infozPKG-INFOz	dist-infor   :N   Nfinalz/https://github.com/python/cpython/issues/103632reasonc                   RV 2p\        W4      w  rVRV R2p\        P                  P                  Wb4      p\        P
                  ! \        4      ;_uu_ 4       p	VP                   RRR4       \        X	P                  4      p
Wz9   g   Q \        Wz34      4       hV	P                  P                  w  rW{9   g   Q hW9   g   Q \        W34      4       h\        V4      VJ g   Q hR#   + '       g   i     L; i)zA
Test Distribution.version when the "Version" header is missing.
zfoo.z!Missing 'Version:' header and/or z file at path: N)r   r   r   r4   r   r   
ValueErrorversionrk   r   argsrl   )r   r    expected_filenameexpected_dist_typer   r   r   expected_textr   r   errmsgs   &&&&        r   !test_distribution_version_missingr      s    " fXH1&CND ,,=+>oN  GGLL=M 
z	"	"g 
# gmm
C :m%9!:: ""IC:m%9!:::++++ 
#	"s   C%%C5	c                     \        R4      p \        P                  ! \        4      ;_uu_ 4       pV P                   RRR4       XP
                  P                  w  r RpW#8X  g   Q hR#   + '       g   i     L4; i)z`
Test Distribution.version when the "Version" header is missing and
the path can't be detected.
z/fooNzJMissing 'Version:' header and/or PKG-INFO file at path: [could not detect])r   r   r   r   r   r   r   )r   r   r   r   s       r   1test_distribution_version_missing_undetected_pathr     s[     D	z	"	"g 
# ""ICT  ?? 
#	"s   A''A7	onlyFTc                    V R,          pVP                  4        \        P                  ! \        V 4      \        V4      V4      '       d   Q hR# )z5Test path containing a file with dist-info extension.zfoobar.dist-infoN)touchrC   dist_factoryrk   )tmp_pathr   	dist_infos   && r   test_dist_info_is_not_dirr   /  s?     --IOO))#h-YNNNNNr   c                  aa \         P                  oV P                  R\        P                  ! RR7      4       \        SR,          R4      ;_uu_ 4       p\
        P                  ! RR/V4       RRR4       V P                  R\        P                  ! R	R7      4       VV3R
 lp\        P                  ! R\        P                  ! VR7      4      ;_uu_ 4       p\        P                  P                  4        \        P                  ! 4       RR.8X  g   Q h\        P                  P                  4        RRR4       XP                  4        R#   + '       g   i     L; i  + '       g   i     L5; i)z-Regression test for pkg_resources._macos_verszplatform.mac_ver)return_value
fake.plistr   ProductVersionz11.4Nzos.path.existsTc                *   < S! SR ,          .VO5/ VB # )r   r   )filer   kwargs	orig_openr   s   &*,r   	fake_open+test_macos_vers_fallback.<locals>.fake_openE  s    L0B4B6BBr   zbuiltins.open)side_effect114)r@   r   r@   )builtinsrX   setattrr   Mockplistlibdumpr   rC   _macos_verscache_clearassert_called)monkeypatchr   	fake_filer   mr   s   &f   @r   test_macos_vers_fallbackr   7  s    I *DII<,PQ 
h%t	,	,	'0)< 
- ($))*FGC 
OTYY9%E	F	F!!!--/((*tSk999!!--/ 
G
 OO 
-	, 
G	Fs   EAE!E	!E1	c                  4   ] tR tRt]P
                  R 4       tR tR t]P                  P                  R. RO4      R 4       t]P                  P                  ]P                  P                  R4      ]P                  P                  R4      8g  RR	7      ]P                  P                  RR.4      R
 4       4       t]P                  P                  ]P                  P"                  R8g  RR	7      ]P                  P                  R. RO4      R 4       4       tRtR# )TestDeepVersionLookupDistutilsiQ  c                "  a  ! R R\         4      pV! S4      pSP                  \        P                  4       Rp\	        V3R lV 4       4      Vn        \        \        \        P                  VP
                  P                  4       4      4       V# )zY
Create a package environment, similar to a virtualenv,
in which packages are installed.
c                      ] tR tRtRtR# )7TestDeepVersionLookupDistutils.env.<locals>.EnvironmentiY  r   N)r   r   r   r   r   r   r   r   Environmentr   Y  s    r   r   c              3  J   <"   T F  q\        SV,          4      3x  K  	  R # 5ir   )rk   ).0rw   r   s   & r   	<genexpr>5TestDeepVersionLookupDistutils.env.<locals>.<genexpr>_  s     Ng3v'7#89s    #)homelibscriptsdatazegg-base)rk   chmodrV   S_IRWXUdictpathsr   mapr   r   values)r   r   r   envsubss   &f   r   r   "TestDeepVersionLookupDistutils.envR  sg    	# 	 &!T\\";NNN	S399++-./
r   c                D   Rp\        RW#R7      p\        P                  P                  V4      p\        P                  P
                  P                  V4      pVP                  4        VP                  R,          Vn        VP                  4        VP                  4        R# )zR
Create a foo package installed (distutils-style) to env.paths['lib']
as version.
u&   This package has unicode metadata! ❄ri   )r3   r   long_descriptionr   N)r   	distutilsr   r   commandinstall_egg_infoinitialize_optionsr   install_dirfinalize_optionsrun)r   r   r   ldattrsr   iei_cmds   &&&    r   create_foo_pkg-TestDeepVersionLookupDistutils.create_foo_pkgc  sw    
 6%F~~**51##44EEdK""$!ii.  "r   c                	    R pV P                  W4       \        P                  P                  R4      p\        P                  ! VP
                  R,          .4      P                  V4      pVP                  V8X  g   Q hR# )z1.11.0.dev0+2329eaezfoo>=1.9r   N)r  rC   Requirementparse
WorkingSetr   findr   )r   r   r   reqr   s   &&   r   #test_version_resolved_from_egg_infoBTestDeepVersionLookupDistutils.test_version_resolved_from_egg_infoq  sf    'C) ''--j9''5)9(:;@@E||w&&&r   c                n    \         P                  ! V4      p\         P                  ! V4      pW48X  g   Q hR# )zUEnsure the trailing slash is cleaned for path comparison.

See pypa/setuptools#1519.
NrC   normalize_pathr   unnormalized
normalizedresult_from_unnormalizedresult_from_normalizeds   &&&  r    test_normalize_path_trailing_sep?TestDeepVersionLookupDistutils.test_normalize_path_trailing_sep{  s2     $1#?#?#M !.!=!=j!I'AAAr   Aaz%Testing case-insensitive filesystems.r   c                n    \         P                  ! V4      p\         P                  ! V4      pW48X  g   Q hR# )z@Ensure mixed case is normalized on case-insensitive filesystems.Nr  r  s   &&&  r   test_normalize_path_normcase;TestDeepVersionLookupDistutils.test_normalize_path_normcase  s2     $1#?#?#M !.!=!=j!I'AAAr   \z5Testing systems using backslashes as path separators.c                d    \         P                  ! V4      pVP                  V4      '       g   Q hR# )z;Ensure path seps are cleaned on backslash path sep systems.N)rC   r  r   )r   r  r   results   &&& r   !test_normalize_path_backslash_sep@TestDeepVersionLookupDistutils.test_normalize_path_backslash_sep  s)     --l;x((((r   r   N)r  r  ))ri   ri   )zfoo/ri   )foo/barr#  )zfoo/bar/r#  )z
MiXeD/CasEz
mixed/case)r  r   ))zforward/slashforward\slash)zforward/slash/r$  )zbackward\slash\zbackward\slash)r   r   r   r   r   fixturer   r  r  markparametrizer  skipifr   r   normcaser  r   r!  r   r   r   r   r   r   Q  s"   ^^  ' [[&	
BB [[
!1!1#!666   [[&(	
B	B [[
tF   [[$	
)	)r   r   c                  x    ] tR tRtR tRRRRRRR	R
/t]P                  P                  R. RO4      R 4       t	Rt
R# )TestWorkdirRequirei  c                	n   VR ,          pVP                  4        V P                  P                  4        FQ  w  rVWE,          pVP                  P                  RRR7       VP	                  \
        P                  ! V4      RR7       KS  	  VP                  \        RV.4       \        P                  ! V4      # )zsite-packagesT)exist_okparentsrO   rP   r   )r   FILESitemsparent
write_textinspectcleandocr   r   r   fspath)r   r   r   
dist_filessite_packagesr   contentr   s   &&&&    r   fake_site_packages%TestWorkdirRequire.fake_site_packages  s     ?2!ZZ--/MD 'DKKtT:OOG,,W5OH 0
 	C-9yy''r   z!pkg1_mod-1.2.3.dist-info/METADATAze
            Metadata-Version: 2.4
            Name: pkg1.mod
            Version: 1.2.3
            z pkg2.mod-0.42.dist-info/METADATAzd
            Metadata-Version: 2.1
            Name: pkg2.mod
            Version: 0.42
            zpkg3_mod.egg-info/PKG-INFOzE
            Name: pkg3.mod
            Version: 1.2.3.4
            zpkg4.mod.egg-info/PKG-INFOzD
            Name: pkg4.mod
            Version: 0.42.1
            c                	   V P                  WV P                  4      p\        P                  ! V.4      pWDP	                  R R4      3 Fz  pVP                  V4      w  pVP                  V8X  g   Q h\        P                  P                  \        P                  P                  VP                  V.4      V4      '       d   Kz  Q h	  R# ).-N)r9  r/  rC   r
  replacerequirer   r   r   samefile
commonpathlocation)	r   r   r   r   requirementr7  wsr  r   s	   &&&&&    r    test_require_non_normalised_name3TestWorkdirRequire.test_require_non_normalised_name  s     //tzzR%%}o6!4!4S#!>?CZZ_FT<<7***77##""DMM=#ABM    @r   r   N)r   rC  ))z1.2.3zpkg1.mod>=1)z0.42zpkg2.mod>=0.4)z1.2.3.4zpkg3.mod<=2)z0.42.1zpkg4.mod>0.2,<1)r   r   r   r   r9  r/  r   r&  r'  rE  r   r   r   r   r+  r+    sa    	( 	, .
 	+ -
 	% ' 	% 'E* [["	
r   r+  )r    r   r   )      )(
__future__r   r   rT   r3  r   r   rV   r   r   r'   r)   unittestr   r   rC   r   r   r   "distutils.command.install_egg_infor   distutils.distrk   r	   r   rg   r   r   r   r&  r'  xfailversion_inforeleaselevelr   r   r   r   r   r+  r   r   r   <module>rP     s   "    	    
      Q Q )  W$ W$t3# 3#l(?4" 9	Z!45	j"67 RG#PP(8(8(E(E(P<  ,	,> RG#PP(8(8(E(E(P<  	$ %/O 0O4[) [)|6 6r   