
    h                        S 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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Jr  SSKJr  SSKrSSKJr  SSKrSSKJs  Jr  SSKJrJrJ r   SSK!J"r"  SS	K#J$r$  SS
KJ%r%  SSK&Jr  SSK'J(r(  SSK)J*r*  SSK+J,r,J-r-  SSK.J/r/  SSK0J1r1  SSK2r3\Rh                  " SS9S 5       r5 " S S5      r6\1" S5      r7 " S S5      r8\Rr                  Ru                  S5       " S S5      5       r;\Rh                  S 5       r<\Rr                  R{                  S5      \Rr                  R{                  S5       " S  S!5      5       5       r>\Rh                  S" 5       r?\Rr                  R{                  S#5       " S$ S%5      5       r@\Rh                  S& 5       rA " S' S(5      rB " S) S*5      rCS+ rDS, rES- rFS. rGS/S0\DSSS14S2 jrH\Rr                  R                  \
R                  R                  S35      =(       a    \R                  " \
R                  5      S4S59 " S6 S75      5       rN " S8 S95      rO " S: S;5      rP " S< S=\5      rQS> rR\Rr                  R                  \
R                  S?:H  S@S59SA 5       rTg)BzEasy install Tests    N)Path)
NamedTuple)mockpath)Distributionnormalize_pathworking_set)sandbox)
safer_name)PthDistributions)r   	run_setup)fail_on_ascii)
MockServerpath_to_url   )contexts)DALST)autousec                 (    U R                  SS5        g)z
Important: Disable the default index for pip to avoid
querying packages in the index and potentially resolving
and installing packages there.
PIP_NO_INDEXtrueN)setenv)monkeypatchs    Blib/python3.13/site-packages/setuptools/tests/test_easy_install.pypip_disable_indexr   *   s     ~v.    c                        \ rS rSrS rS rSrg)FakeDist4   c                     US:w  a  0 $ SS0$ )Nconsole_scriptsnameep )selfgroups     r   get_entry_mapFakeDist.get_entry_map5   s    %%I~r   c                     g)Nspecr&   r'   s    r   as_requirementFakeDist.as_requirement:   s    r   r&   N)__name__
__module____qualname____firstlineno__r)   r.   __static_attributes__r&   r   r   r    r    4   s    
r   r    z3
    from setuptools import setup

    setup()
    c                   :   \ rS rSrS rS rS rS rS r\	R                  S 5       r\S 5       r\	R                  S	 5       r\S
 5       r\	R                  S 5       r\	R"                  R%                  \R(                  R+                  S5      (       + SS9S 5       rSrg)TestEasyInstallTestG   c                    [         R                  R                  5       R                  5       R	                  5       n[        5       n[        [         R                  R                  U5      5      n[        R                  " US5      u  pEUR                  U5      (       d   eSU;   d   eSU;   d   eSU;   d   e[        R                  " SU[        R                  S9(       d   eg )N   z'spec'z'console_scripts'z'name'z^# EASY-INSTALL-ENTRY-SCRIPT)flags)eiCommandSpecbestfrom_environment	as_headerr    nextScriptWriterget_args	itertoolsislice
startswithresearch	MULTILINE)r'   headerdistargs_namescripts         r   test_get_script_args(TestEasyInstallTest.test_get_script_argsH   s    $$&779CCEzBOO,,T23!((q1  ((((6!!!"f,,,6!!!yy7r||TTTr   c                    [        5       n[        R                  " U5      nS Ul        SUl        SS/Ul        [        R                  R                  [        R                  " 5       S5      Ul        S/Ul        UR                  5         UR                  R                  0 :X  d   e[        R                  " U5      nS Ul        SS/Ul        [        R                  R                  [        R                  " 5       S5      Ul        S/Ul        UR                  5         [!        UR                  R                  R#                  5       5      nUSS/:X  d   eg )Nc                      gNTr&   r&   r   r   <lambda>8TestEasyInstallTest.test_no_find_links.<locals>.<lambda>X       4r   Tlink1link2okc                      grR   r&   r&   r   r   rS   rT   b   rU   r   )r   r;   easy_installcheck_pth_processingno_find_links
find_linksosr   jointempfilemkdtempinstall_dirrK   ensure_finalizedpackage_indexscanned_urlssortedkeys)r'   rJ   cmdrg   s       r   test_no_find_links&TestEasyInstallTest.test_no_find_linksS   s    ~ood##/  !7+'',,x'7'7'94@6  --333 ood##/ !7+'',,x'7'7'94@6c''4499;<))))r   c                 (   [        5       n[        R                  " U5      n[        R                  " 5       Ul        [        R                  " [        R                  R                  5         UR                  5         SSS5        g! , (       d  f       g= f)zC
Test that `cant_write_to_target` is rendered as a DistutilsError.
N)r   r;   rZ   r^   getcwdrb   pytestraises	distutilserrorsDistutilsErrorcant_write_to_target)r'   rJ   rh   s      r   test_write_exception(TestEasyInstallTest.test_write_exceptionj   sV     ~ood#))+]]9++::;$$& <;;s   )B
Bc                    ^ [        S5      mU4S jnUR                  [        SUSS9  T[        R                  " 5       ;   d   eg)zP
get_site_dirs should always return site dirs reported by
site.getsitepackages.
z/setuptools/test/site-packagesc                  
   > T /$ Nr&   r   s   r   mock_gsp8TestEasyInstallTest.test_all_site_dirs.<locals>.mock_gsp{   s
    6Mr   getsitepackagesFraisingN)r	   setattrsiter;   get_site_dirs)r'   r   rx   r   s      @r   test_all_site_dirs&TestEasyInstallTest.test_all_site_dirst   sF    
 >?	 	D"3XuMr''))))r   c                 f    UR                  [        SSS9  [        R                  " 5       (       d   eg )Nrz   Fr{   )delattrr~   r;   r   )r'   r   s     r   0test_all_site_dirs_works_without_getsitepackagesDTestEasyInstallTest.test_all_site_dirs_works_without_getsitepackages   s-    D"3UC!!!!r   c                     S[        S5      4SS/nSnX-  n[        R                  " [        U5      S5      nU H  u  pgUR	                  Xg5        M     UR                  5         [        U5      $ )Nsetup.pya5  
                    import setuptools
                    setuptools.setup(
                        name="setuptools-test-unicode",
                        version="1.0",
                        packages=["mypkg"],
                        include_package_data=True,
                    )
                    zmypkg/__init__.py )u   mypkg/☃.txtr   zsetuptools-test-unicode-1.0.zipw)r   zipfileZipFilestrwritestrcloser'   tmpdirfiles
sdist_namesdist	sdist_zipfilenamecontents           r   sdist_unicode!TestEasyInstallTest.sdist_unicode   s~     
'
0 7
# OOCJ4	!&Hx1 "'5zr   c                    [        SS/05      nUS-  R                  5       n[        R                  " U[	        U5      S/S9nUR                  [        R                  S[	        U5      5        UR                  5         UR                  U5        g)zY
The install command should execute correctly even if
the package has unicode filenames.
script_argsrZ   targetxrb   rK   
PYTHONPATHN	r   
ensure_dirr;   rZ   r   setitemr^   environrc   )r'   r   r   r   rJ   r   rh   s          r   test_unicode_filename_in_sdist2TestEasyInstallTest.test_unicode_filename_in_sdist   s|     ]^,<=>8#//1ooF

 	BJJc&kB'r   c                    S[        S5      4SS[        S5      4/nSnX-  n[        R                  " [        U5      S5      nU H%  u  pgUR	                  XgR                  S5      5        M'     UR                  5         [        U5      $ )	Nr   ar  
                    import setuptools
                    setuptools.setup(
                        name="setuptools-test-unicode",
                        version="1.0",
                        packages=["mypkg"],
                        include_package_data=True,
                        scripts=['mypkg/unicode_in_script'],
                    )
                    r   zmypkg/unicode_in_scriptu   
                    #!/bin/sh
                    # á

                    non_python_fn() {
                    }
                z&setuptools-test-unicode-script-1.0.zipr   utf-8)r   r   r   r   r   encoder   r   s           r   sdist_unicode_in_script+TestEasyInstallTest.sdist_unicode_in_script   s     	 &)#
< >
# OOCJ4	!&Hx)@A "'5zr   c                    [        SS/05      nUS-  R                  5       n[        R                  " U[	        U5      S/S9nUR                  [        R                  S[	        U5      5        UR                  5         UR                  U5        g)zZ
The install command should execute correctly even if
the package has unicode in scripts.
r   rZ   r   r   r   r   Nr   )r'   r   r   r   rJ   r   rh   s          r   test_unicode_content_in_sdist1TestEasyInstallTest.test_unicode_content_in_sdist   sv     ]^,<=>8#//1oodF3%HBJJc&kB01r   c                 n    S[        S5      4S[        S5      4/nSn[        X-  5      n[        XB5        U$ )Nr   a  
                    import setuptools
                    setuptools.setup(
                        name="setuptools-test-script",
                        version="1.0",
                        scripts=["mypkg_script"],
                    )
                    mypkg_scriptzg
                     #/usr/bin/python
                     print('mypkg_script')
                     zsetuptools-test-script-1.0.zip)r   r   
make_sdist)r'   r   r   r   r   s        r   sdist_script TestEasyInstallTest.sdist_script   sX     	 
0 6
F'(5 r   linuxzTest can only be run on Linuxreasonc                 P   [        SS/05      nUS-  R                  5       n[        R                  " U[	        U5      S/S9nUR                  [        R                  S[	        U5      5        UR                  5         UR                  U5        US-  R                  5       (       d   eg)	z
Check scripts are installed.
r   rZ   r   r   r   r   r   N)
r   r   r;   rZ   r   r   r^   r   rc   exists)r'   r   r   r   rJ   r   rh   s          r   test_script_install'TestEasyInstallTest.test_script_install  s     ]^,<=>8#//1ooF

 	BJJc&kB&'//1111r   r&   N)r0   r1   r2   r3   rN   ri   rs   r   r   rm   fixturer   r   r   r   r   r   markskipifsysplatformrE   r   r4   r&   r   r   r6   r6   G   s    	U*.'*" ^^! !F ( (  ^^' 'R 2 2 ^^ < [[LL##G,,5T  22r   r6   zignore:Unbuilt eggc                   &    \ rS rSrS rS rS rSrg)TestPTHFileWriteri&  c                     [        S[        R                  " 5       /5      nUR                  (       a   eUR	                  [        [        R                  " 5       5      5        UR                  (       d   eg)zRa pth file manager should set dirty
if a distribution is in site but also the cwd
does-not_existN)r   r^   rl   dirtyaddPRDistribution)r'   pths     r   !test_add_from_cwd_site_sets_dirty3TestPTHFileWriter.test_add_from_cwd_site_sets_dirty(  sH     /"))+?99}ryy{+,yyyr   c                     Sn[         R                  " U5      n[        SU/5      nUR                  (       a   eUR	                  [        U5      5        UR                  (       a   eg )Nz%/test/location/does-not-have-to-existr   )pkg_resourcesr	   r   r   r   r   )r'   locationr   s      r   test_add_from_site_is_ignored/TestPTHFileWriter.test_add_from_site_is_ignored1  sY    : //9
 99}x()99}9r   c                    UR                  S5      nUR                  5         [        UR                  S5      5      n[        U5      n[        U5      nUR                  UR                  s=:X  a  / :X  d   S5       e   S5       eUR                  S5      nUR                  5         [        U5      nUR                  R                  U5        UR                  5         UR                  (       d   S5       eXuR                  ;  d   S5       eUR                  5         XuR                  ;   d   S5       eUR                  S   U:X  d   S	5       e[        U5      R                  UR                  :X  d   S
5       eg)z
If the pth file is modified under the hood, then PthDistribution
will refresh its content before saving, merging contents when
necessary.

pth_subdirz	file1.pthz6unless there would be some default added at some point
src_subdirzEthe new_src_path added must still be present/valid in pth1 after savez:right before we save the entry should still not be presentzJthe new_src_path entry should have been added by pth2 with its save() callzVand it should match exactly on the last entry actually given we append to it in save()zXand we should have the exact same list at the end with a fresh PthDistributions instanceN)r_   mkdirr   r   pathsappendsave)r'   r   r   pth_pathpth1pth2new_src_pathnew_src_path_strs           r   *test_many_pth_distributions_merge_together<TestPTHFileWriter.test_many_pth_distributions_merge_together?  sc    [[.
z{34))zzTZZ-2- 	
D	
- 	
D	
-
 {{<0|,

*+		zz 	
S	
z  zz1 	
H	
1 			::- 	
X	
- zz"~- 	
.	
-
  )//4::= 	
5	
=r   r&   N)r0   r1   r2   r3   r   r   r   r4   r&   r   r   r   r   &  s    )
r   r   c              #      #    U S-  R                  SSS9 nUR                  [        5        S S S 5        U R                  5          U v   S S S 5        g ! , (       d  f       N,= f! , (       d  f       g = f7f)Nr   r   r   encoding)openwriteSETUP_PYas_cwd)r   fs     r   setup_contextr   k  sS     
:
	#	#C'	#	:a	 
;	 
 
;	:	s3   A4AA4A#		A4
A A4#
A1-A4user_overrider   c                      \ rS rSr\R
                  " S\R                  " 5       5      r\R
                  " S\R                  5      \R
                  " SS5      \S 5       5       5       r
\R
                  " SS5      \S 5       5       r\S	 5       rS
 r\R                   S 5       r\R                   S 5       rS r\R*                  S 5       rS rSrg)TestUserInstallTestis  z;setuptools.command.easy_install.easy_install.check_site_dirz(setuptools.command.easy_install.__file__site.ENABLE_USER_SITETc                 $    U R                  5         g rw   assert_not_user_siter-   s    r   /test_user_install_not_implied_user_site_enabledCTestUserInstallTest.test_user_install_not_implied_user_site_enabled  s     	!!#r   Fc                 $    U R                  5         g rw   r   r-   s    r   0test_user_install_not_implied_user_site_disabledDTestUserInstallTest.test_user_install_not_implied_user_site_disabled  s     	!!#r   c                      [        5       n SU l        [        R                  " U 5      nS/Ul        UR                  5         UR                  (       a   S5       eg )Nr   pyzuser should not be implied)r   script_namer;   rZ   rK   rc   user)rJ   rh   s     r   r   (TestUserInstallTest.assert_not_user_site  sJ     ~%ood#688999|8r   c                     [         R                  " S5        [        R                  " S5      n[        R                  " [        R
                  [        R                  S9  UR                  S5        g )Nmultiprocessingtest_easy_install)levelstreamzthis should not break)	rm   importorskiplogging	getLoggerbasicConfigINFOr   stderrinfo)r'   logs     r   test_multiproc_atexit)TestUserInstallTest.test_multiproc_atexit  sG    -. 34',,szzB()r   c                     US-  nUR                  S5       nUR                  S5        S S S 5        [        U5      $ ! , (       d  f       N= f)Nzfoo-1.0.egg-infor   z
Name: foo
)r   r   r   )r'   r   egg_filer   s       r   foo_packageTestUserInstallTest.foo_package  s?    ..]]31GGM"  6{  s	   <
A
c              #     #    [        U5      n[        R                  " S[        R                  U/-   5         [
        R                  R                  R                  [        R                  5      n[        R                  R                  [
        R                  US9   Uv   S S S 5        S S S 5        g ! , (       d  f       N= f! , (       d  f       g = f7f)Nzsys.pathr   )
r   r   patchr   r   r^   pathsepr_   dictr   )r'   r   r   python_paths       r   install_target"TestUserInstallTest.install_target  s}     VZZ
CHHx$78''//..sxx8KD E 98DD 98s5   5CA$CB1 C(	C1
B?	;C
CCc                    [        5       nSUl        [        R                  " U5      nX$l        S/Ul        UR                  5         UR                  R                  U/5        UR                  S5      n[        R                  R                  [        R                  R                  UR                  5      5      n[        R                  R                  [        R                  R                  U5      5      nXg:X  d   eg)zL
The local index must be used when easy_install locates installed
packages.
r   fooN)r   r   r;   rZ   rb   rK   rc   local_indexscanr^   r   normcaserealpathr   )r'   r  r  rJ   rh   resactualexpecteds           r   test_local_index$TestUserInstallTest.test_local_index  s    
 ~%ood#(7k]+u%!!"''"2"23<<"@A77##BGG$4$4[$AB!!!r   c              /      #    U R                   " U0 UD6   SSKJs  Jn  [        R
                  Ul        Sv   SSS5        g! , (       d  f       g= f7f)z_
Wrap sandbox.setup_context to patch easy_install in that context to
appear as user-installed.
r   N)orig_contextsetuptools.command.easy_installcommandrZ   r~   	USER_SITE__file__)r'   rK   kwargsr;   s       r   user_install_setup_context.TestUserInstallTest.user_install_setup_context  s9      //88..BK	 0//s   A#A	A
AAc                 n    [         R                  U l        [        R                  " SU R
                  5      $ )Nz setuptools.sandbox.setup_context)r   r   r  r   r  r$  r-   s    r   patched_setup_context)TestUserInstallTest.patched_setup_context  s-    #11zz.++
 	
r   )r  N)r0   r1   r2   r3   r   r  Mockprev_sp_writer~   r!  r   r   staticmethodr   r  rm   r   r  r  r  
contextlibcontextmanagerr$  r'  r4   r&   r   r   r   r   s  s     JJE		M 
ZZ:DNNK	ZZ'.$  / L$ 
ZZ'/$  0$ : :* ^^  ^^ "" 	 	
r   r   c               #   $  #    [         R                  SS5      n [        R                  " [        R
                  S9   [        SSSS9 nUR                  U 5        S S S 5        S v   S S S 5        g ! , (       d  f       N= f! , (       d  f       g = f7f)Nzfrom setuptools import setupz from distutils.core import setup)cdr   r   r   r   )r   replacer   tempdirr^   chdirr   r   )distutils_setup_pyr   s     r   distutils_packager4    sj     !))&* 
		RXX	&*cG4GG&' 5 
'	&44 
'	&s4   9BA?A.A?%	B.
A<	8A??
B	Br4  c                       \ rS rSrS rSrg)TestDistutilsPackagei  c                     [        SS/5        g )Nr   	bdist_eggr   r-   s    r   )test_bdist_egg_available_on_distutils_pkg>TestDistutilsPackage.test_bdist_egg_available_on_distutils_pkg  s    *{m,r   r&   N)r0   r1   r2   r3   r9  r4   r&   r   r   r6  r6    s    -r   r6  c                      [        5       n U R                  S:X  a  [        R                  " S5        U R	                  5         U $ )Nr   zcould not find a valid port)r   server_portrm   skipstart)p_indexs    r   
mock_indexr@    s6     lGa 	12MMONr   c                        \ rS rSrS rS rSrg)TestInstallRequiresi  c                    US-  nUR                  SS9  US-  nUR                  SS9  U R                  U5        [        R                  SSSS[	        U5      S[	        U5      S	[	        U5      S
[	        U5      S[	        U5      S[	        U5      S[	        U5      /n0 [
        R                  ESUR                  0En[        R                  " U[	        U5      U[        R                  [        R                  SSS9nUR                  S:w  d   e SUR                   Vs1 s H  oR                  iM     sn;   d   e[        S UR                   R#                  5        5       5      (       d   egs  snf ! [$         aE    SUR                   ;   a3  [&        R(                  " [        R*                   SUR                    35        e f = f)zf
When ``python setup.py install`` is called directly, it will use easy_install
to fetch dependencies.
projectT)exist_okinstall-c __import__("setuptools").setup()z--install-basez--install-libz--install-headersz--install-scriptsz--install-dataz--install-purelibz--install-platlib__EASYINSTALL_INDEXr   )cwdenvstdoutr  textr   r   /does-not-exist/c              3   F   #    U  H  nS U;   d  M  SU;   d  M  Uv   M     g7f)z"not find suitable distribution forzdoes-not-existNr&   ).0lines     r   	<genexpr>OTestInstallRequires.test_setup_install_includes_dependencies.<locals>.<genexpr>  s0      2D74?  %, 2s   
!!	!zfailed to get random numbersz failure - N)r   create_projectr   
executabler   r^   r   url
subprocessrunPIPESTDOUT
returncoderequestsr   r@   rL  
splitlines	Exceptionrm   xfailr   )	r'   tmp_pathr@  project_rootinstall_rootrh   rK  cprs	            r   (test_setup_install_includes_dependencies<TestInstallRequires.test_setup_install_includes_dependencies  s     )+D))+D)L)NN.%
( DC2JNNC^^L!??$$
 }}!!!	%*:M:M)N:MQ&&:M)NNNN II002     *O  	-:~[DE	s   E0 E+19E0 +E0 0AF?c                 f    SnUS-  R                  [        U5      SS9  US-  R                  5         g )Nz
        [metadata]
        name = project
        version = 42

        [options]
        install_requires = does-not-exist
        py_modules = mod
        	setup.cfgr   r   zmod.py)
write_textr   touch)r'   rootconfigs      r   rT  "TestInstallRequires.create_project'  s7     
	''Vw'G	!r   r&   N)r0   r1   r2   r3   re  rT  r4   r&   r   r   rB  rB    s    6p"r   rB  c                      \ rS rSrS r\\R                  S 5       5       rSr	\
R                  R                  S\	5      S 5       r\
R                  R                  S\	5      S 5       r\
R                  R                  S\	5      S 5       rS	 rS
 rS rS r\
R                  R                  SS5      S 5       rS rS rSrg)TestSetupRequiresi5  c                    UR                  SS5        UR                  SS5        UR                  SS5        [        R                  " 5          [        R	                  5        n[        R
                  " 5        n[        R                  " US9   [        R                  SSS	S
UR                  SSUU/
n[        R                  " U5      R                  5         SSS5        SSS5        SSS5        SSS5        UR                   Vs/ s H  ofR                  PM     snS/:X  d   eg! , (       d  f       NT= f! , (       d  f       N]= f! , (       d  f       Nf= f! , (       d  f       No= fs  snf )z
When easy_install installs a source distribution which specifies
setup_requires, it should honor the fetch parameters (such as
index-url, and find-links).
PIP_RETRIES0PIP_TIMEOUTr   falser  rG  rH  rZ   z--index-urlz--exclude-scriptsz--install-dirNrN  )r   r   quietro  create_sdistr1  environmentr   rU  rV  rW  Popenwaitr\  r   )r'   r@  r   	dist_filetemp_install_dirrh   rd  s          r   'test_setup_requires_honors_fetch_params9TestSetupRequires.test_setup_requires_honors_fetch_params6  s    	=#.=#.>73^^"//1Y%%'+;!--9IJNN >*)&NN/+,% #((-224 K ( 2 & !+ 3 34 31 349K8LLLL KJ (' 21 & 5s[   E!E7D4A	D#	D4E%EE'#
D1-D44
E>E
E	E
E$c               #      #    [         R                  " 5        n [        R                  R	                  U S5      n[        US[        S5      4S/5        Uv   SSS5        g! , (       d  f       g= f7f)zT
Return an sdist with a setup_requires dependency (of something that
doesn't exist)
z"setuptools-test-fetcher-1.0.tar.gzr   a  
                    import setuptools
                    setuptools.setup(
                        name="setuptools-test-fetcher",
                        version="1.0",
                        setup_requires = ['does-not-exist'],
                    )
                rh  r   N)r   r1  r^   r   r_   r   r   )dir	dist_paths     r   rv  TestSetupRequires.create_sdistT  sh      3S*NOI #	 && O+  s   A0>A	A0
A-)A0)r&   dependency_linkssetup_requires)r  r  use_setup_cfgc                 F   [        SSSS9n[        R                  " U5        [        R                  " 5          [        R
                  " 5        n[        X1S9n[        R                  R                  US5      n[        R                  " 5        u  pg[        US/5        SSS5        WR                  5       n[        U5      S	:  d   eUS
   R                  5       S:X  d   e SSS5        SSS5        g! , (       d  f       NZ= f! , (       d  f       N(= f! , (       d  f       g= f)a  
Regression test for distribution issue 323:
https://bitbucket.org/tarek/distribute/issues/323

Ensures that a distribution's setup_requires requirements can still be
installed and used locally even if a conflicting version of that
requirement is already on the path.
zdoes-not-matterfoobar0.0project_nameversionr  r   --nameNr   r   test_pkg)r   r
   r   r   save_pkg_resources_stater1  create_setup_requires_packager^   r   r_   ru  r   	readlineslenstrip)	r'   r  	fake_disttemp_dirr  test_setup_pyrL  _stderrliness	            r   .test_setup_requires_overrides_version_conflict@TestSetupRequires.test_setup_requires_overrides_version_conflicty  s     #He
	 		"..0!!#x8 !#Xz B^^%):& mhZ8 &
 ((*5zA~%~Ry(J666 $ 10 &% $# 10s<   D?DC0ADD0
C>:D
D	D
D c                    [         R                  " 5          [         R                  " 5        n[        R                  R                  US5      n[        USS5        [        R                  R                  US5      n[        R                  " U5        [        R                  " U5       nS Ul
        UR                  U5        SSS5        [        R                  R                  SU5        [        USSS9n[        R                   " U5        [#        S	5      n[%        USS
[        UUS9n[        R                  R                  US5      n	[         R&                  " 5        u  p [)        U	S/5        SSS5        SW
R3                  5       ;  d   eU
R5                  5       n[7        U5      S:  d   eUS   R9                  5       S:X  d   e SSS5        SSS5        g! , (       d  f       GN= f! [*        R,                   a    [.        R0                  " S5         Nf = f! , (       d  f       N= f! , (       d  f       Nj= f! , (       d  f       g= f)z
Like ``test_setup_requires_overrides_version_conflict`` but where the
``setup_requires`` package is part of a namespace package that has
*already* been imported.
zfoo_bar-0.1.tar.gzzfoo.bar0.1zfoo_bar-0.1c                     U $ rw   r&   )memberr   s     r   rS   FTestSetupRequires.test_setup_requires_override_nspkg.<locals>.<lambda>  s    r   Nr   r  a                      import foo  # Even with foo imported first the
                                # setup_requires package should override
                    import setuptools
                    setuptools.setup(**%r)

                    if not (hasattr(foo, '__path__') and
                            len(foo.__path__) == 2):
                        print('FAIL')

                    if 'foo_bar-0.2' not in foo.__path__[0]:
                        print('FAIL')
                z0.2r  r   r  z9Installing setup.py requirements caused a VersionConflictFAILr   r   r  )r   r  r1  r^   r   r_   make_nspkg_sdistr   tarfiler   extraction_filter
extractallr   insertr   r
   r   r   r  ru  r   r   VersionConflictrm   failgetvaluer  r  r  )r'   r  r  foobar_1_archivefoobar_1_dirtfrJ   templater  r  rL  r  r  s                r   "test_setup_requires_override_nspkg4TestSetupRequires.test_setup_requires_override_nspkg  s    ..0!!#x#%77<<:N#O  !19eD  "ww||HmD&\\"23r+FB(MM,/ 4 <0% y% %  9$"/ !#Xz B^^%):& "-(<	 & V__%6666((*5zA~%~Ry(J666s $ 10 43T )88 W &%Y $# 10ss   H:A:H)&G BH)HG(,AH)H:
G% H)(*H	HH	H
H&"H))
H7	3H::
Ic           	      $   S n[         R                  " 5          [         R                  " 5        n[        U[	        SS9UUS-   S9n[
        R                  R                  US5      n[         R                  " 5        u  pg[        US/5        S S S 5        WR                  5       n[        U5      S:  d   eUS   R                  5       S	:X  d   e S S S 5        S S S 5        g ! , (       d  f       NZ= f! , (       d  f       N(= f! , (       d  f       g = f)
Nc           
      n    S[        SU< SU< SU< S35      4US-   [        S5      4/n[        X5        g )Nr   zj
                    import setuptools
                    setuptools.setup(
                        name=z",
                        version=z&,
                        py_modules=[z-],
                    )
                    z.pyz6
                    version = 42
                    )r   r   )r  distnamer  r   s       r   make_dependency_sdistVTestSetupRequires.test_setup_requires_with_attr_version.<locals>.make_dependency_sdist  sk      '\ *!!( ,%%-L 1	 u$E. y(r   zattr: foobar.version)r  )setup_attrsmake_packager  r   	--versionr   r   42)r   r  r1  r  r  r^   r   r_   ru  r   r  r  r  )	r'   r  r  r  r  r  rL  r  r  s	            r   %test_setup_requires_with_attr_version7TestSetupRequires.test_setup_requires_with_attr_version  s    	)4 ..0!!#x8 $-C D!6"/,">	 !#Xz B^^%):&mk]; &((*5zA~%~Ry(D000 $ 10 &% $# 10s<   DAC0;CAC0D
C-)C00
C>	:D
Dc                    UR                  SS5        UR                  SS5        UR                  SS5        UR                  SUR                  5        [        R                  " 5          [        R                  " 5        n[        USS[        / S	9S
9n[        R                  R                  US5      n[        USSS9 nUR                  [        S5      5        S S S 5        [        R                  R                  US5      n[        R                  " [        R                   R"                  5         [%        US/5        S S S 5        S S S 5        S S S 5        ['        UR(                  5      S:X  d   eUR(                  S   R                  S:X  d   eg ! , (       d  f       N= f! , (       d  f       Nj= f! , (       d  f       Ns= f! , (       d  f       N|= f)Nrq  rr  rs  r   rt  PIP_INDEX_URLpython-xlib0.19r  r  rh  r   r   r   z}
                        [easy_install]
                        index_url = https://pypi.org/legacy/
                        r   r  r   r   z/python-xlib/)r   rV  r   r  r1  r  r  r^   r   r_   r   r   r   rm   rn   ro   rp   rq   r   r  r\  )r'   r@  r   r  r  test_setup_cfgfpr  s           r   "test_setup_requires_honors_pip_env4TestSetupRequires.test_setup_requires_honors_pip_env  sh   =#.=#.>73?JNN;..0!!#x8! $b 9	 "$h!D.#@BHH A !#Xz B]]9#3#3#B#BCmk]; D% $ 1* :&&'1,,,""1%**o=== A@ DC% $# 10sU   (G>?F1=FAF1.F <F1G
FF1 
F.*F11
F?	;G
Gc                 j   UR                  SS5        UR                  SS5        UR                  SUR                  5        [        R                  " 5          [        R                  " 5        n[
        R                  R                  US5      n[        USS5        [        USS	9n[        US
S[        SU 3S9S9n[
        R                  R                  US5      n[        US/5        S S S 5        S S S 5        [        UR                  5      S:X  d   eg ! , (       d  f       N2= f! , (       d  f       N;= f)Nrq  rr  rs  r  z
dep.tar.gz
dependencyr  	localhost)	authorityr  r  zdependency @ r  r  r   r  r   )r   rV  r   r  r1  r^   r   r_   make_trivial_sdistr   r  r  r   r  r\  )r'   r@  r   r  	dep_sdistdep_urlr  r  s           r   #test_setup_requires_with_pep508_url5TestSetupRequires.test_setup_requires_with_pep508_url$  s    =#.=#.?JNN;..0!!#xGGLL<@	"9lDA%i;G8! $mG94M N !#Xz B-+7 $ 1 :&&'1,,, $# 10s%   D$,A;D'D$
D!	D$$
D2c           	      <   S[        S5      [        S5      S.0n[        R                  " 5          [        R                  " 5        n[        R
                  " X#S9  [        [        R                  " USS5      5      n[        R                  " [        R                  R                  5         [        US/5        SSS5        SSS5        SSS5        [        UR                   5      S	:X  d   eg! , (       d  f       N:= f! , (       d  f       NC= f! , (       d  f       NL= f)
z2The `allow-hosts` option in not supported anymore.r  z~
                    from setuptools import setup
                    setup(setup_requires='python-xlib')
                    z\
                    [easy_install]
                    allow_hosts = *
                    r   rh  prefixr   r  Nr   )r   r   r  r1  r   buildr   pathlibr   rm   rn   ro   rp   rq   r   r  r\  )r'   r@  r   r  setup_pys        r   $test_setup_requires_with_allow_hosts6TestSetupRequires.test_setup_requires_with_allow_hosts8  s       "
  ..0!!#x

52w||Hj*MN]]9#3#3#B#BCh6 D $ 1 :&&'1,,, DC $# 10s<   DA$C<)C+7C<?D+
C95C<<
D
	D
Dc                    UR                  SS5        UR                  SS5        UR                  SS5        UR                  SS5        Sn[        [        X#-  5      5      nSn[        [        X#-  5      S	S
U5        Sn[        [        X&-  5      5      nS[        R
                  R                   S[        R
                  R                   S3n[        [        X&-  5      S	SU5        US-  n	U	R                  [        S5      R                  UUUUUUS9S5        [        [        U	5      5      n
[        R                  " 5          [        [        U5      SS[        S	U
/S9S9n[        R                   R#                  US5      n[%        US/5        SSS5        ['        [)        [        [*        R,                  " [        R                   R#                  WS5      5      5      5      nUS/:X  d   eg! , (       d  f       Nc= f)z#Check `python_requires` is honored.rq  rr  rs  r   1PIP_VERBOSEzdep-1.0.tar.gzz>=2.7dep1.0zdep-2.0.tar.gzz!=.z.*z2.0z
index.htmla  
            <!DOCTYPE html>
            <html><head><title>Links for dep</title></head>
            <body>
                <h1>Links for dep</h1>
                <a href="{dep_1_0_url}"data-requires-python="{dep_1_0_python_requires}">{dep_1_0_sdist}</a><br/>
                <a href="{dep_2_0_url}"data-requires-python="{dep_2_0_python_requires}">{dep_2_0_sdist}</a><br/>
            </body>
            </html>
            )dep_1_0_urldep_1_0_sdistdep_1_0_python_requiresdep_2_0_urldep_2_0_sdistdep_2_0_python_requiresr   r  r  )r  r  r  r   r  Nz.eggszdep 1.0)r   r   r   make_python_requires_sdistr   version_infomajorminorri  r   formatr   r  r  r  r^   r   r_   r   listmapr   find_distributions)r'   r   r   r  r  r  r  r  r  index	index_urlr  r  eggss                 r   (test_setup_requires_with_python_requires:TestSetupRequires.test_setup_requires_with_python_requiresR  s   =#.=#.>3/=#.(!#f&<"=>")"&'7N	
 )!#f&<"=>!!''(#*:*:*@*@)AD 	  	#&'7N	
 % f'+(?'+(?   -	
0  E
+	..04F T	H GGLL:>Mmk]3 1 ]55bggll8W6UVW
 	{""" 10s   AG**
G8!with_dependency_links_in_setup_py)FTc                 (   UR                  SS5        UR                  SS5        [        R                  " 5          [        R                  " 5        n[	        [
        R                  R                  US5      SS5        [
        R                  R                  US5      n[
        R                  R                  US5      n[
        R                  R                  US	5      n[
        R                  " U5        [        US
SS9 nU(       a"  [
        R                  R                  US5      /nO/ nUR                  [        S5      R                  US95        S S S 5        [        US
SS9 nUR                  [        S5      R                  [
        R                  R                  US5      US95        S S S 5        [        US/5        S S S 5        S S S 5        g ! , (       d  f       N= f! , (       d  f       N== f! , (       d  f       N9= f! , (       d  f       g = f)Nrq  rr  rs  zpython-xlib-42.tar.gzr  r  r  r   rh  r   r   r   linksz
                        from setuptools import installer, setup
                        setup(setup_requires='python-xlib==42',
                        dependency_links={dependency_links!r})
                        r  z
                        [easy_install]
                        index_url = {index_url}
                        find_links = {find_links}
                        r  )r  r]   r  )r   r   r  r1  r  r^   r   r_   r   r   r   r   r  r   )	r'   r   r  r  r  r  r  r  r  s	            r   0test_setup_requires_with_find_links_in_setup_cfgBTestSetupRequires.test_setup_requires_with_find_links_in_setup_cfg  s    	=#.=#...0!!#x"GGLL+BC]TX 77<<*= "Xz B!#h!D"-w?28,.GGLL7,K+L(+-(HH !&2B&C @ .#@BHH !&&(ggll8W&E'/ !  A -+7G $ 10 @? A@- $# 10sV   HB-G2=AGG2#AG!*G2?H
GG2!
G/+G22
H 	<H
Hc                 ,   [         R                  " 5          [         R                  " 5        n[        [        R
                  R                  US5      SS5        [        R
                  R                  US5      n[        R                  " U5        [
        R                  " [        S5      SS.US9  [        [        R
                  R                  US	5      S
/5        [        R                  " U5        [        R
                  R                  US5      n[        R
                  R                  US	5      n[        R                  " U5        [        USSS9 nUR                  [        S5      5        SSS5        UR                  S[!        U5      5        UR                  SS5        UR                  SS5        UR                  SS5        [        US/5        SSS5        SSS5        g! , (       d  f       N}= f! , (       d  f       N(= f! , (       d  f       g= f)z
Use case: installing a package with a build dependency on
an already installed `dep[extra]`, which in turn depends
on `extra_dep` (whose is not already installed).
extra_dep-1.0.tar.gz	extra_depr  r  a  
                          import setuptools
                          setuptools.setup(
                              name='dep', version='2.0',
                              extras_require={'extra': ['extra_dep']},
                          )
                         r   r  r  r   	dist_infor  r   r   r   
                        from setuptools import installer, setup
                        setup(setup_requires='dep[extra]')
                        NPIP_FIND_LINKSr   r  rq  rr  rs  r  )r   r  r1  r  r^   r   r_   r   r  r   r   r
   	add_entryr   r   r   r   r'   r   r  dep_pkgr  r  r  s          r   4test_setup_requires_with_transitive_extra_dependencyFTestSetupRequires.test_setup_requires_with_transitive_extra_dependency  s    ..0!!#x"GGLL+ABKQV '',,x7!

$(% &( #  "'',,w
;k]K%%g.77<<*= "Xz B"-w?2HH @ ""#3S]C"">37""=#6""=#6-+7Y $ 10> @?= $# 10s<   HD%G4G#,A&G4H#
G1-G44
H	>H
Hc           	      Z   [         R                  " 5          [         R                  " 5        n[        [        R
                  R                  US5      S[        S5      4SS/5        [        R
                  R                  US5      n[        R                  " U5        [
        R                  " [        S5      S[        S	5      S
.US9  [        [        R
                  R                  US5      S/5        [        R                  " U5        [        R
                  R                  US5      n[        R
                  R                  US5      n[        R                  " U5        [        USSS9 nUR                  [        S5      5        SSS5        UR                  S[!        U5      5        UR                  SS5        UR                  SS5        UR                  SS5        [        US/5        SSS5        SSS5        g! , (       d  f       N}= f! , (       d  f       N(= f! , (       d  f       g= f)zS
Use case: ensure build requirements' extras
are properly installed and activated.
r  r   a$  
                          import setuptools
                          setuptools.setup(
                              name='extra_dep',
                              version='1.0',
                              py_modules=['extra_dep'],
                          )
                          r  )zextra_dep.pyr   epdepa(  
                          import setuptools
                          setuptools.setup(
                              name='dep', version='2.0',
                              py_modules=['epcmd'],
                              extras_require={'extra': ['extra_dep']},
                              entry_points='''
                                           [distutils.commands]
                                           epcmd = epcmd:epcmd [extra]
                                           ''',
                          )
                         r   a  
                                     from distutils.command.build_py import build_py

                                     import extra_dep

                                     class epcmd(build_py):
                                         pass
                                     )r   rh  zepcmd.pyr  r  r  r   r   r   r  Nr  r   r  rq  rr  rs  epcmd)r   r  r1  r   r^   r   r_   r   r   r  r   r
   r  r   r   r   r   r  s          r   .test_setup_requires_with_distutils_command_dep@TestSetupRequires.test_setup_requires_with_distutils_command_dep  s   
 ..0!!#xGGLL+AB ' !	 *,* '',,x9!

$(% &($()	%!6 #9> "'',,w
;k]K%%g.77<<*= "Xz B"-w?2HH @ ""#3S]C"">37""=#6""=#6-'3Y $ 10~ @?} $# 10s<   HD<H(G:A&H)H:
HH
H	H
H*r&   N)r0   r1   r2   r3   r|  r+  r,  r-  rv  r  rm   r   parametrizer  r  r  r  r  r  r  r  r  r  r4   r&   r   r   ro  ro  5  s    M<   8M [[_m<7 =7< [[_m<A7 =A7F [[_m<(1 =(1T>:-(-4:#x [[@-P)8 Q)8V38jR4r   ro  c                 H    [        U S[        SU< SU< S35      4S/5        g)zP
Create a simple sdist tarball at dist_path, containing just a simple
setup.py.
r   zT             import setuptools
             setuptools.setup(
                 name=z,
                 version=z
             )
         r  N)r   r   )r  r  r  s      r   r  r  D  sK        l #! %
	 	
r   c                    SU;   d   eUR                  S5      nUS   n[        S[        U5      S-   5       Vs/ s H  nSR                  USU 5      PM     nn[	        SU< SU< SU< SU< S	3	5      nS
nSU4[
        R                  R                  US5      U4/n	USS  HF  n
[
        R                  R                  " U
R                  S5      S/-   6 nU	R                  US45        MH     [        X	5        gs  snf )z
Make an sdist tarball with distname and version which also contains one
package with the same name as distname.  The top-level package is
designated a namespace package).
r  r   r   NzE        import setuptools
        setuptools.setup(
            name=z,
            version=z,
            packages=z",
            namespace_packages=[z]
        )
    z7__import__('pkg_resources').declare_namespace(__name__)r   z__init__.pyr   )	splitranger  r_   r   r^   r   r   r   )r  r  r  parts	nspackageidxpackagesr  initr   packager   s               r   r  r  ^  s    (??NN3EaI16q#e*q.1IJ1I#t%1IHJ  K  \ "!!* .	
H ED(#bggll9m&Ld%STEAB<77<<'--"4"FHh^$   y + Ks   C8c           
      R    [        U S[        S5      R                  XUS94S/5        g )Nr   z                import setuptools
                setuptools.setup(
                  name={name!r},
                  version={version!r},
                  python_requires={python_requires!r},
                )
                )r$   r  python_requiresr  )r   r   r  )r  r  r  r  s       r   r  r    sD     	 &!O   !	
r   c                    [        U5      S:  d   e[        R                  " U S5       nU H  u  p4[        R                  " UR                  S5      5      n[        R                  " US9n[        UR                  5       5      Ul        [        [        R                  " 5       5      Ul        UR                  XeS9  M     SSS5        g! , (       d  f       g= f)zy
Create a simple sdist tarball at dist_path, containing the files
listed in ``files`` as ``(filename, content)`` tuples.
r   zw:gzr   )r$   )fileobjN)r  r  r   ioBytesIOr   TarInfor  sizeinttimemtimeaddfile)r  r   rJ   r   r   
file_bytes	file_infos          r   r   r     s     u:>>	i	(D!&HGNN7$;<JX6I !4!4!67IN!$))+.IOLLL7 "' 
)	(	(s   BC
Cr  r  r&   c                 N   [        U5      nSSU SU 3/[        R                  R                  U 5      /S.nU(       a  UR	                  U5        [        R                  R                  U S5      n	[        R                  " U	5        U(       a  / n
/ nU Ho  nUR                  U5      nUSR                  5       ;   a  UnOU
n[        U[        [        45      (       a  SR                  U5      nUR                  U SU 35        Mq     [        S5      R                  S	R                  U
5      S	R                  U5      S
9nOSn[        [        R                  R                  U	S5      SSS9 nUR!                  U5        SSS5        Uc  [        S5      n[        [        R                  R                  U	S5      SSS9 nUR!                  XH-  5        SSS5        [        R                  R                  X SU S35      nU" UX5        U	$ ! , (       d  f       N= f! , (       d  f       NO= f)a  Creates a source tree under path for a trivial test package that has a
single requirement in setup_requires--a tarball for that requirement is
also created and added to the dependency_links argument.

``distname`` and ``version`` refer to the name/version of the package that
the test package requires via ``setup_requires``.  The name of the test
package itself is just 'test_pkg'.
r  r  z==)r$   r  r  r  zname version;z: zg
            [metadata]
            {metadata}
            [options]
            {options}
            
)optionsmetadatar   rh  r   r   r   NzI            import setuptools
            setuptools.setup(**%r)
        r   -z.tar.gz)r   r^   r   abspathupdater_   r   popr  
isinstancetupler  r   r   r  r   r   )r   r  r  r  setup_py_templater  r  normalized_distnametest_setup_attrsr  r!  r"  r$   valuesectiontest_setup_cfg_contentsr   foobar_paths                     r   r  r    s   $ %X.12"WI>?WW__T23	 ,ww||D*-HHHX !D$((.E~++--"!%%//NNdV2eW-. " #'#
 &IIg&YYx(  
 	  #%	bggll8[13	IQ	'( 
J   
 
bggll8Z0#	HA	!45 
I '',,t'<AgYg%NOKh0O# 
J	I 
I	Hs   (H9H
H
H$javaz0Test cannot run under java when executable is shr   c                   4    \ rS rSrSrSrS rS rS rS r	Sr
g	)
TestScriptHeaderi  u   /Users/José/bin/pythonz$C:\Program Files\Python36\python.exec                     S[         R                  " [        R                  R	                  [
        R                  5      5       S3n[         R                  R                  S5      nX!:X  d   eg )N#!r   z#!/usr/local/bin/python	r;   nt_quote_argr^   r   normpathr   rU  rA   
get_headerr'   r  r  s      r   test_get_script_header'TestScriptHeader.test_get_script_header   sN    (8(8(HIJ"M++,EF!!!r   c                     S[         R                  " [        R                  R	                  [
        R                  5      5       S3n[         R                  R                  S5      nX!:X  d   eg )Nr4   -x
z#!/usr/bin/python -xr5  r9  s      r   test_get_script_header_args,TestScriptHeader.test_get_script_header_args  sN    (8(8(HIJ%P++,BC!!!r   c                     [         R                  R                  SU R                  S9nSU R                   S3nX:X  d   eg )N#!/usr/bin/pythonrU  r4  r=  )r;   rA   r8  non_ascii_exer'   r  r  s      r   $test_get_script_header_non_ascii_exe5TestScriptHeader.test_get_script_header_non_ascii_exe
  sI    ++D,>,> , 
 **+51!!!r   c                     [         R                  R                  SSU R                  -   S-   S9nSU R                   S3nX:X  d   eg )NrA  "rB  #!"z"
)r;   rA   r8  exe_with_spacesrD  s      r   &test_get_script_header_exe_with_spaces7TestScriptHeader.test_get_script_header_exe_with_spaces  sS    ++C$2F2F,F,L , 
 --.c2!!!r   r&   N)r0   r1   r2   r3   rC  rJ  r:  r>  rE  rK  r4   r&   r   r   r2  r2    s"    
 .M=O"
"
""r   r2  c                       \ rS rSrS rS r\R                  " S\R                  5      \R                  R                  \R                  5      S 5       5       rS rS
S jrS	rg)TestCommandSpeci  c                 `    [         R                  " SS/5      nUR                  5       S:X  d   eg)z`
Show how a custom CommandSpec could be used to specify a #! executable
which takes parameters.
z/usr/bin/envpython3z#!/usr/bin/env python3
N)r;   r<   r?   r'   rh   s     r   test_custom_launch_command*TestCommandSpec.test_custom_launch_command  s,    
 nnni89}}"<<<<r   c                 |    [         R                  " S/5      n[         R                  R                  U5      nXL d   eg)z7
from_param should return an instance of a CommandSpec
pythonN)r;   r<   
from_param)r'   rh   cmd_news      r   .test_from_param_for_CommandSpec_is_passthrough>TestCommandSpec.test_from_param_for_CommandSpec_is_passthrough"  s2     nnhZ(..++C0~~r   zsys.executablec                     [         R                  R                  SS 5        [        R                  R                  5       n[        U5      S:X  d   eUR                  5       R                  S5      (       d   eg )N__PYVENV_LAUNCHER__r   rI  )	r^   r   r&  r;   r<   r>   r  r?   rE   rQ  s     r   /test_from_environment_with_spaces_in_executable?TestCommandSpec.test_from_environment_with_spaces_in_executable*  sV     	

,d3nn--/3x1}}}}))%0000r   c                     [         R                  R                  S5      n[        U5      S:X  d   eSUR	                  5       ;  d   eg)zn
In order to support `executable = /usr/bin/env my-python`, make sure
from_param invokes shlex on that input.
z/usr/bin/env my-pythonr9   rH  N)r;   r<   rV  r  r?   rQ  s     r   "test_from_simple_string_uses_shlex2TestCommandSpec.test_from_simple_string_uses_shlex2  s=    
 nn''(@A3x1}}#--/)))r   Nc                    [         R                  " [        5       n[        R                  R                  [        5       5        SSS5        [        WR                  5      S:X  d   UR                  5       eg! , (       d  f       N9= f)zS
from_param should raise its own TypeError when the argument's type is unsupported
Nz1Argument has an unsupported type <class 'object'>)	rm   rn   	TypeErrorr;   r<   rV  objectr   r,  )r'   exc_infos     r   %test_from_param_raises_expected_error5TestCommandSpec.test_from_param_raises_expected_error;  s\     ]]9%NN%%fh/ & #VV	>>	V &%s   (A66
Br&   )returnN)r0   r1   r2   r3   rR  rX  r   r  r2  rJ  r  r^   r   r\  r_  re  r4   r&   r   r   rN  rN    sW    = 
ZZ "2"B"BC	ZZ__RZZ 1 ! D1*r   rN  c                       \ rS rSrS rSrg)TestWindowsScriptWriteriF  c                    [         R                  R                  S5      nUR                  S5      (       d   eUR	                  S5      (       d   eUR                  S5      nUR                  S5      nUR                  S5      (       a   eg )Nr   r4  r   z\")r;   WindowsScriptWriterr8  rE   endswithlstriprstrip)r'   hdrs     r   test_header#TestWindowsScriptWriter.test_headerG  sv    $$//3~~d####||D!!!!jjjj>>%(((((r   r&   N)r0   r1   r2   r3   rp  r4   r&   r   r   ri  ri  F  s    )r   ri  c                   H    \ rS rSr% \\S'   \\S'   \\S'   \\S'   \\S'   Srg)	VersionStubiQ  r  r  microreleaselevelserialr&   N)r0   r1   r2   r3   r  __annotations__r   r4   r&   r   r   rs  rs  Q  s    JJJKr   rs  c           	          [        5       nUR                  S5      nS/Ul        SUl        SUl        [        U 5      Ul        S Ul        UR                  S5      n[        U 5      Ul        S Ul        UR                  5        n[        R                  " 5          [        R                  " S5        Sn[        SS	S
SS5      nUR                  SS5        UR                  SU5        UR                  SU5        UR                  US[        R                  " 5       5        UR!                  5         S S S 5        S S S 5        [#        [$        S5      (       a  SOSn	UR&                  R)                  5       n
[*        R,                  " U	S-   U
5      (       a!  [*        R,                  " U	S-   U
5      (       d   eUR.                  S   S:X  d   eUR.                  S   S:X  d   eUR.                  S   S:X  d   eg ! , (       d  f       N= f! , (       d  f       N= f)NrZ   rX   r   TrF  ignorez:3.10.1 (main, Dec 21 2021, 09:17:12) [GCC 10.2.1 20210110]   
   r   finalr   zsys.versionzsys.version_infocreate_home_pathpypy_version_infopypyrU  z3\.?1z3\.?1\d
py_versionz3.10.1py_version_shortz3.10py_version_nodot310)r   get_command_objrK   optimizer   r   install_userbaseinstall_usersitecontextwarningscatch_warningssimplefilterrs  r}   r   r)  finalize_optionshasattrr   rb   lowerrF   rG   config_vars)r   
tmpdir_cwdr   rJ   rh   install_cmdr  r  r  r$   rb   s              r   &test_use_correct_python_version_stringr  Y  s    >D


~
.CvCHCLCHv;CC&&y1K#&v;K #'K 				%)@)@)Bh'N1b!Wa0-t4mW-($/c-tyy{; *C	 S"5666HD//'')K 
yy+..yy
*K8888
 ??<(H444??-.&888??-.%7779 *C)B		s%   G?BG.+G?.
G<	8G??
HdarwinzDhttps://github.com/pypa/setuptools/pull/4716#issuecomment-2447624418c                 b   UR                  SS5        UR                  S[        US-  5      5        UR                  S[        US-  5      5        UR                  S[        US-  5      5        UR                  SS5        UR                  S	S5        [        [        R
                  " 5       5      nUR                  S
S
S9  US-  nUR                  S
S
S9  UR                  S[        U5      5        SnUS-  R                  USS9  [        UR                  S5      5      / :X  d   e[        UR                  S5      5      / :X  d   e[        SSS/5        [        UR                  S5      5      / :X  d   eUR                  S5       Vs1 s H  ofR                  iM     nnUS1-
  nUS1:X  d   egs  snf )zC`setup.py develop` should honor `--user` even under build isolationr   FHOMEz.homeUSERPROFILEAPPDATAzsite.USER_BASENzsite.USER_SITET)parentsrE  z.sys_prefixz
sys.prefixzF__import__('setuptools').setup(name='aproj', version=42, packages=[])
r   r   r   *developz--userzeasy-install.pthzaproj.egg-link)r}   r   r   r   r~   getusersitepackagesr   ri  r  globr   r$   )r   r   r`  	user_site
sys_prefixsetup_scriptr   	installeds           r   &test_editable_user_and_build_isolationr    s    /7( vs8g#567}c(W*<&=>y#h&8"9:($/($/T--/0IOOD4O0M)JTD1c*o6 	R  
&&|g&F 
$%+++	s#$*** j9h/0 
$%+++!*!45!4A!4I5/00I)**** 6s   F,)U__doc__r,  r  rC   r   r^   r  rF   r~   rW  r   r  r`   r  r  r   r   typingr   unittestr   rm   jaracor   r   r  r   rZ   r;   r   r   r	   r
   
setuptoolsr   setuptools._normalizationr   r   setuptools.distsetuptools.sandboxr   setuptools.testsr   setuptools.tests.serverr   r   r   r   textwrapr   distutils.errorsro   r   r   r    r   r6   r   filterwarningsr   r   usefixturesr   r4  r6  r@  rB  ro  r  r  r  r   r  r   r   rE   is_shrU  r2  rN  ri  rs  r  r_  r  r&   r   r   <module>r     s     	   	  	   
            , , U U  0 < ( ( * ;    / /  \2 \2~ 01A
 A
 2A
H   ))X
 X
 * *X
v   ,-- - .-
  D" D"NL4 L4^4!!H08& #JZ LLF#@(@=  " "	":* *Z) )* +8\ LLHQ  9+	9+r   