
    n&ph-                     b   S SK r S SKrS SKrS SKrS SKrS SKrS SKrS SKJr  S SK	r
S SKrS SKrS SKJr  SSKJrJr  SSKJr  \R(                  S 5       r\R(                  S 5       r\R(                  " S	S
S9S 5       r\R(                  S 5       r\R(                  S 5       rS r\R(                  " S
S9S 5       r\R(                  " S
S9S 5       r\R(                  S 5       r\R(                  S 5       r\R(                  S 5       rS r S r!S r"S r#SS\!SSS4S jr$\R(                  S 5       r%g)    N)Path)
safer_name   )contextsenvironment)DALSc              #   v  #    [         R                  " 5        nU R                  SU5        [         R                  " 5        nU R                  SU5        [         R                  " 5          Sv   SSS5        SSS5        SSS5        g! , (       d  f       N= f! , (       d  f       N(= f! , (       d  f       g= f7f)zU
Override site.USER_BASE and site.USER_SITE with temporary directories in
a context.
zsite.USER_BASEzsite.USER_SITEN)r   tempdirsetattrsave_user_site_setting)monkeypatch	user_base	user_sites      L/var/www/html/venv/lib/python3.13/site-packages/setuptools/tests/fixtures.pyuser_overrider      s      
			y,i89 0)<002 3   
	 32   
	sL   B9(B( (B(B-B5B(=	B9
BB
B%	!B((
B62B9c              #   h   #    U R                  5        nUv   S S S 5        g ! , (       d  f       g = f7fN)as_cwd)tmpdirorigs     r   
tmpdir_cwdr   "   s     	D
 
s   2!	2
/2Tsession)autousescopec                     U R                   R                  R                  S5      (       d  g[        R                  " [
        5         [        R                  R                  S5        SSS5        g! , (       d  f       g= f)z
Workaround pytest-dev/pytest-xdist#376

``pytest-xdist`` tends to inject '' into ``sys.path``,
which may break certain isolation expectations.
Remove the entry so the import
machinery behaves the same irrespective of xdist.
xdistN )	configpluginmanager
has_plugin
contextlibsuppress
ValueErrorsyspathremove)requests    r   workaround_xdist_376r(   (   sL     >>''227;;			Z	( 
)	(	(s    A//
A=c                     / SQn [         R                  " U[        U 5      S9  U S-  $ ! [         a    [        R
                  " S5         U S-  $ f = f)z4
Clone the 'sampleproject' and return a path to it.
)gitclonez%https://github.com/pypa/sampleproject)cwdzUnable to clone sampleprojectsampleproject)
subprocess
check_callstr	Exceptionpytestskip)tmp_pathcmds     r   sample_projectr6   9   sY    
 DC5cs8}5 o%%  534o%%5s   )  AAc              #   t   #    [         R                  " U 5         S v   S S S 5        g ! , (       d  f       g = f7fr   )r%   r   )r6   s    r   sample_project_cwdr8   F   s     	>	" 
#	"	"s   8'	8
58c                    [         R                  " XS5       n[        UR                  S5      S 5      n[        UR                  S5      S 5      nU(       a  U(       a  X44sS S S 5        $ [	        UR
                  R                  S5      R                  5       (       a   e[        R                  " [        R                  SSS[        U5      [        UR
                  R                  5      /5        [	        UR
                  R                  S5      R                  5       (       a   e[        UR                  S5      5      [        UR                  S5      5      4sS S S 5        $ ! , (       d  f       g = f)N
dist_buildz*.tar.gzz*.whlzbuild/lib/build-mbuildz--outdir)r   session_locked_tmp_dirnextglobr   r   rootdirexistsr.   check_outputr$   
executabler0   )tmp_path_factoryr'   tmpsdistwheels        r   _build_distributionsrH   T   s   		(	(<
	SXXj)40SXXg&-U>
 
 ..0ABIIKKKKNNH&&'!
 	 ..0ABIIKKKKCHHZ()40A+BB/
 
 
s   AE )C-E  
E.)r   c                     [         R                  " S5      nU(       a=  [         R                  R                  U5      (       a  [	        U5      R                  5       $ [        X5      u  p4U$ )NPRE_BUILT_SETUPTOOLS_SDISTosgetenvr%   rA   r   resolverH   )rD   r'   prebuiltrF   _s        r   setuptools_sdistrQ   o   sK    yy56HBGGNN8,,H~%%''#$4>HEL    c                     [         R                  " S5      nU(       a=  [         R                  R                  U5      (       a  [	        U5      R                  5       $ [        X5      u  p4U$ )NPRE_BUILT_SETUPTOOLS_WHEELrK   )rD   r'   rO   rP   rG   s        r   setuptools_wheelrU   y   sK    yy56HBGGNN8,,H~%%''#$4>HALrR   c                    [         R                  " 5       n[        R                  " U S-  5      Ul        SS/Ul        [        U5      Ul        [        R                   " SS9   UR                  5       sSSS5        $ ! , (       d  f       g= f)z?Virtual env with the version of setuptools under test installedvenv--no-setuptoolsz--wheel=bundleN)
PYTHONPATH)
r   
VirtualEnvr%   r   rootcreate_optsr0   reqr   create)r4   rU   envs      r   rW   rW      sf     
 
 
"CyyF*+CH(*:;CO"#CG 
			.zz| 
/	.	.s   !A;;
B	c                     [         R                  " 5       n[        R                  " U S-  5      Ul        SS/Ul        UR                  5         U$ )z7Virtual env without any version of setuptools installedvenv_without_setuptoolsrX   
--no-wheelr   rZ   r%   r   r[   r\   
ensure_envr4   r_   s     r   ra   ra      sC     
 
 
"Cyy$==>CH(,7CONNJrR   c                     [         R                  " 5       n[        R                  " U S-  5      Ul        / SQUl        UR                  5         U$ )z1Virtual env without any common packages installed	bare_venv)rX   z--no-piprb   z	--no-seedrc   re   s     r   rg   rg      s=     
 
 
"CyyK/0CHPCONNJrR   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:gzutf-8)name)fileobjN)lentarfileopenioBytesIOencodeTarInfogetvaluesizeinttimemtimeaddfile)	dist_pathfilesdistfilenamecontent
file_bytes	file_infos          r   
make_sdistr      s     u:>>	i	(D!&HGNN7$;<JX6I !4!4!67IN!$))+.IOLLL7 "' 
)	(	(s   BC
C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.
setup.pyzT             import setuptools
             setuptools.setup(
                 name=z,
                 version=z
             )
         	setup.cfgr   N)r   r   )ry   distnameversions      r   make_trivial_sdistr      sK        l #! %
	 	
rR   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   NzE        import setuptools
        setuptools.setup(
            name=z,
            version=z,
            packages=z",
            namespace_packages=[z]
        )
    z7__import__('pkg_resources').declare_namespace(__name__)r   __init__.pyr   )	splitrangerl   joinr   rL   r%   appendr   )ry   r   r   parts	nspackageidxpackagessetup_pyinitrz   packager|   s               r   make_nspkg_sdistr      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},
                )
                )rj   r   python_requiresr   )r   r   format)ry   r   r   r   s       r   make_python_requires_sdistr      sD     	 &!O   !	
rR   foobarz0.1 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'.
test_pkgz0.0z==)rj   r   setup_requiresdependency_linkszname version;z: zg
            [metadata]
            {metadata}
            [options]
            {options}
            
)optionsmetadatar   r   wri   )encodingNzI            import setuptools
            setuptools.setup(**%r)
        r   -z.tar.gz)r   rL   r%   abspathupdater   mkdirpopr   
isinstancetuplelistr   r   r   rn   write)r%   r   r   make_packagesetup_py_templatesetup_attrsuse_setup_cfgnormalized_distnametest_setup_attrsr   r   r   rj   valuesectiontest_setup_cfg_contentsffoobar_paths                     r   create_setup_requires_packager     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$c                    [        S5      [        S5      [        S5      SSS.SS0S	.nUR                  / S
Q5        U S-  nUR                  5         [        R                  R                  X4S9  UR                  SS5        U$ )Nz
            [build-system]
            requires = ["setuptools"]
            build-backend = "setuptools.build_meta"
            z
            __import__('setuptools').setup(
                pbr=True,
                setup_requires=["pbr"],
            )
            z
            [metadata]
            name = mypkg

            [files]
            packages =
                mypkg
            r   zprint('Hello world!'))r   zhello.pyztest.txtzAnother file in here.)zpyproject.tomlr   r   mypkgother)pythonr;   pipinstallpbrr   )prefixPBR_VERSIONz0.42)r   runr   jaracor%   r<   setenv)r4   r   rW   rz   r   s        r   pbr_packager   a  s     
 
 	
 /
 56=E@ 	HH67F
LLN
KKe+}f-MrR   )&r!   ro   rL   r.   r$   rm   rv   pathlibr   jaraco.pathr   r%   r2   setuptools._normalizationr   r   r   r   textwrapr   fixturer   r   r(   r6   r8   rH   rQ   rU   rW   ra   rg   r   r   r   r   r   r   r   rR   r   <module>r      s~    	 	  
       0 #  
 
  
 I. /  	& 	&  C6 i  ! i  !  *    8"4!!H4 #JZ & &rR   