
    ʨsgq                     P    d Z ddlZddlZddlmZ ddlmZ ddlmZ  G d d      Z	y)	zinstall_scripts tests    N)install_scripts)Distribution   )contextsc                      e Zd Z edddgid      ZdZdZdZdd
Ze	j                  j                  ej                  dk(  d      d        Ze	j                  j                  ej                  dk7  d      d        Ze	j                  j                  ej                  dk(  d      d        Ze	j                  j                  ej                  dk7  d      d        Zy	)TestInstallScriptsfooconsole_scriptszfoo=foo:fooz0.0)nameentry_pointsversionz%/usr/dummy-test-path/local/bin/pythonz/usr/bin/env dummy-test-pythonz6C:\Dummy Test Path\Program Files\Python 3.6\python.exeNc                 &   t        | j                        }d|_        t        |      }||_        ||j                  d      }||_        |j                          t        j                         5  |j                          d d d        y # 1 sw Y   y xY w)Nzsetup.pybuild_scripts)r   settingsscript_namer   install_dirget_finalized_command
executableensure_finalizedr   quietrun)selfr   r   distcmdbss         X/var/www/html/venv/lib/python3.12/site-packages/setuptools/tests/test_install_scripts.py_run_install_scriptsz'TestInstallScripts._run_install_scripts   sz    DMM*%d#%!**?;B&BM^^ 	GGI	 	 	s   -BBwin32znon-Windows only)reasonc                 |   d| j                   z  }|j                  d| j                          |j                         5  | j                  t	        |             t        t	        |j                  d            dd      5 }|j                         }ddd       ddd       |k(  sJ y# 1 sw Y   xY w# 1 sw Y   xY w)zt
        Ensure that shebang is not quoted on Unix when getting the Python exe
        from sys.executable.
        #!%s
sys.executabler	   rutf-8encodingN)unix_exesetattras_cwdr   stropenjoinreadliner   tmpdirmonkeypatchexpectedfactuals         r   !test_sys_executable_escaping_unixz4TestInstallScripts.test_sys_executable_escaping_unix#   s     dmm+,dmm<]]_ 	&%%c&k2c&++e,-sWE &&	& !!!& &	& 	&$   AB2=B&B2&B/	+B22B;zWindows onlyc                 |   d| j                   z  }|j                  d| j                          |j                         5  | j                  t	        |             t        t	        |j                  d            dd      5 }|j                         }ddd       ddd       |k(  sJ y# 1 sw Y   xY w# 1 sw Y   xY w)z
        Ensure that shebang is quoted on Windows when getting the Python exe
        from sys.executable and it contains a space.
        #!"%s"
r"   foo-script.pyr#   r$   r%   N)	win32_exer(   r)   r   r*   r+   r,   r-   r.   s         r   "test_sys_executable_escaping_win32z5TestInstallScripts.test_sys_executable_escaping_win321   s     .,dnn=]]_ 	&%%c&k2c&++o67wO &ST&	& !!!& &	& 	&r5   c                 Z   d| j                   z  }|j                         5  | j                  t        |      | j                          t	        t        |j                  d            dd      5 }|j                         }ddd       ddd       |k(  sJ y# 1 sw Y   xY w# 1 sw Y   xY w)z
        Ensure that shebang on Unix is not quoted, even when
        a value with spaces
        is specified using --executable.
        r!   r	   r#   r$   r%   N)unix_spaces_exer)   r   r*   r+   r,   r-   r   r/   r1   r2   r3   s        r   )test_executable_with_spaces_escaping_unixz<TestInstallScripts.test_executable_with_spaces_escaping_unix?   s     d222]]_ 	&%%c&k43G3GHc&++e,-sWE &&	& !!!& &	& 	&s$   AB!,B=B!B	B!!B*c                 f   d| j                   z  }|j                         5  | j                  t        |      d| j                   z   dz          t	        t        |j                  d            dd      5 }|j                         }ddd       ddd       |k(  sJ y# 1 sw Y   xY w# 1 sw Y   xY w)z
        Ensure that shebang on Windows is quoted when
        getting a path with spaces
        from --executable, that is itself properly quoted.
        r7   "r8   r#   r$   r%   N)r9   r)   r   r*   r+   r,   r-   r=   s        r   "test_executable_arg_escaping_win32z5TestInstallScripts.test_executable_arg_escaping_win32M   s     .]]_ 	&%%c&k33G#3MNc&++o67wO &ST&	& !!!& &	& 	&s$   AB'2BB'B$	 B''B0)N)__name__
__module____qualname__dictr   r'   r<   r9   r   pytestmarkskipifsysplatformr4   r:   r>   rA        r   r   r      s    '-9H
 7H6OLI
 [[/8JK" L" [[/G" H" [[/8JK" L" [[/G" H"rL   r   )
__doc__rI   rF   "setuptools.command.install_scriptsr   setuptools.distr    r   r   rK   rL   r   <module>rQ      s#     
  > ( L" L"rL   