
    n&phB                       S SK Jr  S SKrS SKrS SKrS SKrS SKrS SKrS SKrS SK	r	S SK
r
S SKrS SKJr  S SKrS SKrS SKJrJrJr  S SKrS SKr " S S\5      r " S S5      r " S	 S
5      rS rS rS r\R:                  R=                  SSS\4SS\4/5      \R:                  R?                  \	R@                  SS S:H  =(       a    \	R@                  RB                  S:g  SS9S 5       5       r"\R:                  R?                  \	R@                  SS S:H  =(       a    \	R@                  RB                  S:g  SS9S 5       r#\R:                  R=                  SSS/5      S 5       r$S r% " S S 5      r& " S! S"5      r'g)#    )annotationsN)mock)DistInfoDistributionDistributionEggInfoDistributionc                      \ rS rSrS rSrg)
EggRemover   c                    U [         R                  ;   a  [         R                  R                  U 5        [        R                  R	                  U 5      (       a  [        R                  " U 5        g g N)syspathremoveosexists)selfs    Y/var/www/html/venv/lib/python3.13/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                      \ rS rSr% / rS\S'   \R                  " SSSSSS	5      r \S
 5       r	\S 5       r
S rS rSrg)TestZipProvider    zlist[EggRemover]
finalizersi              r   c                   [         R                  " SSS9n[        R                  " US5      n[        R                  " 5       nSUl        U R                  R                  5       Ul        UR                  US5        [        R                  " 5       nSUl        U R                  R                  5       Ul        UR                  US5        [        R                  " 5       nS	Ul        U R                  R                  5       Ul        UR                  US
5        [        R                  " 5       nSUl        U R                  R                  5       Ul        UR                  US5        UR                  5         UR                  5         [        R                  R                  UR                  5        [        R                  R!                  UR                  S5      n[        R                  R                  U5        U R"                  R                  [%        U5      5        U R"                  R                  [%        UR                  5      5        g)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                8    U R                    H
  nU" 5         M     g r   )r    )r;   	finalizers     r   teardown_classTestZipProvider.teardown_classD   s    IK (r   c                4   SS K n[        R                  " U5      n/ SQn[        UR	                  S5      5      U:X  d   eSS/n[        UR	                  S5      5      U:X  d   e[        UR	                  S5      5      U:X  d   eUR	                  S5      / :X  d   eUR	                  S	5      / :X  d   eSS Kn[        R                  " U5      n[        UR	                  S5      5      U:X  d   eUR	                  S5      / :X  d   eUR	                  S5      / :X  d   eg )
Nr   )r*   r)   r,    z	data2.datzmod2.pyr,   zsubdir/nonexistentznonexistent/)modpkg_resourcesZipProvidersortedresource_listdirmod2)r   rH   zpexpected_rootexpected_subdirrM   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                   SSK n[        R                  " 5       n[        R                  " U5      nUR	                  US5      n[
        R
                  R                  [        R                  " U5      R                  5      nXPR                  :X  d   e[        USSS9nUR                  S5        UR                  5         U R                  R                  5       n[        R                  " XGU45        UR	                  US5      n[        USS9 nUR!                  5       S:X  d   e SSS5        UR#                  5         g! , (       d  f       N= f)	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.
r   Nr*   r(   utf-8encodingzhello, world?r+   )rH   rI   ResourceManagerrJ   get_resource_filenamedatetimefromtimestampr   statst_mtimer3   openwriter7   	timestamputimereadcleanup_resources)r   rH   managerrN   r2   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   
D;;
E	r   N)r   r   r   r   r    __annotations__rZ   r3   classmethodr?   rC   rR   rh   r   r   r   r   r   r       sZ    #%J %  q"b"a8H.4 4:  50$r   r   c                  (    \ rS rSrS rS r S rSrg)TestResourceManagerz   c                    [         R                  " 5       nUR                  S5      n[        [	        U5      5      nSU-   n[        U[        5      (       d   U5       eg )Nfooz%Unexpected type from get_cache_path: )rI   rX   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                f  ^ [         R                  4U4S jjm/ Tl        [         R                  " 5       nUR	                  [        U5      5        [        R                  R                  S5      n[        R                  R                  [         STS9   UR                  U5        S S S 5        TR                  n[        U5      S:X  d   eUS   R                  [        R                  5      SS  SS	/:X  d   eUS
   R                  [        R                  5      SS  S/:X  d   eg ! , (       d  f       N= f)Nc                   > TR                   R                  U 5        U" U 5      nU(       d  [        R                  " U 5        U$ r   )dirnamesr8   r   makedirs)dirnameunpatched_isdirwas_dirpatched_isdirs      r   r   CTestResourceManager.test_get_cache_path_race.<locals>.patched_isdir   s5    ""))'2%g.GG$Nr   )rp   barbazisdir)new   r   rp   r      )rI   r   r|   rX   set_extraction_pathrr   r   sepr:   r   patchobjectrq   lensplit)r   tmpdirru   archive_namecalled_dirnamesr   s        @r   test_get_cache_path_race,TestResourceManager.test_get_cache_path_race   s    3@3F3F 	 "$ ++-F,vv{{#89ZZ}g=I|, J (00?#q(((q!''/4FFFq!''/4??? JIs   D""
D0c                x    Sn[         R                  SSR                  U5      /n[        R                  " U5        g)zx
In a separate Python environment, import pkg_resources and assert
that action doesn't cause setuptools to be imported.
)zimport pkg_resourcesz
import syszAassert "setuptools" not in sys.modules, "setuptools was imported"z-cz; N)r   
executabler:   
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   rx   r   r   r   r   r   r   rm   rm   z   s    .@8#r   rm   c                $   [         R                  R                  U 5      n[         R                  " U5        [	        U S5       nUR                  U5        SSS5        [        [        R                  " U5      5      nUu  nU$ ! , (       d  f       N3= f)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   r~   mkdirr^   r_   listrI   distributions_from_metadata)metadata_pathmetadatadist_dirrf   distsdists         r   make_test_distributionr      si     ww}-HHHX	mT	"a	 
#::8DEEGTK 
#	"s   B
Bc                   Sn[         R                  R                  [        U 5      SU5      nSR	                  S5      n[        X#S9n[        R                  " [        5       nUR                  U5        SSS5        WR                  n[        U5      nSnX;   d
   SU 35       eUR                  U5      (       d
   SU 35       eg! , (       d  f       NW= f)	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   r:   rr   encoder   pytestraisesUnicodeDecodeErrorget_metadatavalueendswith)	r   r2   r   r   r   excinfoexcre   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                    X-  nUR                  5         UR                  S5      R                  5         [        [        R
                  " U5      5      n[        U5      S:X  d   eUu  nXB4$ )zF
Create a distribution directory with no file containing the version.
ztemp.txtr   )
ensure_dirr:   ensurer   rI   r   r   )r   basenamer   r   r   s        r   make_distribution_no_versionr      sc      H MM*$$&::8DEEu:??GT>r   )r&   expected_filenameexpected_dist_typezegg-infozPKG-INFOz	dist-infor   r   )   r"   finalz/https://github.com/python/cpython/issues/103632reasonc                   SU 3n[        X5      u  pVSU S3n[        R                  R                  Xb5      n[        R
                  " [        5       n	UR                    SSS5        [        W	R                  5      n
Xz;   d   [        Xz45      5       eU	R                  R                  u  pX{;   d   eX;   d   [        X45      5       e[        U5      UL d   eg! , (       d  f       N= f)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   r:   r   r   
ValueErrorversionrr   r   argsrs   )r   r&   r   r   r   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
C&c                     [        S5      n [        R                  " [        5       nU R                    SSS5        WR
                  R                  u  p SnX#:X  d   eg! , (       d  f       N0= f)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     sX     D	z	"g 
# ""ICT  ?? 
#	"s   A
A+onlyFTc                    U S-  nUR                  5         [        R                  " [        U 5      [        U5      U5      (       a   eg)z5Test path containing a file with dist-info extension.zfoobar.dist-infoN)touchrI   dist_factoryrr   )tmp_pathr   	dist_infos      r   test_dist_info_is_not_dirr   /  s?     --IOO))#h-YNNNNNr   c                  ^^ [         R                  mU R                  S[        R                  " SS95        [        TS-  S5       n[
        R                  " SS0U5        SSS5        U R                  S	[        R                  " S
S95        UU4S jn[        R                  " S[        R                  " US95       n[        R                  R                  5         [        R                  " 5       SS/:X  d   e[        R                  R                  5         SSS5        WR                  5         g! , (       d  f       N= f! , (       d  f       N0= f)z-Regression test for pkg_resources._macos_verszplatform.mac_ver)rF   r   rF   )return_value
fake.plistr   ProductVersionz11.4Nzos.path.existsTc                "   > T" TS-  /UQ70 UD6$ )Nr   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)builtinsr^   setattrr   Mockplistlibdumpr   rI   _macos_verscache_clearassert_called)monkeypatchr   	fake_filer   mr   s    `   @r   test_macos_vers_fallbackr   7  s    I *DII<,PQ 
h%t	,	'0)< 
- ($))*FGC 
OTYY9%E	F!!!--/((*tSk999!!--/ 
G
 OO 
-	, 
G	Fs   D/<AE /
D= 
Ec                  &   \ rS rSr\R
                  S 5       rS rS r\R                  R                  S/ SQ5      S 5       r\R                  R                  \R                  R                  S5      \R                  R                  S	5      :g  S
S9\R                  R                  SS/5      S 5       5       r\R                  R                  \R                  R"                  S:g  SS9\R                  R                  S/ SQ5      S 5       5       rSrg)TestDeepVersionLookupDistutilsiQ  c                "  ^  " S S[         5      nU" T5      nTR                  [        R                  5        Sn[	        U4S jU 5       5      Ul        [        [        [        R                  UR
                  R                  5       5      5        U$ )zY
Create a package environment, similar to a virtualenv,
in which packages are installed.
c                      \ rS rSrSrg)7TestDeepVersionLookupDistutils.env.<locals>.EnvironmentiY  r   N)r   r   r   r   r   r   r   r   Environmentr   Y  s    r   r   )homelibscriptsdatazegg-basec              3  B   >#    U  H  o[        TU-  5      4v   M     g 7fr   )rr   ).0r~   r   s     r   	<genexpr>5TestDeepVersionLookupDistutils.env.<locals>.<genexpr>_  s     Ng3v'7#89s   )rr   chmodr\   S_IRWXUdictpathsr   mapr   r   values)r   r   r   envsubss    `   r   r   "TestDeepVersionLookupDistutils.envR  sg    	# 	 &!T\\";NNN	S399++-./
r   c                4   Sn[        SX#S9n[        R                  R                  U5      n[        R                  R
                  R                  U5      nUR                  5         UR                  S   Ul        UR                  5         UR                  5         g)zR
Create a foo package installed (distutils-style) to env.paths['lib']
as version.
u&   This package has unicode metadata! ❄rp   )r9   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                    SnU R                  X5        [        R                  R                  S5      n[        R                  " UR
                  S   /5      R                  U5      nUR                  U:X  d   eg )Nz1.11.0.dev0+2329eaezfoo>=1.9r   )r  rI   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   )unnormalized
normalized))rp   rp   )zfoo/rp   )foo/barr  )zfoo/bar/r  c                j    [         R                  " U5      n[         R                  " U5      nX4:X  d   eg)zUEnsure the trailing slash is cleaned for path comparison.

See pypa/setuptools#1519.
NrI   normalize_pathr   r  r  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   )z
MiXeD/CasEz
mixed/casec                j    [         R                  " U5      n[         R                  " U5      nX4:X  d   eg)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.)r  r   ))zforward/slashforward\slash)zforward/slash/r)  )zbackward\slash\zbackward\slashc                `    [         R                  " U5      nUR                  U5      (       d   eg)z;Ensure path seps are cleaned on backslash path sep systems.N)rI   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   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                  p    \ rS rSrS rSSSSS.r\R                  R                  S/ S	Q5      S
 5       r	Sr
g)TestWorkdirRequirei  c                R   US-  nUR                  5         U R                  R                  5        HG  u  pVXE-  nUR                  R                  SSS9  UR	                  [
        R                  " U5      SS9  MI     UR                  [        SU/5        [        R                  " U5      $ )Nzsite-packagesT)exist_okparentsrU   rV   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   ze
            Metadata-Version: 2.4
            Name: pkg1.mod
            Version: 1.2.3
            zd
            Metadata-Version: 2.1
            Name: pkg2.mod
            Version: 0.42
            zE
            Name: pkg3.mod
            Version: 1.2.3.4
            zD
            Name: pkg4.mod
            Version: 0.42.1
            )z!pkg1_mod-1.2.3.dist-info/METADATAz pkg2.mod-0.42.dist-info/METADATAzpkg3_mod.egg-info/PKG-INFOzpkg4.mod.egg-info/PKG-INFO)r   requirement))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,<1c                   U R                  XU R                  5      n[        R                  " U/5      nXDR	                  SS5      4 Hx  nUR                  U5      u  nUR                  U:X  d   e[        R                  R                  [        R                  R                  UR                  U/5      U5      (       a  Mx   e   g )N.-)rB  r8  rI   r  replacerequirer   r   r   samefile
commonpathlocation)	r   r   r   r   rD  r@  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   r   r   r   rB  r8  r   r/  r0  rN  r   r   r   r   r4  r4    sM    	(.
-
''E* [["	
r   r4  )(
__future__r   r   rZ   r<  r   r   r\   r   r   r-   r/   unittestr   r   rI   r   r   r   "distutils.command.install_egg_infor  distutils.distrr   r	   r   rm   r   r   r   r/  r0  xfailversion_inforeleaselevelr   r   r   r   r   r4  r   r   r   <module>rW     s   "    	    
      Q Q )  W$ W$t3# 3#l(?4" 9	Z!45	j"67 RaG#P(8(8(E(E(P<  ,	,> RaG#P(8(8(E(E(P<  	$ %/O 0O4[) [)|6 6r   