3
h0                 @   s   d dl mZ d dlZd dlZd dlmZmZmZ ddlm	Z	 ej
dk rJeZG dd deZG d	d
 d
eZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZdd Zdd Zdd ZdS )    )absolute_importN)ArgumentParserActionSUPPRESS   )Options   c               @   s   e Zd ZdddZdS )ParseDirectivesActionNc             C   s8   t t|| jtj }tj|d|d}t|| j| d S )NT)Zrelaxed_boolcurrent_settings)dictgetattrdestr   Zget_directive_defaultsZparse_directive_listsetattr)selfparser	namespacevaluesoption_stringZold_directives
directives r   i/var/www/html/CrowdFlow/Picklecon/ble_analysis_env/lib/python3.6/site-packages/Cython/Compiler/CmdLine.py__call__   s
    
zParseDirectivesAction.__call__)N)__name__
__module____qualname__r   r   r   r   r   r	      s   r	   c               @   s   e Zd ZdddZdS )ParseOptionsActionNc       	      C   sp   t t|| ji }xJ|jdD ]<}d|krH|jdd\}}|j d	k}n
|d }}|||< qW t|| j| d S )
N,=r   falsef0noT)r   r   r    r!   )r   r   r   splitlowerr   )	r   r   r   r   r   optionsoptnvr   r   r   r      s    
zParseOptionsAction.__call__)N)r   r   r   r   r   r   r   r   r      s   r   c               @   s   e Zd ZdddZdS )ParseCompileTimeEnvActionNc             C   s2   t t|| ji }tj||d}t|| j| d S )N)r
   )r   r   r   r   Zparse_compile_time_envr   )r   r   r   r   r   Zold_envZnew_envr   r   r   r   )   s    z"ParseCompileTimeEnvAction.__call__)N)r   r   r   r   r   r   r   r   r(   (   s   r(   c               @   s   e Zd ZdddZdS )ActivateAllWarningsActionNc             C   s"   t |di }|jtj ||_d S )Ncompiler_directives)r   updater   Zextra_warningsr*   )r   r   r   r   r   r   r   r   r   r   0   s    z"ActivateAllWarningsAction.__call__)N)r   r   r   r   r   r   r   r   r)   /   s   r)   c               @   s   e Zd ZdddZdS )SetLenientActionNc             C   s   d|_ d|_d S )NF)Zerror_on_unknown_namesZerror_on_uninitialized)r   r   r   r   r   r   r   r   r   7   s    zSetLenientAction.__call__)N)r   r   r   r   r   r   r   r   r,   6   s   r,   c               @   s   e Zd ZdddZdS )SetGDBDebugActionNc             C   s   d|_ tj|_d S )NT)	gdb_debugoscurdir
output_dir)r   r   r   r   r   r   r   r   r   =   s    zSetGDBDebugAction.__call__)N)r   r   r   r   r   r   r   r   r-   <   s   r-   c               @   s   e Zd ZdddZdS )SetGDBDebugOutputActionNc             C   s   d|_ ||_d S )NT)r.   r1   )r   r   r   r   r   r   r   r   r   C   s    z SetGDBDebugOutputAction.__call__)N)r   r   r   r   r   r   r   r   r2   B   s   r2   c               @   s   e Zd ZdddZdS )SetAnnotateCoverageActionNc             C   s   d|_ ||_d S )NT)annotateannotate_coverage_xml)r   r   r   r   r   r   r   r   r   I   s    z"SetAnnotateCoverageAction.__call__)N)r   r   r   r   r   r   r   r   r3   H   s   r3   c           	   C   sD  d} t | td}|jddddddd	 |jd
dddddd	 |jdddddd |jddddtdd |jddddddd	 |jddddd d!d	 |jd"d#d$d%d&d |jd'd(d)ddd*d	 |jd+d,dtd-d |jd.d/d0dtd1d |jd2td d3d4 |jd5ttd6d7 |jd8d9d:d;d<d |jd=d>dd?d@dAdB |jdCddDd@dEdB |jdFdGttdHd |jdIdJdKdLd |jdMdNdOdddPd	 |jdQddRdSdT |jdUdVddWdXd	 |jdYdVddZd[d	 |jd\dVdd]d^d	 |jd_td d`d4 |jdadbdKdcd |jdddedKdfd |jdgdhdidKdjd |jdkdlt	d dmd4 |jdndodpdqtt
drds |jdtdudpdvttdwds |jdxdytddzd{ |jd|d}dKd~d |jddg d |jddddttd |jdddKtd |jddd;td |jdddKtd |jdddKtd ddlm} x>t|D ]2}|jdr
|jdd}|jd| dKtd q
W |S )Nz|Cython (https://cython.org/) is a compiler for code written in the Cython language.  Cython is based on Pyrex by Greg Ewing.)descriptionargument_defaultz-Vz	--versionshow_versionstore_constr   z)Display version number of cython compiler)r   actionconsthelpz-lz--create-listinguse_listing_filez&Write error messages to a listing filez-Iz--include-dirZinclude_pathappendzWSearch for include files in named directory (multiple include directories are allowed).)r   r:   r<   z-oz--output-fileZoutput_filestorez Specify name of generated C file)r   r:   typer<   z-tz--timestamps
timestampszOnly compile newer source filesz-fz--forcer   z/Compile all source files (overrides implied -t)z-vz	--verboseverbosecountz4Be verbose, print file names on multiple compilationz-pz--embed-positionsZembed_pos_in_docstringzeIf specified, the positions in Cython files of each function definition is embedded in its docstring.z	--cleanupZgenerate_cleanup_codezzRelease interned objects on python exit, for memory debugging. Level indicates aggressiveness, default 0 releases nothing.z-wz	--workingworking_pathzOSets the working directory for Cython (the directory modules are searched from)z--gdbz"Output debug information for cygdb)r:   nargsr<   z--gdb-outdirz>Specify gdb debug information output directory. Implies --gdb.)r:   r@   r<   z-Dz--no-docstringsZ
docstringsstore_falsez*Strip docstrings from the compiled module.z-az
--annotatedefaultr4   z/Produce a colorized HTML version of the source.)r:   r;   r   r<   z--annotate-fullcZfullczZProduce a colorized HTML version of the source which includes entire generated C/C++-code.z--annotate-coverager5   z7Annotate and include coverage information from cov.xml.z--line-directivesZemit_linenums
store_truez4Produce #line directives pointing to the .pyx sourcez-+z--cplusZcplusz Output a C++ rather than C file.z--embedmainzwGenerate a main() function that embeds the Python interpreter. Pass --embed=<method_name> for a name other than main().)r:   r;   r<   z-2Zlanguage_level   z4Compile based on Python-2 syntax and code semantics.z-3r   z4Compile based on Python-3 syntax and code semantics.z--3strZ3strz{Compile based on Python-3 syntax and code semantics without assuming unicode by default for string literals under Python 2.z	--lenientzQChange some compile time errors to runtime errors to improve Python compatibilityz--capi-reexport-cincludesZcapi_reexport_cincludesz9Add cincluded headers to any auto-generated header files.z--fast-failZ	fast_failz(Abort the compilation on the first errorz-Werrorz--warning-errorsZwarning_errorszMake all warnings into errorsz-Wextraz--warning-extrazEnable extra warningsz-Xz--directivezNAME=VALUE,...r*   zOverrides a compiler directive)metavarr   r@   r:   r<   z-Ez--compile-time-envZcompile_time_envz,Provides compile time env like DEF would do.z--module-namemodule_namezFully qualified module name. If not given, is deduced from the import path if source file is in a package, or equals the filename otherwise.)r   r@   r:   r<   z-Mz	--depfilez produce depfiles for the sources)r:   r<   sources*)rE   rG   z-zz--pre-importZ
pre_importz--convert-rangeZconvert_rangez--no-c-in-tracebackZc_line_in_tracebackz--cimport-from-pyxZcimport_from_pyxz--old-style-globalsZold_style_globals)
DebugFlagsdebug_-z--)r   r   add_argumentstrintr-   r2   r3   r,   r)   r	   r(    rO   vars
startswithreplace)r6   r   rO   nameZoption_namer   r   r   create_cython_argparserN   s    








r[   c             C   s   dd }||\}}| j |\}}|j}|`x0|D ](}|jdrP| jd|  q2|j| q2W x6|D ].}	|	dkrvd}
n|	tdd  }
t|d|
 qdW ||fS )	Nc             S   sH   g g  }}x4| D ],}|dks&|j dr2|j| q|j| qW ||fS )Nz--embedz--embed=)rX   r>   )args
with_embedZwithout_embedxr   r   r   filter_out_embed_options   s    

z8parse_command_line_raw.<locals>.filter_out_embed_optionsrR   zunknown option z--embedrI   z--embed=embed)parse_known_argsrM   rX   errorr>   lenr   )r   r\   r_   r]   Zargs_without_embed	argumentsunknownrM   optionr^   rZ   r   r   r   parse_command_line_raw   s    	


rg   c             C   s  t  }t|| \}}t|dd}xV|D ]N}|rJtjj| rJtjj||}tjj|s&dd l}t	|j
tj|j
|q&W tjtj}x|t|j D ]l\}}	|jdrddlm}
 |t|
krt|
||	 n|jd|  qtt|rtt||	 qt|||	 qW |jr"t|dkr"|jd t|dkrD|j rD|jd	 tjrdt|dkrd|jd
 |jr|jr~|jd t|dkr|jd ||fS )NrD   rV   r   rP   r   )rO   zUnknown debug flag: %s
z3cython: Only one source file allowed when using -o
z&cython: Need at least one source file
z8cython: Only one source file allowed when using --embed
z3cython: Cannot use --module-name with --timestamps
z>cython: Only one source file allowed when using --module-name
)r[   rg   r   r/   pathisabsjoinexistserrnoFileNotFoundErrorENOENTstrerrorr   ZCompilationOptionsZdefault_optionsrW   itemsrX   rV   rO   dirr   rb   hasattrr=   rc   r8   r`   rL   rA   )r\   r   rd   rM   Zwork_dirsourcerl   r$   rZ   valuerO   r   r   r   parse_command_line   s>    







ru   )r   r   )
__future__r   sysr/   argparser   r   r   rV   r   version_infoIOErrorrm   r	   r   r(   r)   r,   r-   r2   r3   r[   rg   ru   r   r   r   r   <module>   s"   
	e$