
    ,h-                     r   d dl Z d dl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Zd dlmZ ddlmZmZ ddlmZ ej(                  d        Zej(                  d        Z ej(                  d	d
      d        Zej(                  d        Zej(                  d        Zd Z ej(                  d
      d        Z ej(                  d
      d        Zej(                  d        Zej(                  d        Zej(                  d        Zd Z d Z!d Z"d Z#dde!dddfdZ$ej(                  d        Z%y)    N)Path)
safer_name   )contextsenvironment)DALSc              #   R  K   t        j                         5 }| j                  d|       t        j                         5 }| j                  d|       t        j                         5  d ddd       ddd       ddd       y# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   yxY ww)za
    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      [/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/setuptools/tests/fixtures.pyuser_overrider      s      
			 y,i8 	9 0)<002 	  	 	 sK   B''B'B%B*B2B:	B'BBB	BB$ B'c              #   ^   K   | j                         5 }| d d d        y # 1 sw Y   y xY wwN)as_cwd)tmpdirorigs     r   
tmpdir_cwdr   "   s*     	 D
  s   -!	-*-Tsession)autousescopec                     | j                   j                  j                  d      syt        j                  t
              5  t        j                  j                  d       ddd       y# 1 sw Y   yxY w)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(   (   sR     >>''227;			Z	(   s     A))A2c                     g d}	 t        j                  |t        |              | dz  S # t        $ r t	        j
                  d       Y | dz  S w xY w)z<
    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              #   h   K   t        j                  |       5  d  d d d        y # 1 sw Y   y xY wwr   )r%   r   )r6   s    r   sample_project_cwdr8   F   s)     	>	"   s   2&	2/2c                    t        j                  || d      5 }t        |j                  d      d       }t        |j                  d      d       }|r|r||fcd d d        S t	        |j
                  j                  d      j                         rJ t        j                  t        j                  dddt        |      t        |j
                  j                        g       t	        |j
                  j                  d      j                         rJ t        |j                  d            t        |j                  d            fcd d d        S # 1 sw Y   y xY w)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   		(	(!<
 C	SXXj)40SXXg&-U5>C C ..0ABIIKKNNH&&'!
 	 ..0ABIIKKCHHZ()40A+BB/C C Cs   >E C"EE)r   c                     t        j                  d      }|r8t         j                  j                  |      rt	        |      j                         S t        | |      \  }}|S )NPRE_BUILT_SETUPTOOLS_SDISTosgetenvr%   rA   r   resolverH   )rD   r'   prebuiltrF   _s        r   setuptools_sdistrQ   o   sL    yy56HBGGNN8,H~%%''#$4g>HE1L    c                     t        j                  d      }|r8t         j                  j                  |      rt	        |      j                         S t        | |      \  }}|S )NPRE_BUILT_SETUPTOOLS_WHEELrK   )rD   r'   rO   rP   rG   s        r   setuptools_wheelrU   y   sL    yy56HBGGNN8,H~%%''#$4g>HAuLrR   c                    t        j                         }t        j                  | dz        |_        ddg|_        t        |      |_        t        j                   d      5  |j                         cddd       S # 1 sw Y   yxY w)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      so     
 
 
"CyyF*+CH(*:;CO"#CG 
			. zz|  s   !A;;Bc                     t        j                         }t        j                  | dz        |_        ddg|_        |j                          |S )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                     t        j                         }t        j                  | dz        |_        g d|_        |j                          |S )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                    t        |      dkD  sJ t        j                  | d      5 }|D ]  \  }}t        j                  |j                  d            }t        j                  |      }t        |j                               |_        t        t        j                               |_        |j                  ||        	 ddd       y# 1 sw Y   yxY w)z
    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	( 8D!& 	8HgGNN7$;<JX6I !4!4!67IN!$))+.IOLLJL7	88 8 8s   BC		Cc                 D    t        | dt        d|d|d      fdg       y)z\
    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                    d|v sJ |j                  d      }|d   }t        dt        |      dz         D cg c]  }dj                  |d|        }}t	        d|d|d|d|d		      }d
}d|ft
        j                  j                  |d      |fg}	|dd D ]D  }
t        j                  j                  |
j                  d      dgz    }|	j                  |df       F t        | |	       yc c}w )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J#t%JHJ  K  \ "!!* .	
H ED(#bggll9m&Ld%STEAB< %77<<'--"4"FHh^$% y% + Ks   C-c           	      Z    t        | dt        d      j                  |||      fdg       y )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      sF     	 &!7O   !	
rR   foobarz0.1 c                 (   t        |      }dd| d| gt        j                  j                  |       gd}|r|j	                  |       t        j                  j                  | d      }	t        j                  |	       |rg }
g }|D ]g  }|j                  |      }|dj                         v r|}n|
}t        |t        t        f      rdj                  |      }|j                  | d|        i t        d      j                  d	j                  |
      d	j                  |      
      }nd}t        t        j                  j                  |	d      dd      5 }|j!                  |       ddd       |t        d      }t        t        j                  j                  |	d      dd      5 }|j!                  ||z         ddd       t        j                  j                  | | d| d      } ||||       |	S # 1 sw Y   xY w# 1 sw Y   GxY w)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	I )Q	'()   
 
bggll8Z0#	H 6A	!$4456 '',,t(;'<AgYg%NOKh0O#) )6 6s   G<-H<HHc                    t        d      t        d      t        d      dddddid	}|j                  g d
       | dz  }|j                          t        j                  j                  ||       |j                  dd       |S )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eF+}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   