3
[&                 @   s@   d dl mZ d dlZd dlZddlmZ dZdd Zdd	 ZdS )
    )absolute_importN   )Optionsae  Cython (http://cython.org) is a compiler for code written in the
Cython language.  Cython is based on Pyrex by Greg Ewing.

Usage: cython [options] sourcefile.{pyx,py} ...

Options:
  -V, --version                  Display version number of cython compiler
  -l, --create-listing           Write error messages to a listing file
  -I, --include-dir <directory>  Search for include files in named directory
                                 (multiple include directories are allowed).
  -o, --output-file <filename>   Specify name of generated C file
  -t, --timestamps               Only compile newer source files
  -f, --force                    Compile all source files (overrides implied -t)
  -v, --verbose                  Be verbose, print file names on multiple compilation
  -p, --embed-positions          If specified, the positions in Cython files of each
                                 function definition is embedded in its docstring.
  --cleanup <level>              Release interned objects on python exit, for memory debugging.
                                 Level indicates aggressiveness, default 0 releases nothing.
  -w, --working <directory>      Sets the working directory for Cython (the directory modules
                                 are searched from)
  --gdb                          Output debug information for cygdb
  --gdb-outdir <directory>       Specify gdb debug information output directory. Implies --gdb.

  -D, --no-docstrings            Strip docstrings from the compiled module.
  -a, --annotate                 Produce a colorized HTML version of the source.
  --annotate-coverage <cov.xml>  Annotate and include coverage information from cov.xml.
  --line-directives              Produce #line directives pointing to the .pyx source
  --cplus                        Output a C++ rather than C file.
  --embed[=<method_name>]        Generate a main() function that embeds the Python interpreter.
  -2                             Compile based on Python-2 syntax and code semantics.
  -3                             Compile based on Python-3 syntax and code semantics.
  --3str                         Compile based on Python-3 syntax and code semantics without
                                 assuming unicode by default for string literals under Python 2.
  --lenient                      Change some compile time errors to runtime errors to
                                 improve Python compatibility
  --capi-reexport-cincludes      Add cincluded headers to any auto-generated header files.
  --fast-fail                    Abort the compilation on the first error
  --warning-errors, -Werror      Make all warnings into errors
  --warning-extra, -Wextra       Enable extra warnings
  -X, --directive <name>=<value>[,<name=value,...] Overrides a compiler directive
  -E, --compile-time-env name=value[,<name=value,...] Provides compile time env like DEF would do.
c               C   s   t jjt t jd d S )Nr   )sysstderrwriteusageexit r
   r
   g/home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python3.6/site-packages/Cython/Compiler/CmdLine.py	bad_usage>   s    r   c                s  ddl m}m} g  fdddP fdd	}fdd}||}g }x r, d	 jd
r }|dQkr|d|_q*|dRkrd|_q*|dSkrd|_q*|dkr|dt_q*|jdr|j	j
|| q*|dkr|j	j
|  q*|dTkr| |_q*|dUkr| |_q*|dVkr.d|_q*|dWkrBd	|_q*|dXkr^| jd7  _q*|dYkrrdt_q*|dZkr| t_q*|d#krt| t_q*|d[krd&t_q*|d\krd)t_q*|d*krd)t_| t_q*|d+krd)t_q*|d,krd)|_q*|d-kr"d&|_q*|d.kr>d)|_tj|_q*|d/krZd)|_| |_q*|d0krtd&t_d&t_q*|d1krd2|_q*|d3krd4|_q*|d5krd6|_q*|d7krd)|_ q*|d8krd)t_!q*|d9krd)t_"q*|d]kr d)t_#q*|d^kr|j$j%tj& q*|d>kr0d)t_'q*|d?ksF|jd@r|jd@rr|d2d  j( rr|d2d  }n| }ytj)|d)|j$dA|_$W nD t*k
r }	 z&t+j,j-dB|	j.d	   t+j/d W Y d d }	~	X nX q*|dCks|jdDr|jdDr|d2d  j( r|d2d  }n| }ytj0||j1dE|_1W nD t*k
r| }	 z&t+j,j-dF|	j.d	   t+j/d W Y d d }	~	X nX n|jdGr|d2d  j2d
dH}ddIl3m4}
 |t5|
krt6|
|d) nt+j,j-dJ|  t7  n<|d_krt+j8j-t9 t+j/d	 nt+j,j-dM|  t+j/d qN|j
  qNW r:t7  |jrft:|dkrft+j,j-dN t+j/d t:|d	kr|j rt7  tjrt:|dkrt+j,j-dO t+j/d ||fS )`Nr   )CompilationOptionsdefault_optionsc                 sX     s
rt   d d krN d jdrN jdjdd\} }j| | S  jdS )N=r   z--r   )r   
startswithpopsplitappend)namevalue)argspending_argr
   r   pop_argH   s    

z#parse_command_line.<locals>.pop_argc                s,   rj  S | d k	r| S  s"t   j dS )Nr   )r   r   )default)r   r   r
   r   	pop_valueQ   s    z%parse_command_line.<locals>.pop_valuec                s   | dd  }|r|S   S d S )N   r
   )optiontail)r   r
   r   	get_paramZ   s    z%parse_command_line.<locals>.get_paramr   --V	--version-l--create-listing-+--cplusz--embedmainz-Iz--include-dir-w	--working-o--output-file-t--timestamps-f--force-v	--verbose-p--embed-positions-z--pre-importz	--cleanup-D--no-docstringsF-a
--annotateTz--annotate-coveragez--convert-rangez--line-directivesz--no-c-in-tracebackz--gdbz--gdb-outdirz	--lenientz-2r   z-3   z--3str3strz--capi-reexport-cincludesz--fast-failz--cimport-from-pyx-Werror--warning-errors-Wextra--warning-extraz--old-style-globalsz--directivez-X)relaxed_boolcurrent_settingsz Error in compiler directive: %s
z--compile-time-envz-E)r@   zError in compile-time-env: %s
z--debug_)
DebugFlagszUnknown debug flag: %s
-h--helpzUnknown compiler flag: %s
z3cython: Only one source file allowed when using -o
z7cython: Only one source file allowed when using -embed
)N)r    r!   )r"   r#   )r$   r%   )r'   r(   )r)   r*   )r+   r,   )r-   r.   )r/   r0   )r1   r2   )r3   r4   )r5   r6   )r7   r8   )r;   r<   )r=   r>   )rC   rD   );Mainr   r   r   show_versionuse_listing_filecplusr   embedinclude_pathr   working_pathoutput_file
timestampsverboseembed_pos_in_docstring
pre_importintgenerate_cleanup_code
docstringsannotateannotate_coverage_xmlconvert_rangeemit_linenumsc_line_in_traceback	gdb_debugoscurdir
output_direrror_on_unknown_nameserror_on_uninitializedlanguage_levelcapi_reexport_cincludes	fast_failcimport_from_pyxwarning_errorscompiler_directivesupdateextra_warningsold_style_globalsstripparse_directive_list
ValueErrorr   r   r   r   r	   parse_compile_time_envcompile_time_envreplace rB   dirsetattrr   stdoutr   len)r   r   r   r   r   optionssourcesr   Zx_argserB   r
   )r   r   r   r   parse_command_lineC   s    		















































 


rv   )	
__future__r   rZ   r   rn   r   r   r   rv   r
   r
   r
   r   <module>   s   ,	