3
ÀÞL]   ã               @   sÚ   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 d dl	m
Z
 d dlmZ d dlmZ d dlmZ d d	lmZ d d
lmZ er¤d dlmZmZ d dlmZ ejeƒZdd„ Zdd„ Zdd„ ZG dd„ deƒZ dS )é    )Úabsolute_importN)Ú
cmdoptions)ÚCommand)Úmake_target_python)ÚSUCCESS)Ú
indent_log)Úget_pip_version)ÚMYPY_CHECK_RUNNING)Ú
format_tag)ÚAnyÚList)ÚValuesc             C   s   t jdj| |ƒƒ d S )Nz{}: {})ÚloggerÚinfoÚformat)ÚnameÚvalue© r   ú;/tmp/pip-build-69lrc5qx/pip/pip/_internal/commands/debug.pyÚ
show_value   s    r   c           
   C   sF   t jdƒ ttdƒr"tj} | j}nd}tƒ � td|ƒ W d Q R X d S )Nzsys.implementation:ÚimplementationÚ r   )r   r   ÚhasattrÚsysr   r   r   r   )r   Úimplementation_namer   r   r   Úshow_sys_implementation   s    

r   c       	      C   sÀ   d}t | ƒ}|jƒ }|jƒ }d}|r.dj|ƒ}djt|ƒ|ƒ}tj|ƒ | jdk rpt|ƒ|krpd}|d |… }nd}tƒ �< x|D ]}tjt	|ƒƒ q‚W |r²dj|d	�}tj|ƒ W d Q R X d S )
Né
   r   z (target: {})zCompatible tags: {}{}é   TFz?...
[First {tag_limit} tags shown. Pass --verbose to show all.])Ú	tag_limit)
r   Zget_tagsZformat_givenr   Úlenr   r   Úverboser   r
   )	Úoptionsr   Ztarget_pythonÚtagsZformatted_targetÚsuffixÚmsgZtags_limitedÚtagr   r   r   Ú	show_tags)   s(    


r&   c                   s8   e Zd ZdZdZdZdZdZ‡ fdd„Zdd	„ Z	‡  Z
S )
ÚDebugCommandz$
    Display debug information.
    Údebugz
      %prog <options>z&Show information useful for debugging.Tc                s4   t t| ƒj||Ž | j}tj|ƒ | jjd|ƒ d S )Nr   )Úsuperr'   Ú__init__Úcmd_optsr   Zadd_target_python_optionsÚparserÚinsert_option_group)ÚselfÚargsÚkwr+   )Ú	__class__r   r   r*   V   s    
zDebugCommand.__init__c             C   sv   t jdƒ tdtƒ ƒ tdtjƒ tdtjƒ tdtjƒ ƒ tdtjƒ ƒ tdt	j
ƒ ƒ tdtjƒ tƒ  t|ƒ tS )	Nz¸This command is only meant for debugging. Do not use this with automation for parsing and getting these details, since the output and options of this command may change without notice.zpip versionzsys.versionzsys.executablezsys.getdefaultencodingzsys.getfilesystemencodingzlocale.getpreferredencodingzsys.platform)r   Úwarningr   r   r   ÚversionÚ
executableÚgetdefaultencodingÚgetfilesystemencodingÚlocaleÚgetpreferredencodingÚplatformr   r&   r   )r.   r!   r/   r   r   r   Úrun]   s    zDebugCommand.run)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚusageÚsummaryZignore_require_venvr*   r:   Ú__classcell__r   r   )r1   r   r'   K   s   r'   )!Ú
__future__r   r7   Úloggingr   Zpip._internal.clir   Zpip._internal.cli.base_commandr   Zpip._internal.cli.cmdoptionsr   Zpip._internal.cli.status_codesr   Zpip._internal.utils.loggingr   Zpip._internal.utils.miscr   Zpip._internal.utils.typingr	   Zpip._internal.wheelr
   Útypingr   r   Úoptparser   Ú	getLoggerr;   r   r   r   r&   r'   r   r   r   r   Ú<module>   s&   
"