
    ,h                         d Z ddlZddlZddlZddlZddlZddlmZ ddlZddl	Z	ddl
mZ ddlmZ  eej                  j                  d      Z G d	 d
      Z G d d      Zd Zd Zy)z$Test .dist-info style distributions.    N)partial)unpack_archive   )DALSutf-8encodingc                       e Zd Z ed      Zed        Zej                  d        Z	d Z
d Zd Zd Zej                  j                  dd	      d
        Zy)TestDistInfoz
        Metadata-Version: 1.2
        Requires-Dist: splort (==4)
        Provides-Extra: baz
        Requires-Dist: quux (>=1.1); extra == 'baz'
        c                 l    d |j                         D        }| j                  dj                  |      z   S )Nc              3   V   K   | ]!  \  }} d j                   di t                # yw)z{key}: {value}
N )formatlocals).0keyvalues      a/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/setuptools/tests/test_dist_info.py	<genexpr>z.TestDistInfo.build_metadata.<locals>.<genexpr>    s(     X:3*#**6VX6Xs   ') )itemsmetadata_basejoin)clskwargsliness      r   build_metadatazTestDistInfo.build_metadata   s+    XX  2775>11    c                    d}||z  }|j                          |dz  }| j                  d      }|j                  |d       d}||z  }|j                          |dz  }| j                  dd	
      }|j                  |d       t        |      S )Nz%VersionedDistribution-2.718.dist-infoMETADATAVersionedDistribution)Namer   r   z!UnversionedDistribution.dist-infoUnversionedDistribution0.3)r"   Version)mkdirr   
write_textstr)selftmpdirdist_info_name	versionedfilenamecontentunversioneds          r   metadatazTestDistInfo.metadata#   s    @^+	z)%%( & 
 	Gg6<~-+%%* & 
 	Gg66{r   c                     t        d t        j                  |      D              }t        |      dk(  sJ |       |d   }|d   }|j                  dk(  sJ |j                  dk(  sJ y )Nc              3   8   K   | ]  }|j                   |f  y wN)project_name)r   ds     r   r   z-TestDistInfo.test_distinfo.<locals>.<genexpr>;   s      
$%Q^^Q
s      r#   r!   z2.718r$   )dictpkg_resourcesfind_distributionslenversion)r)   r0   distsr/   r,   s        r   test_distinfozTestDistInfo.test_distinfo:   st     
)6)I)I()S
 
 5zQ%%5612	  G++""e+++r   c                 \   d}t        t        t        j                  j                  |            }t        j
                  |      D ]e  }|j                         |d d k(  sJ |j                  d      |d   t        j                  j	                  d      gk(  sJ |j                  dgk(  reJ  y )N)z	splort==4z	quux>=1.1r   )baz)extrasr   zquux>=1.1;extra=="baz"r?   )listmapr8   Requirementparser9   requiresr@   )r)   r0   specsrE   r5   s        r   test_conditional_dependenciesz*TestDistInfo.test_conditional_dependenciesG   s    (M55;;UCD11(; 	'A::<8BQ<//::X:.))//0HI3   88w&&	'r   c                 H   d}|dz  j                  |d       t        j                  dt        j                  t        j                  z        }t        d|d      }|j                  sJ |j                  |j                        sJ t        |j                  d	            rJ y
)zA
        Supplying an invalid version crashes dist_info.
        z@[metadata]
name=proj
version=42
[egg_info]
tag_build=invalid!!!
	setup.cfgr   r   zinvalid version	dist_infoF)cwdcheck*.dist-infoN)r'   recompileMIrun_command_inner
returncodesearchstdoutrA   glob)r)   tmp_pathconfigmsgprocs        r   test_invalid_versionz!TestDistInfo.test_invalid_versionS   s     Y	K	++FW+Ejj*BDD244K8 (%Hzz$++&&m4555r   c                    d}|dz  j                  |d       t        t        dd|             t        |j	                  d            }|j
                  j                  d	      sJ t        j                  |       t        t        dd
d|             t        |j	                  d            }|j
                  j                  d      sJ y )Nz
        [metadata]
        name=proj
        version=42
        [egg_info]
        tag_date=1
        tag_build=.post
        rI   r   r   rJ   z	--no-daterK   rM   zproj-42z--tag-buildz.azproj-42a)	r'   printrun_commandnextrV   name
startswithshutilrmtree)r)   rW   rX   rJ   s       r   test_tag_argumentszTestDistInfo.test_tag_arguments_   s     
K	++FW+Ek+{AB}56	~~((33i k+}dIJ}56	~~((444r   keep_egg_info)FTc                    d}|dz  j                  |d       |dz  }|j                          |rdgng }t        dd|g|d	|i t        t	        |j                  d
                  dk(  sJ t        t	        |j                  d
                  dk(  sJ t        |      }t        t	        |j                  d                  |k(  sJ t        t	        |j                  d                  dk(  sJ t        t	        |j                  d                  dk(  sJ t        t	        |j                  d                  dk(  sJ y )Nz [metadata]
name=proj
version=42
rI   r   r   __outz--keep-egg-inforJ   z--output-dirrK   rM   r   r   z
*.egg-infoz	*.__bkp__)r'   r&   r_   r:   rA   rV   int)r)   rW   rf   rX   outoptsexpected_egg_infos          r   test_output_dirzTestDistInfo.test_output_dirs   s   6	K	++FW+E 		&3!"KJtJJ4/01Q664m456!;;.4./04EEE4l345::4-./1444k234999r   N)__name__
__module____qualname__r   r   classmethodr   pytestfixturer0   r=   rG   r[   re   markparametrizerm   r   r   r   r   r      sv    	M 2 2 ^^ ,,
'
65( [[_m<: =:r   r   c                      e Zd ZdZ ed      Zg dZej                  j                  ddj                               ej                  j                  ddg      ej                  j                  de      d	                      Zy
)TestWheelCompatibilityzMake sure the .dist-info directory produced with the ``dist_info`` command
    is the same as the one produced by ``bdist_wheel``.
    ae  
    [metadata]
    name = {name}
    version = {version}

    [options]
    install_requires =
        foo>=12; sys_platform != "linux"

    [options.extras_require]
    test = pytest

    [options.entry_points]
    console_scripts =
        executable-name = my_package.module:function
    discover =
        myproj = my_package.other_module:function
    ))r   r   ).postz[egg_info]
tag_build = post
)rx   z[egg_info]
tag_build = .post
)rx   z)[egg_info]
tag_build = post
tag_date = 1
).devz[egg_info]
tag_build = .dev
)ry   z)[egg_info]
tag_build = .dev
tag_date = 1
)a1z[egg_info]
tag_build = .a1
)z+localz[egg_info]
tag_build = +local
ra   zmy-proj my_proj my.proj My.Projr;   z0.42.13)suffixcfgc                 j   | j                   j                  ||      |z   }dD ].  }||z  j                          ||z  dz  j                  |d       0 t	        d|dz         t        |j                  d	            }t        ||d
z         t        |j                  d            }	t	        d|dz         t        |j                  d            }
|
j                  |	j                  k(  sJ |
j                  j                  d| |       sJ dD ]!  }t        |
|z        t        |	|z        k(  r!J  y )N)ra   r;   )	dir_wheeldir_distrI   r   r   bdist_wheelr~   r]   zdir_wheel/dist/*.whlunpackzunpack/*.dist-inforJ   r   zdir_dist/*.dist-infozmy_proj-)r    zentry_points.txt)SETUPCFGr   r&   r'   r_   r`   rV   r   ra   rb   read)r)   ra   r;   rW   r{   r|   rX   iwheelwheel_dist_inforJ   files               r   &test_dist_info_is_the_same_as_in_wheelz=TestWheelCompatibility.test_dist_info_is_the_same_as_in_wheel   s/    %%4%ACG( 	NA\  "\K'33FW3M	N 	Mx+'=>X]]#9:;uh12x}}-ABCKX
%:;'=>?	~~!5!555~~((8G9VH)EFF2 	JD	D()T/D2H-III	Jr   N)rn   ro   rp   __doc__r   r   EGG_INFO_OPTSrr   rt   ru   splitr   r   r   r   rw   rw      s     	H*
M [[V%F%L%L%NO[[Y4[[.>J ? 5 PJr   rw   c                      t         j                  t         j                  dddd|}t        j                  ddgt        t        |       } t        j                  | fi |S )NTr   )stderrrU   textr	   rL   z-cz __import__('setuptools').setup())
subprocessSTDOUTPIPEsys
executablerB   r(   run)cmdr   rk   s      r   rR   rR      s^    ##// D >>4!C
Tc#sm
TC>>#&&&r   c                  ,    t        | i |j                  S r3   )rR   rU   )argsr   s     r   r_   r_      s    d-f-444r   )r   pathlibrN   rc   r   r   	functoolsr   rr   r8   setuptools.archive_utilr   textwrapr   Path	read_textr   r   rw   rR   r_   r   r   r   <module>r      s`    *  	   
    2 w||%%8m: m:`=J =J@
'5r   