
    ,h!                     6   d Z ddlZddlZddlZddlZddlZddlmZ ddlm	Z
 ddlmZ ddlmZm	Z	 ddlmZ ddlmZ dd	lmZ dd
lmZmZ ddlmZ ddlZd Zej8                  ej:                  j=                  d       G d dej>                                      Z y)z$Tests for distutils.command.install.    N)	sysconfig)install)	build_ext)INSTALL_SCHEMESr   )Distribution)DistutilsOptionError)	Extension)missing_compiler_executablesupport)is_mingwc                 2    | t        j                  d      z   S )N
EXT_SUFFIX)r   get_config_var)modnames    j/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/setuptools/_distutils/tests/test_install.py_make_ext_namer      s    Y--l;;;    save_envc                   v    e Zd Zej                  j                  dd      d        Zd Zd Zd Z	d Z
d	 Zd
 Zy)TestInstallz=platform.system() == "Windows" and sys.version_info > (3, 11)zpypa/distutils#148)reasonc           	      4   | j                         }t        j                  j                  |d      }t	        ddi      }t        j                  j                  |d      |_        t        j                  |t        j                  j                  |d            |j                  d<   t        |      }||_
        |j                          |j                  |k(  sJ |j                  |k(  sJ d }t        j                  j                   j#                  d	d
      }t        j                  j                  |d|      } ||j$                  |       t'        t        dd      }t        j                  j                  |||      }	 ||j(                  |	        ||j*                  |        ||j,                  t        j                  j                  |d|d              ||j.                  t        j                  j                  |d              ||j0                  |       y )Ninstallationnamefoopkgzsetup.pylib)
build_base	build_libbuildc                     t         j                  j                  |       } t         j                  j                  |      }| |k(  sJ y N)ospathnormpath)gotexpecteds     r   
check_pathz=TestInstall.test_home_installation_scheme.<locals>.check_path8   s6    ''""3'Cww''1H(?"?r   cpythonpython
platlibdirincludebin)mkdtempr"   r#   joinr   script_namer   DummyCommandcommand_objr   homeensure_finalizedinstall_baseinstall_platbasesysimplementationr   replaceinstall_libgetattrinstall_platlibinstall_purelibinstall_headersinstall_scriptsinstall_data)
selfbuilddirdestinationdistcmdr'   	impl_namelibdir_platlibdirr*   s
             r   test_home_installation_schemez)TestInstall.test_home_installation_scheme   s    <<>ggll8^<VX./77<<*=$+$8$8ggll8U3%
!
 dm;..##{22	#
 &&++33IxH	k5)<3??F+c<7WW\\+{IF
3&&
33&&/GGLLiHE	
 	3&&[%(HI3##[1r   c                 4     j                          _        t        j                  }t        j                  }|j                  t        dt        j                  j                   j                  d             |j                  t        dt        j                  j                   j                  d             |j                  t        dt        j                         |j                  t        dt        j                          fd}|j                  t        j                  d|       dD ]  }|t        v rJ  t        dd	i      }t        |      }|j                  D 	
cg c]  \  }}	}
|
 }}	}}
d
|v sJ d|_        t        j                  j                  t        j                        rJ t        j                  j                  t        j                        rJ |j!                          t        j                  j                  t        j                        sJ t        j                  j                  t        j                        sJ d|j"                  v sJ d|j"                  v sJ t        j                  j%                  |j&                  t        j                        }t        j(                  dk(  rht+               s^t        j                  j%                  t        j                  j-                  |      |      }t        j                  j                  |d      }nt/        j0                  dd      }t        j                  j                  |d	      }t        j                  j3                  |      t        j                  j3                  |      k(  sJ y c c}
}	}w )N	USER_BASEB	USER_SITESc                     | j                  d      r/t        j                  j                  j                  | dd  z         S | S )N~   )
startswithr"   r#   r$   tmpdir)r#   r@   s    r   _expanduserz/TestInstall.test_user_site.<locals>._expanduserV   s8    s#ww''d12h(>??Kr   
expanduser)nt_user
posix_userr   xxuserTuserbaseusersitentIncluder    )r-   rR   siterL   rJ   setattrr"   r#   r.   install_moduler   r   r   user_optionsrX   existsr3   config_varsrelpathr=   r   r   dirnamer   get_python_incnormcase)r@   monkeypatch	orig_site	orig_baserS   keyrC   rD   r   shortlabeloptionsactual_headers	site_pathr+   expect_headerss   `               r   test_user_sitezTestInstall.test_user_siteK   si    llnNN	NN	D+rww||DKK/MND+rww||DKK/MNNKHNKH	
 	BGG\;?, 	*C/))	* VTN+dm 362B2BCC.D%4CC    77>>$..1177>>$..11 	 ww~~dnn--ww~~dnn--S__,,S__,,)<)<dnnM77d?8:	(BINIggll9i8G..q"5Ggt4ww/2773C3CN3SSSS9 Ds   Nc                 x   t        ddd      }t        |      }|j                          |j                  ddgk(  sJ |j                  dk(  sJ |j
                  dk(  sJ dg|_        |j                          |j                  dgk(  sJ |j                  dk(  sJ |j
                  dk(  sJ d x|_        |_        |j                          |j                  J |j                  dk(  sJ |j
                  J d|_        t        j                  t              5  |j                          d d d        y # 1 sw Y   y xY w)NrW   z	path,dirs)r   
extra_pathr#   dirsr]   zpath,dirs,again)	r   r   handle_extra_pathrt   
extra_dirs	path_filepytestraisesr   r@   rC   rD   s      r   test_handle_extra_pathz"TestInstall.test_handle_extra_path   s   TEFdm 	~~&&!111~~''}}&& !~~&))~~''}}&& ,0/#.~~%%~~##}}$$ +]]/0 	$!!#	$ 	$ 	$s   D00D9c                    t        ddi      }t        |      }d|_        d|_        t	        j
                  t              5  |j                          d d d        d |_        d|_        t	        j
                  t              5  |j                          d d d        d |_        d|_	        t	        j
                  t              5  |j                          d d d        y # 1 sw Y   xY w# 1 sw Y   VxY w# 1 sw Y   y xY w)Nr   rW   prefixbaser2   rX   )
r   r   r~   r4   ry   rz   r   finalize_optionsr2   rX   r{   s      r   test_finalize_optionsz!TestInstall.test_finalize_options   s    VTN+dm 
!]]/0 	#  "	#  ]]/0 	#  "	#
 
]]/0 	#  "	# 	#	# 	#	# 	#	# 	#s$    C C& C2C#&C/2C;c                    | j                         }| j                  dgdg      \  }}t        j                  |       | j	                  dd       | j	                  dd       t        |      }||j                  d<   ||_        t        j                  j                  |d      |_
        |j                          |j                          t        j                  |j                        j                  d	
      }|j!                         D cg c]!  }t        j                  |      j"                  # }}ddt$        j&                  j(                   dd dj*                  t$        j,                  d d  g}||k(  sJ y c c}w )Nhellosayhi)
py_modulesscriptszhello.pyzdef main(): print('o hai')zfrom hello import main; main()r   filelistutf-8encodingzhello.z.pycUNKNOWN-0.0.0-py{}.{}.egg-info   )r-   create_distr"   chdir
write_filer   r1   rootr#   r.   recordr3   runpathlibPath	read_text
splitlinesr   r6   r7   	cache_tagformatversion_info)	r@   install_dirproject_dirrC   rD   contentlinefoundr&   s	            r   test_recordzTestInstall.test_record   sE   lln ,,	G9,UT

$@A!ABdm&)#WW\\+z:
	,,szz*44g4F5<5G5G5IJTd#((JJS''112$73,33S5E5Ebq5IJ	
     Ks   	&E9c                    t               }|t        j                  d|d       | j                         }| j	                  t        ddg      g      \  }}t        j                  |       t        j                  |       t        |      }t        j                  |       |j                          t        |      }||j                  d<   ||j                  d<   ||_        t        j                   j#                  |d      |_        |j                          |j'                          t)        j*                  |j$                        j-                  d	
      }|j/                         D cg c]!  }t)        j*                  |      j0                  # }}t3        d       dj4                  t6        j8                  d d  g}	||	k(  sJ y c c}w )NzThe z command is not foundrW   z
xxmodule.c)ext_modulesr   r   r   r   r   r   r   )r
   ry   skipr-   r   r	   r"   r   r   copy_xxmodule_cr   fixup_build_extr3   r   r1   r   r#   r.   r   r   r   r   r   r   r   r   r   r6   r   )
r@   rD   r   r   rC   buildextcmdr   r   r   r&   s
             r   test_record_extensionsz"TestInstall.test_record_extensions   s   )+?KK$sg%:;<lln ,,"4,89 - 
T 	,o,$$&dm&)#(3%WW\\+z:
	,,szz*44g4F5<5G5G5IJTd#((JJ4 3,33S5E5Ebq5IJ
     Ks   '&Gc                     |j                  t        dd       |j                  t        j                         | j                          t        d |j                  D              sJ y )NDEBUGTc              3   \   K   | ]$  }|j                   t        j                  k(  s!| & y wr!   )levelnologgingr   ).0recs     r   	<genexpr>z.TestInstall.test_debug_mode.<locals>.<genexpr>   s     Q3CKK7==4P3Qs   ",,)r_   r`   	set_levelr   r   r   anyrecords)r@   caplogrh   s      r   test_debug_modezTestInstall.test_debug_mode   sJ    NGT:'Q&..QQQQr   N)__name__
__module____qualname__ry   markxfailrH   rr   r|   r   r   r   r    r   r   r   r      sS    
 [[G#  '2	'2R5Tn$:#0!2!@Rr   r   )!__doc__r   r"   r   r^   r6   	distutilsr   distutils.commandr   r`   distutils.command.build_extr   distutils.command.installr   distutils.corer   distutils.errorsr   distutils.extensionr	   distutils.testsr
   r   distutils.utilr   ry   r   combine_markersr   usefixturesTempdirManagerr   r   r   r   <module>r      s    *  	   
  7 1 > ' 1 ) @ # < 	$ZRZR % ZRr   