
    5hi                     X    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	dS )	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
                            ej        dk    d          d             Ze	j
                            ej        dk    d          d             Ze	j
                            ej        dk    d          d             Ze	j
                            ej        dk    d          d             Zd	S )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                 L   t          | j                  }d|_        t          |          }||_        ||                    d          }||_        |                                 t          j	                    5  |
                                 d d d            d S # 1 swxY w Y   d S )Nzsetup.pybuild_scripts)r   settingsscript_namer   install_dirget_finalized_command
executableensure_finalizedr   quietrun)selfr   r   distcmdbss         Elib/python3.11/site-packages/setuptools/tests/test_install_scripts.py_run_install_scriptsz'TestInstallScripts._run_install_scripts   s    DM**%d##%!**?;;B&BM^ 	 	GGIII	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   7BB Bwin32znon-Windows only)reasonc                    d| j          d}|                    d| j                    |                                5  |                     t	          |                     t          t	          |                    d                    dd          5 }|                                }ddd           n# 1 swxY w Y   ddd           n# 1 swxY w Y   ||k    sJ dS )	zt
        Ensure that shebang is not quoted on Unix when getting the Python exe
        from sys.executable.
        #!
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#   sM    *))),dm<<<]]__ 	& 	&%%c&kk222c&++e,,--sWEEE && & & & & & & & & & & & & & &	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& !!!!!!6   ACB1%C1B5	5C8B5	9CCCzWindows onlyc                    d| j          d}|                    d| j                    |                                5  |                     t	          |                     t          t	          |                    d                    dd          5 }|                                }ddd           n# 1 swxY w Y   ddd           n# 1 swxY w Y   ||k    sJ dS )	z
        Ensure that shebang is quoted on Windows when getting the Python exe
        from sys.executable and it contains a space.
        #!""
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   sN    -,,,,dn===]]__ 	& 	&%%c&kk222c&++o6677wOOO &ST& & & & & & & & & & & & & & &	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& !!!!!!r6   c                    d| j          d}|                                5  |                     t          |          | j                    t	          t          |                    d                    dd          5 }|                                }ddd           n# 1 swxY w Y   ddd           n# 1 swxY w Y   ||k    sJ dS )z
        Ensure that shebang on Unix is not quoted, even when
        a value with spaces
        is specified using --executable.
        r!   r"   r	   r$   r%   r&   N)unix_spaces_exer*   r   r+   r,   r-   r.   r   r0   r2   r3   r4   s        r   )test_executable_with_spaces_escaping_unixz<TestInstallScripts.test_executable_with_spaces_escaping_unix?   s:    1,000]]__ 	& 	&%%c&kk43GHHHc&++e,,--sWEEE && & & & & & & & & & & & & & &	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& !!!!!!s6   AB3;BB3B 	 B3#B 	$B33B7:B7c                    d| j          d}|                                5  |                     t          |          d| j         z   dz              t	          t          |                    d                    dd          5 }|                                }ddd           n# 1 swxY w Y   ddd           n# 1 swxY w Y   ||k    sJ dS )	z
        Ensure that shebang on Windows is quoted when
        getting a path with spaces
        from --executable, that is itself properly quoted.
        r8   r9   "r:   r$   r%   r&   N)r;   r*   r   r+   r,   r-   r.   r?   s        r   "test_executable_arg_escaping_win32z5TestInstallScripts.test_executable_arg_escaping_win32M   sC    -,,,]]__ 	& 	&%%c&kk33G#3MNNNc&++o6677wOOO &ST& & & & & & & & & & & & & & &	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& !!!!!!s6   A!B9B"B9"B&	&B9)B&	*B99B= B=)N)__name__
__module____qualname__dictr   r(   r>   r;   r   pytestmarkskipifsysplatformr5   r<   r@   rC        r   r   r      sE       t'-9  H
 7H6OLI
 
 
 
 [/8JKK" " LK" [/GG" " HG" [/8JKK" " LK" [/GG" " HG" " "rN   r   )
__doc__rK   rH   "setuptools.command.install_scriptsr   setuptools.distr    r   r   rM   rN   r   <module>rS      s      



  > > > > > > ( ( ( ( ( (      L" L" L" L" L" L" L" L" L" L"rN   