
    vKgz                     H   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J	r	J
r
JrJrJrJrJrJrJr  S r " S S\R&                  5      r\R                  R*                  r " S S5      r " S	 S
5      r " S S5      r " S S5      r " S S5      r " S S5      rg)    N)SpecifierSet)	Distribution
EntryPointRequirementVersionConflict
WorkingSetparse_requirementsparse_version	safe_namesafe_versionc                 `    [         R                  " U 5      u  p[        US5        [        X5      $ )z$s -> (s0,s1), (s1,s2), (s2, s3), ...N)	itertoolsteenextzip)iterableabs      b/var/www/highfloat_scraper/venv/lib/python3.13/site-packages/pkg_resources/tests/test_resources.pypairwiser      s%    =="DADMq9    c                   <    \ rS rSrSrS
S jrS\4S jrS rS r	S	r
g)Metadata    zAMock object to return metadata as if from an on-disk distributionreturnNc                 $    [        U5      U l        g N)dictmetadata)selfpairss     r   __init__Metadata.__init__#   s    Ur   c                     XR                   ;   $ r   r   r    names     r   has_metadataMetadata.has_metadata&   s    }}$$r   c                      U R                   U   $ r   r%   r&   s     r   get_metadataMetadata.get_metadata)   s    }}T""r   c                 L    [         R                  " U R                  U5      5      $ r   )pkg_resourcesyield_linesr+   r&   s     r   get_metadata_linesMetadata.get_metadata_lines,   s    (():):4)@AAr   r%   )r   N)__name__
__module____qualname____firstlineno____doc__r"   boolr(   r+   r0   __static_attributes__ r   r   r   r       s!    K$%D %#Br   r   c                      \ rS rSrS rS rS rS rS rS r	SS	 jr
S
 r\R                  R                  \" \S5      (       + SS9rS r\S 5       r\S 5       rS rS rS rS rS rS rS rS r\R                  R;                  \R>                  SS S:H  =(       a    \R>                  R@                  S:g  SS9S 5       r!Sr"g) 
TestDistro3   c                 L   [         R                  " / S S S9n[        U5      / :X  d   eUS   / :X  d   eUR                  [	        S5      5        UR                  [	        S5      5        UR                  [	        S5      5        US   (       d   e[        U5      S/:X  d   e/ SQnUS    Vs/ sH  o3R
                  PM     snU:X  d   eUR                  US   S   5        US    Vs/ sH  o3R
                  PM     snS	S
/:X  d   eUR                  [	        S5      5        US    Vs/ sH  o3R
                  PM     sn/ SQ:X  d   e[        / 5      n[	        S5      n[	        S5      n[        S5      u  nUR                  Xt5      R
                  S:X  d   eUR                  U5        UR                  Xt5      R
                  S	:X  d   e[        / 5      nUR                  U5        UR                  U5        [        R                  " [        5         UR                  Xt5        S S S 5        [        / 5      nUR                  U5        UR                  U5        UR                  U5        UR                  Xt5      R
                  S	:X  d   eg s  snf s  snf s  snf ! , (       d  f       N}= f)N)platformpythonFooPkgFooPkg-1.3_1.eggzFooPkg-1.4-py2.4-win32.eggFooPkg-1.2-py2.4.eggfoopkg)1.41.3-11.2   rD   rF   zFooPkg-1.9.egg)1.9rD   rF   zFooPkg>=1.3rH   )r.   Environmentlistadddist_from_fnversionremover   r	   
best_matchpytestraisesr   )r    adexpecteddistwsfoo12foo14reqs           r   testCollectionTestDistro.testCollection4   sA   &&rDFBx2~~(|r!!!
|./0
|89:
|234 (||BxH:%%% +)+H66(BBB 			"X,q/")+H665%.HHH 	|,-.)+H66:OOOO^349:#M2 }}S%--666
u}}S%--666 ^
u
u]]?+MM#" , ^
u
u
u}}S%--666C 7 7 7" ,+s   *J%J%JJ
J#c                     UR                   S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR
                  [        S5      :X  d   eg )Nr@   rC   z	1.3.post12.4win32rE   )project_namekeyrM   
py_versionr>   parsed_versionr
   r    ds     r   checkFooPkgTestDistro.checkFooPkgg   su    ~~)))uu   yyK'''||u$$$zzW$$$=#9999r   c                    [        SSSSSS9nU R                  U5        [        S5      nUR                  [        R                  R
                   S[        R                  R                   3:X  d   eUR                  b   eg )N
/some/pathr@   rE   r\   r]   )r^   rM   r`   r>   .)r   rd   r`   sysversion_infomajorminorr>   rb   s     r   testDistroBasicsTestDistro.testDistroBasicso   s|    !
 	&||#"2"2"8"8!93;K;K;Q;Q:RSSSSzz!!!r   c                 t    [        S5      nU R                  U5        [        S5      nU R                  U5        g )Nz FooPkg-1.3.post1-py2.4-win32.eggz%FooPkg-1.3.post1-py2.4-win32.egg-info)rL   rd   rb   s     r   testDistroParseTestDistro.testDistroParse}   s4    ;<@Ar   c           	      R    [        SSSS[        S5      S9nU R                  U5        g )Nrg   r@   r\   r]   )zPKG-INFOz%Metadata-Version: 1.0
Version: 1.3-1
)r^   r`   r>   r   )r   r   rd   rb   s     r   testDistroMetadataTestDistro.testDistroMetadata   s1    !UV
 	r   c                 ,    [        S[        SU45      S9$ )Nz/foodepends.txtr%   )r   r   )r    txts     r   distRequiresTestDistro.distRequires   s    FX}c6J-KLLr   r9   c                 h    [        UR                  U5      5      [        [        U5      5      :X  d   eg r   )rJ   requiresr	   )r    rT   rw   extrass       r   checkRequiresTestDistro.checkRequires   s)    DMM&)*d3Ec3J.KKKKr   c                 X    S H$  nU R                  U R                  U5      U5        M&     g )N)Twisted>=1.5zTwisted>=1.5
ZConfig>=2.0)r}   rx   )r    vs     r   testDistroDependsSimple"TestDistro.testDistroDependsSimple   s'    =At003Q7 >r   __dir__z8object.__dir__ necessary for self.__dir__ implementationreasonc                 D    [         R                  " 5       n[        U5        g r   )r.   r   dirrb   s     r   test_distribution_dir TestDistro.test_distribution_dir   s    &&(Ar   c                     [         R                  " 5       nUR                  5       nSU;  d   eS UR                  l        UR                  5       n[        U5      [        U5      S-   :X  d   eSU;   d   eg )N	test_attrrG   )r.   r   r   	_providerr   lenr    rc   beforeafters       r   +test_distribution_dir_includes_provider_dir6TestDistro.test_distribution_dir_includes_provider_dir   sh    &&(&((( $		5zS[1_,,,e###r   c                     [         R                  " 5       nUR                  5       nSU;  d   eS UR                  l        UR                  5       n[        U5      [        U5      :X  d   eSU;  d   eg )N
_test_attr)r.   r   r   r   r   r   r   s       r   =test_distribution_dir_ignores_provider_dir_leading_underscoreHTestDistro.test_distribution_dir_ignores_provider_dir_leading_underscore   sd    &&(6)))!%		5zS[(((5(((r   c                    [         R                  " / 5      n[        / 5      n[        UR	                  / U5      5      / :X  d   e[
        R                  " [         R                  5         UR	                  [        S5      U5        S S S 5        [        R                  " S[        S5      S9nUR                  U5        UR                  [        R                  " S5      5        [        S5       HN  n[        UR	                  [        S5      U5      5      nXS/:X  d   e[        [        UR                  U5      5        MP     [
        R                  " [        5         UR	                  [        S5      U5        S S S 5        [        / 5      n[
        R                  " [         R                  5         UR	                  [        S5      U5        S S S 5        [        R                  " S	[        S
5      S9nUR                  U5        [        UR	                  [        S5      U5      5      X6/:X  d   e[
        R                  " [        5       nUR	                  [        S5      U5        S S S 5        SnWR                   R#                  5       U:X  d   eg ! , (       d  f       GN= f! , (       d  f       GN/= f! , (       d  f       N= f! , (       d  f       Nf= f)NFoo/foo_dir/Foo-1.2.egg)rv   z[bar]
Baz>=2.0r%   zFoo-0.9.egg   zFoo==0.9zFoo[bar]z/foo_dir/Baz-2.1.egg)rv   r   zFoo==1.2
Foo!=1.2z-Foo 0.9 is installed but Foo==1.2 is required)r.   rI   r   rJ   resolverP   rQ   DistributionNotFoundr	   r   from_filenamer   rK   rangemapr   valuereport)	r    rR   rU   r   itargetsBazvcmsgs	            r   testResolveTestDistro.testResolve   s   &&r*^BJJr2&'2---]]===>JJ)%0"5 ? (("@A
 	s
|))-89 qA2::&8&?DEGe###RVVW%&  ]]?+JJ)*5r: ,^ ]]===>JJ)*5r: ?(("X6L-M
 	s BJJ1*=rBCzQQQ]]?+rJJ)*>?D , >xx C'''E ?> ,+
 ?> ,+s0   'JJ)J,J=
J
J),
J:=
Kc                     [         R                  " / 5      n[        / 5      nUR                  [	        S5      U5      n[        U5      / :X  d   eg)z5Environment markers are evaluated at resolution time.zFoo;python_version<'2'N)r.   rI   r   r   r	   rJ   )r    rR   rU   ress       r   +test_environment_marker_evaluation_negative6TestDistro.test_environment_marker_evaluation_negative   sB    &&r*^jj+,DErJCyBr   c                     [         R                  " / 5      n[        / 5      n[        R                  " S5      nUR                  U5        UR                  [        S5      U5      n[        U5      U/:X  d   eg )N/foo_dir/Foo-1.2.dist-infozFoo;python_version>='2')	r.   rI   r   r   r   rK   r   r	   rJ   )r    rR   rU   r   r   s        r   +test_environment_marker_evaluation_positive6TestDistro.test_environment_marker_evaluation_positive   sb    &&r*^(()EF
sjj+,EFKCySE!!!r   c                 P   [        S5      u  n[        S5      u  n[        R                  " X!R                  05      nUR	                  U5      (       d   e[        S5      u  n[        S5      u  n[        R                  " X!R                  05      nUR	                  U5      (       d   eg)za
If one package foo requires bar without any extras,
markers should pass for bar without extras.
foozbar;python_version>='2'zfoo[]N)r	   r.   
_ReqExtrasr|   markers_pass)r    
parent_reqrX   
req_extrass       r   )test_environment_marker_evaluation_called4TestDistro.test_environment_marker_evaluation_called   s    
 +51#$=>"--s4E4E.FG
&&s++++*73#$=>"--s4E4E.FG
&&s++++r   c                    [         R                  " / 5      n[        / 5      n[        R                  " S[        S5      S9nUR                  U5        [        UR                  [        S5      U5      5      U/:X  d   e[        R                  " S5      nUR                  U5        [        UR                  [        S5      U5      5      nXSU/:X  d   eg)8Extras are also evaluated as markers at resolution time.r   )METADATAz5Provides-Extra: baz
Requires-Dist: quux; extra=='baz'r%   r   /foo_dir/quux-1.0.dist-infozFoo[baz]N
r.   rI   r   r   r   r   rK   rJ   r   r	   r    rR   rU   r   quuxr   s         r   "test_marker_evaluation_with_extras-TestDistro.test_marker_evaluation_with_extras   s    &&r*^(((  
 	sBJJ1%8"=>3%GGG))*GH
t2::0<bABDk!!!r   c                    [         R                  " / 5      n[        / 5      n[        R                  " S[        S5      S9nUR                  U5        [        UR                  [        S5      U5      5      U/:X  d   e[        R                  " S5      nUR                  U5        [        UR                  [        S5      U5      5      nXSU/:X  d   eg)r   r   )r   zIProvides-Extra: baz-lightyear
Requires-Dist: quux; extra=='baz-lightyear'r%   r   r   zFoo[baz-lightyear]Nr   r   s         r   ,test_marker_evaluation_with_extras_normlized7TestDistro.test_marker_evaluation_with_extras_normlized  s    &&r*^(((  
 	sBJJ1%8"=>3%GGG))*GH
t2::01EFKLDk!!!r   c                    [         R                  " / 5      n[        / 5      n[        R                  " S[        S5      S9nUR                  U5        [        R                  " S5      nUR                  U5        [        R                  " S5      nUR                  U5        [        UR                  [        S5      U5      5      n[        U5      XTU/:X  d   eg )Nr   )r   zlProvides-Extra: baz
Requires-Dist: quux; extra=='baz'
Provides-Extra: bar
Requires-Dist: fred; extra=='bar'
r%   r   z/foo_dir/fred-0.1.dist-infozFoo[baz,bar])r.   rI   r   r   r   r   rK   rJ   r   r	   sorted)r    rR   rU   r   r   fredr   s          r   +test_marker_evaluation_with_multiple_extras6TestDistro.test_marker_evaluation_with_multiple_extras!  s    &&r*^(((  	
 	s))*GH
t))*GH
t2::0@"EFc{t3////r   c                    [         R                  " / 5      n[        / 5      n[        R                  " S[        S5      S9n[        R                  " S[        S5      S9n[        R                  " S[        S5      S9n[        R                  " S5      nX4XV4 H  nUR                  U5        M     [        UR                  [        S	5      U5      5      nXXTU/:X  d   eg )
Nz/foo_dir/a-0.2.dist-info)r   zRequires-Dist: c[a]r%   z/foo_dir/b-0.3.dist-info)r   zRequires-Dist: c[b]z/foo_dir/c-1.0.dist-info)r   z]Provides-Extra: a
Requires-Dist: b;extra=='a'
Provides-Extra: b
Requires-Dist: foo;extra=='b'z/foo_dir/foo-0.1.dist-infor   r   )	r    rR   rU   r   r   cr   rT   r   s	            r   'test_marker_evaluation_with_extras_loop2TestDistro.test_marker_evaluation_with_extras_loop6  s    &&r*^&&&AB
 &&&AB
 &&&  	
 (()EF1NDFF4L #2::05r:;!n$$$r   N   )r      finalz/https://github.com/python/cpython/issues/103632c                    U R                  S5      nU R                  US5        U R                  USR                  5       S/5        U R                  USR                  5       S/5        U R                  USR                  5       SS/5        U R                  USR                  5       SS/5        [        R                  " [
        R                  5         UR                  S	/5        S S S 5        g ! , (       d  f       g = f)
Nz
            Twisted>=1.5
            [docgen]
            ZConfig>=2.0
            docutils>=0.3
            [fastcgi]
            fcgiapp>=0.1r   z'Twisted>=1.5 ZConfig>=2.0 docutils>=0.3docgenzTwisted>=1.5 fcgiapp>=0.1fastcgiz4Twisted>=1.5 ZConfig>=2.0 docutils>=0.3 fcgiapp>=0.1z4Twisted>=1.5 fcgiapp>=0.1 ZConfig>=2.0 docutils>=0.3r   )rx   r}   splitrP   rQ   r.   UnknownExtrar{   rb   s     r   testDistroDependsOptions#TestDistro.testDistroDependsOptionsQ  s    
 
 	1n-8>>@8*	
 	19??AI;OBHHJy!	

 	BHHJ!	

 ]]=556JJw 766s   C..
C<)r9   )#r2   r3   r4   r5   rY   rd   rm   rp   rs   rx   r}   r   rP   markskipifhasattrobjectneeds_object_dirr   r   r   r   r   r   r   r   r   r   r   xfailri   rj   releaselevelr   r8   r9   r   r   r;   r;   3   s   17f:"ML8 {{))FI&&I * 
 $ $ ) )((T","$"&0*%6 [[!'TC,<,<,I,IW,T@   	 r   r;   c                        \ rS rSrS rS rSrg)TestWorkingSetir  c                 ^   [        / 5      n[        R                  " S5      nUR                  U5        [	        [        S5      5      n[        R                  " [        5       nUR                  U5        S S S 5        SnWR                  R                  5       U:X  d   eg ! , (       d  f       N1= f)Nr   zFoo<1.2z,Foo 1.2 is installed but Foo<1.2 is required)r   r   r   rK   r   r	   rP   rQ   r   findr   r   )r    rU   r   rX   r   r   s         r   test_find_conflicting$TestWorkingSet.test_find_conflictings  s    ^(()?@
s %i01]]?+rGGCL , =xx C'''	 ,+s   !B
B,c                    [        / 5      n[        S5      n[        R                  " SUS9nUR	                  U5        [        S5      n[        R                  " SUS9nUR	                  U5        [        R                  " S5      nUR	                  U5        [        R                  " S5      nUR	                  U5        [
        R                  " [        5       nUR                  [        S5      5        S	S	S	5        S
nU[        [        S/5      5      -  nWR                  R                  5       U:X  d   eg	! , (       d  f       NI= f)z}
A ContextualVersionConflict should be raised when a requirement
conflicts with a prior requirement for a different package.
)rv   zBaz==1.0z/foo_dir/Foo-1.0.eggr%   )rv   zBaz==2.0z/foo_dir/Bar-1.0.eggz/foo_dir/Baz-1.0.eggz/foo_dir/Baz-2.0.eggzFoo
Bar
Nz1Baz 1.0 is installed but Baz==2.0 is required by Bar)r   r   r   r   rK   rP   rQ   r   r   r	   reprsetr   r   )r    rU   mdr   r   r   r   r   s           r   !test_resolve_conflicts_with_prior0TestWorkingSet.test_resolve_conflicts_with_prior  s     ^12(()?"M
s12(()?"M
s(()?@
s(()?@
s]]?+rJJ),78 , BtCL!!xx C''' ,+s   D44
Er9   N)r2   r3   r4   r5   r   r   r8   r9   r   r   r   r   r  s    ((r   r   c            
           \ rS rSrS rS rS rS rSr\	R                  R                  S\5      S 5       rS	 rS
 r\" \" SSS/5      \" SSS/SS/5      \" SSS/S9S9rSrS rS rS rSrg)TestEntryPointsi  c                     UR                   S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR	                  5       [
        L d   eSn[        U5      U:X  d   eg )Nr   "pkg_resources.tests.test_resources)r   )x<foo = pkg_resources.tests.test_resources:TestEntryPoints [x])r'   module_nameattrsr|   loadr   str)r    epexpects      r   assertfieldsTestEntryPoints.assertfields  sw    ww%~~!EEEExx////yyF"""wwyO+++O2w&   r   c                 J    [         R                  " S[        S5      S9U l        g )NrB   )zrequires.txtz[x]r%   )r   r   r   rT   )r    methods     r   setup_methodTestEntryPoints.setup_method  s     .."X6M-N
	r   c                 \    [        SSS/S/U R                  5      nU R                  U5        g )Nr   r   r   r   )r   rT   r   r    r   s     r   
testBasicsTestEntryPoints.testBasics  s4    0EII
 	"r   c                 6   Sn[         R                  " XR                  5      nU R                  U5        [         R                  " S5      nUR                  S:X  d   eUR
                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   e[         R                  " S5      nUR                  S:X  d   eUR
                  S	:X  d   eUR                  S
:X  d   eUR                  S:X  d   eSn[         R                  " U5      nUR                  S:X  d   eg )Nr   zbar baz=  spammity[PING]zbar bazspammityr9   )pingz fizzly =  wocka:foofizzlywocka)r   z0html+mako = mako.ext.pygmentplugin:MakoHtmlLexerz	html+mako)r   parserT   r   r'   r   r   r|   )r    sr   specs       r   	testParseTestEntryPoints.testParse  s   Ja+"89ww)###~~+++xx2~~yyI%%%45ww("""~~(((xx8###yyB Bd#ww+%%%r   )r   zx=a:b:czq=x/nazfez=pish:tush-zzx=f[a]>2reject_specc                     [         R                  " [        5         [        R                  " U5        S S S 5        g ! , (       d  f       g = fr   )rP   rQ   
ValueErrorr   r  )r    r  s     r   test_reject_spec TestEntryPoints.test_reject_spec  s(    ]]:&[) '&&s	   ;
A	c                     [         R                  R                  5       nSR                  " S0 [	        5       D6n[
        R                  " U5      nUR                  U:X  d   eg)z,
Allow any printable character in the name.
z{name} = module:attrNr9   )string	printablestripformatlocalsr   r  r'   )r    r'   r
  r   s       r   test_printable_name#TestEntryPoints.test_printable_name  sM    
 %%'%,,8vx8d#ww$r   c                 2   [        U5      [        U R                  5      :X  d   eU R                  R                  5        H  u  p#UR                  U5      R                  UR                  :X  d   eUR                  U5      R
                  UR
                  :X  d   e[        UR                  U5      R                  5      [        UR                  5      :X  d   e[        UR                  U5      R                  5      [        UR                  5      :X  a  M   e   g r   )	r   submap_expectitemsgetr'   r   r   r   r|   )r    mr_   r   s       r   checkSubMapTestEntryPoints.checkSubMap  s    1vT//0000))//1GC55:??bgg---55:))R^^;;;!%%***+vbhh/????!%%*++,ryy0AAAA	 2r   feature1
somemodulesomefunctionfeature2zanother.module	SomeClassextra1extra2feature3zthis.module	something)r|   )r!  r$  r(  z
            # define features for blah blah
            feature1 = somemodule:somefunction
            feature2 = another.module:SomeClass [extra1,extra2]
            feature3 = this.module [something]
    c                    U R                  [        R                  " SU R                  5      5        [        R
                  " [        5         [        R                  " SS5        S S S 5        [        R
                  " [        5         [        R                  " SSS/5        S S S 5        g ! , (       d  f       NK= f! , (       d  f       g = f)Nxyzzx azfoo=barr   zfoo=baz)r  r   parse_group
submap_strrP   rQ   r  r    s    r   testParseListTestEntryPoints.testParseList  s{    //tGH]]:&""5)4 ']]:&""3I(>? '& '&&&s   B(B9(
B69
Cc                    [         R                  " SU R                  05      nU R                  US   5        [	        UR                  5       5      S/:X  d   e[         R                  " SU R                  -   5      nU R                  US   5        [	        UR                  5       5      S/:X  d   e[        R                  " [        5         [         R                  " SS/5        S S S 5        [        R                  " [        5         [         R                  " U R                  5        S S S 5        g ! , (       d  f       NR= f! , (       d  f       g = f)Nr+  z[xyz]
z[xyz])	r   	parse_mapr-  r  rJ   keysrP   rQ   r  )r    r  s     r   testParseMapTestEntryPoints.testParseMap  s      %!9:5"AFFH~%(((  T__!<=5"AFFH~%(((]]:&  '7!34 ']]:&  1 '& '&&&s   D-!D>-
D;>
Ec                     [        SSS/S/5      n[        R                  " [        R                  5         UR                  SS9  S S S 5        g ! , (       d  f       g = f)Nr   r   r   r   F)require)r   rP   warnsr.   PkgResourcesDeprecationWarningr   r   s     r   testDeprecationWarnings'TestEntryPoints.testDeprecationWarnings  sK    7:K9Lse
 \\-FFGGGEG" HGGs   A
A)rT   N)r2   r3   r4   r5   r   r   r  r  reject_specsrP   r   parametrizer  r  r  r   r   r  r-  r/  r4  r:  r8   r9   r   r   r   r     s    !

&, ML[[]L9* :*B J~6FG(;-(H9M
 J{mLMJ@
2#r   r   c                   8    \ rS rSrS rS rS rS rS rS r	Sr
g	)
TestRequirementsi  c                 @   [         R                  " S5      n[        U5      S:X  d   e[        U5      S:X  d   eU[        S5      :X  d   eU[        S5      :X  d   eU[        S5      :w  d   eU[        S5      :w  d   eU[        S5      :w  d   eU[        S5      :w  d   eg )NTwisted>=1.2z!Requirement.parse('Twisted>=1.2')ztwisTed>=1.2zTwisted>=2.0z	Zope>=1.2z	Zope>=3.0zTwisted[extras]>=1.2)r   r  r   r   )r    rs     r   r  TestRequirements.testBasics  s    n-1v'''Aw====K////K////K////K,,,,K,,,,K 67777r   c                     [        S5      n[        S5      nX:X  d   e[        U5      [        U5      :X  d   e[        U5      S:X  d   e[        S5      [        S5      :w  d   eg )NzTwisted==1.2c1,>=1.2zTwisted>=1.2,==1.2c1Twisted'Twisted @ https://localhost/twisted.zip)r   r   r    r1r2s      r   testOrderingTestRequirements.testOrdering  sk    /0/0xx2w#b'!!!2w00009%5*
 
 	
 
r   c                 ,   [        S5      n[        R                  " S5      n[        R                  " S5      n[        R                  " S5      n[        S5      U;   d   e[        S5      U;  d   eSU;   d   eSU;  d   eX!;  d   eX1;  d   eXA;   d   eg )NrA  rA   zTwisted-1.1.eggzTwisted-1.2.eggrF   1.1)r   r   r   r
   )r    rB  foo_disttwist11twist12s        r   testBasicContains"TestRequirements.testBasicContains#  s    '--.@A,,->?,,->?U#q(((U#1,,,zzA~~   ||r   c           
         [         R                  " S5      n[         R                  " S5      nX:X  d   e[        UR                  5      [        S5      :X  d   e[        UR                  5      [        S5      :X  d   e[	        U5      [	        U5      :X  d   e[	        U5      [	        SS [        S5      [        SS/5      S 45      :X  d   e[	        [         R                  " S5      5      [	        SS	[        5       [        5       S 45      :X  d   eg )
NzTwisted[foo,bar]>=1.2zTwisted[bar,FOO]>=1.2)r   bartwistedz>=1.2r   rT  rF  zhttps://localhost/twisted.zip)r   r  r   r|   hashr   	frozensetrG  s      r   testOptionsAndHashing&TestRequirements.testOptionsAndHashing0  s    6767xx299~^!4444299~^!4444Bx48###Bx4!uen%!
   	  GH
+NK
  	 r   c                 @   [         R                  " S5      n[         R                  " S5      n[        R                  nU" S5      U;  d   eU" S5      U;  d   eU" S5      U;  d   eU" S5      U;   d   eU" S5      U;   d   eU" S5      U;   d   eU" S5      U;   d   eg )Nz
foo==0.3a2z
foo!=0.3a4zfoo-0.3a4.eggzfoo-0.3a1.eggzfoo-0.3a2.eggzfoo-0.3a3.eggzfoo-0.3a5.egg)r   r  r   r   )r    rH  rI  rc   s       r   testVersionEquality$TestRequirements.testVersionEqualityH  s    |,|,&&!+++!+++!+++!R'''!R'''!R'''!R'''r   c                 4   [         R                  " S5      R                  S:X  d   e[         R                  " S5      R                  S:X  d   e[         R                  " S5      R                  S:X  d   e[         R                  " S5      R                  S:X  d   eg)zA
The setuptools project should implement the setuptools package.

setuptoolszsetuptools == 0.7zsetuptools == 0.7a1zsetuptools >= 0.7N)r   r  r^   r.  s    r   testSetuptoolsProjectName*TestRequirements.testSetuptoolsProjectNameV  s    
   .;;|KKK  !45BBlRRR  !67DDTTT  !45BBlRRRr   r9   N)r2   r3   r4   r5   r  rJ  rQ  rX  r[  r_  r8   r9   r   r   r?  r?    s!    	8
0(	Sr   r?  c                   *   \ rS rSrS rS rS rS rS rS r	S r
S	 rS
 r\R                  R                  S/ SQ5      S 5       rSr\R                  R                  S/ SQ\" \" \" \R+                  5       5      5      5      -   5      S 5       rS rSrg)TestParsingib  c                 8    [        [        S5      5      / :X  d   eg )N )rJ   r	   r.  s    r   testEmptyParseTestParsing.testEmptyParsec  s    &r*+r111r   c                     / / 4SS/4/ // 4SSS/4SS/SS/44 H*  u  p[        [        R                  " U5      5      U:X  a  M*   e   g )Nr   z x
 yyzx

)rJ   r.   r/   )r    inpouts      r   testYieldingTestParsing.testYieldingf  se    H3%LT2JSz"s^c3Z(
HC 11#673>>>
r   c                     Sn[        [        R                  " U5      5      S S/4SSS/4SS/4S/ 4S	S
/4/:X  d   e[        R                  " [
        5         [        [        R                  " S5      5        S S S 5        g ! , (       d  f       g = f)Na   
                    x
                    [Y]
                    z

                    a
                    [b ]
                    # foo
                    c
                    [ d]
                    [q]
                    v
                    r   Yzr   r   r   rc   qr   z[foo)rJ   r.   split_sectionsrP   rQ   r  )r    samples     r   testSplittingTestParsing.testSplittingp  s     M0089C5M3*3%L"I3%L>
 
 	
 
 ]]:&--f56 '&&s    A??
Bc                     [        S5      S:X  d   e[        S5      S:X  d   e[        S5      S:X  d   e[        S5      S:X  d   e[        S5      S:w  d   eg )	Nzadns-pythonz
WSGI Utilsz
WSGI-UtilszWSGI  UtilsMoney$$$MakerMoney-Makerpeak.webzpeak-web)r   r.  s    r   testSafeNameTestParsing.testSafeName  sa    '=888&,666'<777)]:::$
222r   c                     [        S5      S:X  d   e[        S5      S:X  d   e[        S5      S:X  d   e[        S5      S:X  d   e[        S	5      S	:X  d   eg )
Nz1.2-1z	1.2.post1z	1.2 alphaz	1.2.alphaz2.3.4 20050521z2.3.4.20050521rv  rw  rx  )r   r.  s    r   testSafeVersionTestParsing.testSafeVersion  sc    G$333K(K777,-1AAAAO,===J':555r   c                    [        [        S5      5      [        S5      /:X  d   e[        [        S5      5      [        S5      /:X  d   e[        R                  " S5      [        S5      :X  d   e[        R
                  " [        5         [        R                  " S5        S S S 5        [        R
                  " [        5         [        R                  " S5        S S S 5        [        R
                  " [        5         [        R                  " S5        S S S 5        [        R
                  " [        5         [        R                  " S5        S S S 5        [        R
                  " [        5         [        R                  " S	5        S S S 5        g ! , (       d  f       N= f! , (       d  f       N= f! , (       d  f       N= f! , (       d  f       N{= f! , (       d  f       g = f)
NzTwis-Ted>=1.2-1zTwisted >=1.2, \ # more
<2.0zTwisted>=1.2,<2.0zFooBar==1.99a3z>=2.3zx\zx==2 qz	X==1
Y==2#)rJ   r	   r   r  rP   rQ   r  r.  s    r   testSimpleRequirements"TestParsing.testSimpleRequirements  sB   &'89:)*?
 
 	
 
 &'GHI+,N
 
 	
 
   !12kBR6SSSS]]:&g& ']]:&e$ ']]:&h' ']]:&l+ ']]:&c" '& '&&&&&&&&&s<   FF:F.3F?,G
F
F+.
F<?
G
Gc                    [         R                  " S5      [         R                  " S5      :X  d   e[         R                  " S5      [         R                  " S5      :w  d   e[         R                  " S5      [         R                  " S5      :w  d   e[         R                  " S5      [         R                  " S5      :w  d   eg )Nzfoobar;os_name=='a'zname==1.1;python_version=='2.7'zname==1.1;python_version=='3.6'zname==1.0;python_version=='2.7'zname==1.2;python_version=='2.7'z$name[foo]==1.0;python_version=='3.6'z(name[foo,bar]==1.0;python_version=='3.6')r   r  r.  s    r   test_requirements_with_markers*TestParsing.test_requirements_with_markers  s      !67;;L;L!<
 
 	
 
   -
@AB 	B B   -
@AB 	B B   2
IJK 	K Kr   c                     [        S5        g )Nzfoo==1.0+org1r	   r.  s    r   test_local_versionTestParsing.test_local_version  s
    ?+r   c                 0    [        S5        [        S5        g )Nzfoo>=1.0, <3zfoo >= 1.0, < 3r  r.  s    r   %test_spaces_between_multiple_versions1TestParsing.test_spaces_between_multiple_versions  s    >*,-r   )lowerupper)
)z1.2-rc1z1.2rc1)0.40.4.0)z0.4.0.0r  )z0.4.0-0z0.4-0)0post1z0.0post1)0pre10.0c1)z0.0.0preview10c1)r  z0-rc1)z1.2a1z1.2.a.1)z1.2.az1.2ac                 8    [        U5      [        U5      :X  d   eg r   r
   r    r  r  s      r   r[  TestParsing.testVersionEquality  s      U#}U';;;;r   z
        0.80.1-3 0.80.1-2 0.80.1-1 0.79.9999+0.80.0pre4-1
        0.79.9999+0.80.0pre2-3 0.79.9999+0.80.0pre2-2
        0.77.2-1 0.77.1-1 0.77.0-1
        ))2.12.1.1)2a12b0)r  r  )z2.3a1z2.3)2.1-1z2.1-2)r  r  )r  z2.1post4)z2.1a0-20040501r  )rM  z02.1)z3.2z	3.2.post0)z3.2post1z3.2post2)r  z4.0)z0.0.4r  )r  z0.4post1)z	2.1.0-rc1z2.1.0)z2.1devz2.1a0c                 8    [        U5      [        U5      :  d   eg r   r  r  s      r   testVersionOrderingTestParsing.testVersionOrdering  s    . U#mE&::::r   c                 \    [        [        S5      5      [        [        S5      5      :X  d   eg)zl
Ensure that our versions stay hashable even though we've subclassed
them and added some shim code to them.
z1.0N)rV  r
   r.  s    r   testVersionHashableTestParsing.testVersionHashable  s&    
 M%()T-2F-GGGGr   r9   N)r2   r3   r4   r5   re  rk  rs  ry  r|  r  r  r  r  rP   r   r=  r[  torturerJ   r   reversedr   r  r  r8   r9   r   r   rb  rb  b  s    2?7036#&K,. [[	
<<G [[	
$ x12
3%	4,;-,;Hr   rb  c                       \ rS rSrSr\R                  S 5       r\R                  " SS9S 5       r\R                  R                  \R                  " 5       S:H  SS	9r\S
 5       r\S 5       rSrg)TestNamespacesi  z8__import__('pkg_resources').declare_namespace(__name__)
c              #   8  #    [        [        S5      (       d  [        U5      v   g[        U5      S-   n[        R                  " [        U5      U5         [	        U5      " U5      v   [        R
                  " U5        g! [        R
                  " U5        f = f7f)zu
Where available, return the tempdir as a symlink,
which as revealed in #231 is more fragile than
a natural tempdir.
symlinkNz-linked)r   osr   r  typeunlink)r    tmpdir	link_names      r   symlinked_tmpdirTestNamespaces.symlinked_tmpdir  sm      r9%%f+K)+	


3v;	*	!v,y))IIi BIIi s   ABA? (B?BBT)autousec              #   L  #    [         R                  R                  5       n[        R                  SS nUR                  S5      n[        R                  R                  [        U5      5         Sv   U[         l        U[        l        g! U[         l        U[        l        f = f7f)zt
Patch sys.path to include the 'site-pkgs' dir. Also
restore pkg_resources._namespace_packages to its
former state.
N	site-pkgs)r.   _namespace_packagescopyri   pathmkdirappendr   )r    r  saved_ns_pkgssaved_sys_path	site_pkgss        r   patched_pathTestNamespaces.patched_path  ss      &99>>@!LL-	I'	&0=M-%CH 1>M-%CHs   A+B$.B	 2B$	B!!B$Windowsz#591r   c                 <   UR                  5       nUn[        R                  R                  [	        US-  5      5        US-  US-  4nU HW  nUS-  nUS-  nUR                  5         US-  R                  U R                  SS9  US-  R                  U R                  SS9  MY     [        R                  " [        SS	9   S
SKnSSS5        S[        R                  ;   d   e[        R                  " [        SS	9   S
SKnSSS5        S[        R                  ;   d   e[        R                  S   S/:X  d   e[	        US-  S-  S-  5      [	        US-  S-  S-  5      /nWR                  R                   U:X  d   eg! , (       d  f       N= f! , (       d  f       N= f)z
Test nested namespace packages
Create namespace packages in the following tree :
    site-packages-1/pkg1/pkg2
    site-packages-2/pkg1/pkg2
Check both are in the _namespace_packages dict and that their __path__
is correct

site-pkgs2r  pkg1pkg2__init__.pyutf-8encodingpkg_resources.declare_namespacematchr   Nz	pkg1.pkg2)realpathri   r  r  r   
ensure_dir
write_textns_strrP   r8  DeprecationWarningr  r.   r  	pkg1.pkg2r  __path__)	r    r  real_tmpdirr  	site_dirssiter  r  rS   s	            r   test_two_levels_deep#TestNamespaces.test_two_levels_deep  s    '//1!F\123[(&<*??	D&=D&=DOOM!--dkkG-LM!--dkkG-L  \\,4UV W:::::\\,4UV W m?????008[MIII k)F2V;<l*V3f<=
 yy!!X--- WV WVs   >E<:F<
F

Fc                 x   UnUS-  US-  US-  4nSn[        US5       H  u  pVUS:  a(  [        R                  R                  [	        U5      5        US-  nUS-  nUR                  5         US-  R                  U R                  S	S
9  US-  R                  XE-  S	S
9  M     [        R                  " [        SS9   SSKnSSKnSSS5        U Vs/ sH  n[	        UR                  5       S-  5      PM!     n	nWR                  U	:X  d   eUR                  R                   S:X  d   eg! , (       d  f       Nh= fs  snf )a&  
Test that if multiple versions of the same namespace package subpackage
are on different sys.path entries, that only the one earliest on
sys.path is imported, and that the namespace package's __path__ is in
the correct order.

Regression test for https://github.com/pypa/setuptools/issues/207
r  r  z
site-pkgs3z__version__ = %rrG   nspkgsubpkgr  r  r  r  r  r   N)	enumerateri   r  r  r   r  r  r  rP   r8  r  r  nspkg.subpkgr  r  r  __version__)
r    r  r  r  vers_strnumberr  r  r  rS   s
             r   test_path_orderTestNamespaces.test_path_orderC  s2    "[ \!\!
	 &%i3LFzD	*7NEX%F]"..t{{W.Mm#//0AG/T 4 \\,4UV W @IIytC'12yI~~)))||''1,,, WV Js   ;	D&%D7&
D4r9   N)r2   r3   r4   r5   r  rP   fixturer  r  r   r   r>   systemissue591r  r  r8   r9   r   r   r  r    s    HF^^! !" ^^D!& "&  {{  !2i!? OH!. !.F !- !-r   r  )r   r  r>   r  ri   rP   packaging.specifiersr   r.   r   r   r   r   r   r	   r
   r   r   r   EmptyProviderr   r   rL   r;   r   r   r?  rb  r  r9   r   r   <module>r     s     	   
  - 
 
 
B}** B  ))77|  | ~	'( '(Tn# n#bRS RSjRH RHjn- n-r   