a
    ze"                     @   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.9/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r8tjtjd | d< d| vrRtjdd  | d< z||  a}W nN ty } z6d| vrt	d| nt	d| d |f W Y d }~n
d }~0 0 t
d	kr|S |  trtd
 |  t
dkr|S z| }W n< ty. } z"t	t|jd|  W Y d }~n
d }~0 0 trFtd |  t
dkrT|S |rz|  W n ty   t	dY n ty } z6trtjd|f   nt	d|f W Y d }~nLd }~0  ttfy } z&tr nt	dt| W Y d }~n
d }~0 0 |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)attrsklassdistmsgokexcr   r   r   setup9   sd    %

,
"&r1   runc                 C   s   |dvrt d|f |atj }d| i}zxzf| tjd< |d urP|tjdd < t| d}t| | W d    n1 s~0    Y  W |t_d an|t_d a0 W n ty   Y n0 t	d u rt
d|  t	S )N)r   r   r   r2   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   s.    

.
r=   )Nr2   )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_keywordsr1   r=   r   r   r   r   <module>	   s   	q