o
    ¯N iÝ  ã                   @   sR   d dl mZ d dl mZ d dlZd dlZd dlZd dlmZ G dd„ dejƒZ	dS )é    )Úabsolute_import)Úprint_functionN)Úbasec                   @   s,   e Zd ZdZdZdd„ Zdd„ Zdd„ Zd	S )
ÚTestConsoleScriptsaQ  Test generation of custom console scripts.

    We generate custom console scripts that do not rely on pkg_resources to
    handle imports. This is no longer a concern starting with pip 19.0, since
    pip handles generation of scripts for wheel and starting in 19.0, pip nows
    generate an intermediate wheel during installation.
    )Úpbr_test_cmdÚpbr_test_cmd_with_classc           	      C   sp   | j D ]2}d|| jf }|  ||¡ tj | j|¡}t|dƒ ¡ }|  d|¡ |  	|¡\}}}|  d|¡ qd S )NzInstalling %s script to %sÚrÚpkg_resourcesÚPBR)
Ú	cmd_namesÚtemp_dirÚassertInÚosÚpathÚjoinÚopenÚreadÚassertNotInÚ_run_cmd)	ÚselfÚinstall_stdoutÚcmd_nameÚinstall_txtÚcmd_filenameÚ
script_txtÚstdoutÚ_Úreturn_code© r   ú]/home/ubuntu/.local/lib/python3.10/site-packages/pbr/tests/functional/test_console_scripts.pyÚcheck_script_install?   s   
þóz'TestConsoleScripts.check_script_installc                 C   sL   t jdkr
|  d¡ |  dd| j ¡\}}}|  t dd¡¡ |  |¡ dS )z8Test that we install a non-pkg-resources console script.ÚntúWindows support is passthroughÚinstall_scriptsú--install-dir=%sÚ
PYTHONPATHÚ.N)	r   ÚnameÚskipTestÚ	run_setupr   Ú
useFixtureÚfixturesÚEnvironmentVariabler    ©r   r   r   r   r   r   r   Útest_console_script_installO   s   



ÿz.TestConsoleScripts.test_console_script_installc                 C   s|   t jdk r
|  d¡ tjdkr|  d¡ |  ¡ dkr|  d¡ |  t dd| j	 ¡¡ |  
d	d
| j	 ¡\}}}|  |¡ dS )z8Test that we develop a non-pkg-resources console script.)é   r   zRFails with recent virtualenv due to https://github.com/pypa/virtualenv/issues/1638r!   r"   )éP   r   zsetuptools is too newr%   z.:%sÚdevelopr$   N)ÚsysÚversion_infor(   r   r'   Úget_setuptools_versionr*   r+   r,   r   r)   r    r-   r   r   r   Útest_console_script_develop]   s   
ÿ


ÿ

ÿz.TestConsoleScripts.test_console_script_developN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r    r.   r5   r   r   r   r   r   4   s    r   )
Ú
__future__r   r   r   r2   r+   Úpbr.tests.functionalr   ÚBaseTestCaser   r   r   r   r   Ú<module>   s   (