o
     JAf"                     @   s   	 d dl Z d dlZd dlmZ d dlT d dlmZ d dlmZ d dl	m
Z
 d dlmZ dZd	d
 ZdadadZdZdd ZdddZdS )    N)DEBUG)*)Distribution)Command)PyPIRCCommand)	Extensionzusage: %(script)s [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: %(script)s --help [cmd1 cmd2 ...]
   or: %(script)s --help-commands
   or: %(script)s cmd --help
c                 C   s   t j| }tt  S )N)ospathbasenameUSAGEvars)script_nameZscript r   %/usr/lib/python3.10/distutils/core.py	gen_usage    s   
r   )	distclassr   script_argsoptionsnameversionZauthorZauthor_emailZ
maintainerZmaintainer_emailurllicensedescriptionZlong_descriptionkeywordsZ	platformsZclassifiersZdownload_urlZrequiresZprovidesZ	obsoletes)r   ZsourcesZinclude_dirsZdefine_macrosZundef_macrosZlibrary_dirsZ	librariesZruntime_library_dirsZextra_objectsZextra_compile_argsZextra_link_argsZ	swig_optsZexport_symbolsZdependslanguagec               
   K   s  	 |  d}|r| d= nt}d| vrtjtjd | d< d| vr*tjdd  | d< z||  a}W n  tyR } zd| vrDt	d| t	d| d |f d }~ww t
d	krY|S |  trgtd
 |  t
dkrm|S z| }W n ty } zt	t|jd|  d }~ww trtd |  t
dkr|S |rz|  W |S  ty   t	d ty } ztrtjd|f   t	d|f d }~w ttfy } ztrق t	dt| d }~ww |S )Nr   r   r   r      r   zerror in setup command: %szerror in %s setup command: %sinitz%options (after parsing config files):configz

error: %sz%options (after parsing command line):commandlineZinterruptedz
error: %s
z	error: %szerror: )getr   r   r	   r
   sysargv_setup_distributionZDistutilsSetupError
SystemExit_setup_stop_afterZparse_config_filesr   printZdump_option_dictsZparse_command_lineZDistutilsArgErrorr   r   Zrun_commandsKeyboardInterruptOSErrorstderrwriteZDistutilsErrorZCCompilerErrorstr)Zattrsklassdistmsgokexcr   r   r   setup9   sv   
$

r0   runc                 C   s   	 |dvrt d|f |atj }d| i}z<z3| tjd< |d ur)|tjdd < t| d}t| | W d    n1 s@w   Y  W |t_d an|t_d aw W n	 ty\   Y nw t	d u rgt
d|  t	S )N)r   r   r   r1   z"invalid value for 'stop_after': %r__file__r   r   rbzZ'distutils.core.setup()' was never called -- perhaps '%s' is not a Distutils setup script?)
ValueErrorr$   r    r!   copyopenexecreadr#   r"   RuntimeError)r   r   Z
stop_afterZ	save_argvgfr   r   r   	run_setup   s6   


r<   )Nr1   )r   r    Zdistutils.debugr   Zdistutils.errorsZdistutils.distr   Zdistutils.cmdr   Zdistutils.configr   Zdistutils.extensionr   r   r   r$   r"   Zsetup_keywordsZextension_keywordsr0   r<   r   r   r   r   <module>   s"    	q