Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/site-packages/Cython/Compiler/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/site-packages/Cython/Compiler/__pycache__/Main.cpython-35.pyc



Z��Z�x�C@s^ddlmZddlZddlZddlZddlZejdd�ddfkp�ddfejdd�ko�ddfknr�ejjde	ejdd���ej
d�yddlmZWne
k
r�eZYnXdd	lmZdd
lmZddlmZmZddlmZmZmZmZdd
lmZddlmZddlmZddlmZejZej d�Z!dZ"Gdd�de#�Z$Gdd�de#�Z%dd�Z&dd�Z'dddd�Z(Gdd�de#�Z)Gdd�de#�Z*Gd d!�d!e#�Z+Gd"d#�d#e,�Z-dd$d%�Z.d&d'�Z/ddd(d)�Z d*d+�Z0dd,d-�Z1e,d.dd/dd0dd1dd2dd3dd4dd5dd6dd7d8d9dd:dd;dd<id=id>d?d@d?dAdBdCdBdDddEd?dFd?dGddHddIddJddKddLddMd?�Z2dS)N�)�absolute_importN���z8Sorry, Cython requires Python 2.6+ or 3.3+, found %d.%d
�)�
basestring)�Errors)�
EncodedString)�PyrexScanner�FileSourceDescriptor)�
PyrexError�CompileError�error�warning)�ModuleScope)�Utils)�Options)�Versionz2[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$c@seZdZdS)�CompilationDataN)�__name__�
__module__�__qualname__�rr�G/opt/alt/python35/lib64/python3.5/site-packages/Cython/Compiler/Main.pyr*src@sZeZdZdZdddddd�Zdd�Zdd	d
�Zdd�Zd
d�Zdd�Z	dddddd�Z
ddd�Zdd�Zdd�Z
dddd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdS)6�ContextNFrTc
Cs�ddlm}m}d|ji|_|j|�|_|j|jd<||_t�|_	||_
||_||_i|_
i|_tjjtjjtjjtjjt�tjjd���}	||	g|_|j|�d|_dS)Nr)�Builtin�CythonScope�__builtin__�cython�Includes)�rrZ
builtin_scope�modulesZcreate_cython_scope�cython_scope�include_directories�set�future_directives�compiler_directives�cpp�options�pxds�	_interned�os�path�abspath�normpath�join�dirname�__file__�pardir�set_language_levelZgdb_debug_outputwriter)
�selfr#r&r'�language_levelr(Zcreate_testscoperr�standard_include_pathrrr�__init__Gs 						0
zContext.__init__cCsk||_|dkrgddlm}m}m}m}|jj||||g�|jd|jd<dS)Nrr)�print_function�unicode_literalsr�divisionr�builtins)	r5ZFuturer8r9rr:r%�updater!)r4�levelr8r9rr:rrrr3bs
	"zContext.set_language_levelcCs_t||f}y|j|SWntk
r2YnXt|�}|rN||_||j|<|S)N)r	r*�KeyError�encoding)r4�valuer?�keyrrr�intern_ustringis
	
zContext.intern_ustringcGsKt|�|f|}y|j|SWntk
r9YnX||j|<|S)N)�typer*r>)r4r@rArrr�intern_valueus

zContext.intern_valuec	Cs�ddlm}t|t�r|jdkrt||tj��}t||j	�}|j
||�}|j||�}n'|j|||�}|j||�}|S)Nr)�PipelineZpyx)
r rE�
isinstancerZ
_file_type�CompilationSourcer+�getcwd�create_default_resultobjr(Zcreate_pyx_as_pxd_pipeline�run_pipelineZcreate_pxd_pipeline)	r4�source_desc�scope�module_namerE�sourceZresult_sink�pipeline�resultrrr�process_pxd�szContext.process_pxdcCs
tj|�S)N)rZreport_error)r4�excrrr�nonfatal_error�szContext.nonfatal_errorrcCs�d}|r&td||||f�d}d}|rh|rP|j|�}	qn|j}	|}d}n|}	tj|	�s�t|p�|ddfd|��|r�|r�td�|j|�}|s�|j|	|�}|r�|j|�}|sB|rtd�|r|}	|}x&|	j	d�D]}
|j|
�}q)W|rVtd|�|j
s�|rotd�|s|r�td	�|j|	|d
|�}|r�td|�|r|rd|_
|j|	d
|�}|r�|jd�r�n t
|d|	jdtj��|r�d|_
y�|r:td|�|jdtj�tjj|�d}|j|�sx|}t||�}
|j|
||	�\}}|r�|�|\}}||f|j|<Wntk
r�YnX|S)NrzPContext.find_module: module_name = %s, relative_to = %s, pos = %s, need_pxd = %sz'%s' is not a valid module namez...trying relative importz...trying absolute import�.z
...scope = %sz...pxd not loadedz...looking for pxd file�sys_pathz......found %sTz.pyz__init__.pyz'%s.pxd' not foundzContext.find_module: Parsing %sr)�printZqualify_name�qualified_name�module_name_pattern�matchr
�lookup_submodule�
find_pxd_file�find_submodule�splitZpxd_file_loaded�search_include_directories�endswithr�replacer+�sepr,�splitextrrQr))r4rMZrelative_to�posZneed_pxdZabsolute_fallbackZdebug_find_modulerLZpxd_pathnamerW�nameZpackage_pathname�rel_pathrK�errrPZ
pxd_codenodesZ	pxd_scoperrr�find_module�s�			


	


	 	)
zContext.find_modulec
Csw|j|d|d|�}|dkrN|jd�sB|d
krNtjjtjjtjjtjjt�tjj	d���}tjj|d�}|j
j|�z|j|d|�}Wd|j
j�X|rN|}|jd�rt
|d	|d
�nI|dkr.t
|d||fd
�n |dkrNt
|d|d
�|dkrstjrs|j||�S|S)Nz.pxdrU�python�stdlib�stdio�stlr�
Deprecatedz!'%s' is deprecated, use 'cpython'rz!'%s' is deprecated, use 'libc.%s'z$'%s' is deprecated, use 'libcpp.*.*')rirjrk)rirj)r^�
startswithr+r,r-r.r/r0r1r2r#�append�poprrZcimport_from_pyx�
find_pyx_file)r4rWrcrU�pxdr6Zdeprecated_include_pathrdrrrr[�s,	0zContext.find_pxd_filecCs|j|d|�S)Nz.pyx)r^)r4rWrcrrrrp	szContext.find_pyx_filecCs6|j|d|dd�}|s2t|d|�|S)Nr �includeTz'%s' not found)r^r)r4�filenamercr,rrr�find_include_files
	zContext.find_include_filecCs%tjt|j�|||||�S)N)rr^�tupler#)r4rW�suffixrcrrrUrrrr^sz"Context.search_include_directoriescCs
tj|�S)N)r�find_root_package_dir)r4�	file_pathrrrrwszContext.find_root_package_dircCstj|t|��S)N)r�check_package_dirru)r4�dirZ
package_namesrrrryszContext.check_package_dirc	Cstjj|�sdStj|�}tj||�r;dS|g}tj|d�}tjj|�r~tj||�r~dSx~|j|�D]m\}}|dkr�|j||�}n$|dkr�|j	||�}nq�|r�tj||�r�dSq�WdS)Nrz.pxd�cimportrrr)
r+r,�existsrZmodification_timeZfile_newer_than�replace_suffix�read_dependency_filer[r^)	r4�source_pathZoutput_pathZc_timercZpxd_path�kindrd�dep_pathrrr�c_file_out_of_date"s$	$zContext.c_file_out_of_datecCsdd�|j|�D�S)NcSs(g|]\}}|dkr|�qS)r{r)�.0r�rdrrr�
<listcomp>8s		z7Context.find_cimported_module_names.<locals>.<listcomp>)r~)r4rrrr�find_cimported_module_names7sz#Context.find_cimported_module_namescCs
tj|�S)N)r�is_package_dir)r4Zdir_pathrrrr�;szContext.is_package_dircCsbtj|d�}tjj|�rZt|d�}dd�|j�D�}|j�|SfSdS)Nz.dep�rUcSs:g|]0}d|j�kr|j�jdd��qS)� r)�stripr])r��linerrrr�Bs	z0Context.read_dependency_file.<locals>.<listcomp>)rr}r+r,r|�open�	readlines�close)r4rr��f�chunksrrrr~>s	
zContext.read_dependency_filecCs|jj|d�S)N)r!�get)r4rdrrrrZJszContext.lookup_submodulecCs>|j|�}|s:t|ddd|�}||j|<|S)N�
parent_module�context)rZrr!)r4rdrLrrrr\Ns	
zContext.find_submodulec
CsCt|t�std��|j}|j|_tj}y�tj|���}ddl	m
}t||d|jd|d|�}	|j
|	||�}
|jjr�yddlm}Wntk
r�td	��YnX|j
|�WdQRXWn7tk
r&}z|j||��WYdd}~XnXtj|kr?t��|
S)
Nz$Only file sources for code supportedr)�ParsingZsource_encodingrLr�r)�ConcreteSyntaxTreezLFormal grammar can only be used with compiled Cython with an available pgen.)rFr�RuntimeErrorrsr'r�
num_errorsrZopen_source_filer r�r
r?Zp_moduler(�formal_grammar�Parserr��ImportError�UnicodeDecodeError�_report_decode_errorr
)
r4rKrLrq�full_module_name�source_filenamer�r�r��sZtreer��errr�parseWs.		
%	z
Context.parsecCs�|jd
}|jd}|jd}d}d}}tj|jddddd��\}	xRt|	d�D]A\}}
|t|
�7}||krk||t|
�d}PqkWWdQRXt|||fd	||f�S)Nrrr�rr?z	iso8859-1�newliner zqDecoding error, missing or incorrect coding=<encoding-name> at top of source (cannot decode with encoding %r: %s)���)�args�ior�rs�	enumerate�lenr)r4rKrR�msg�positionr?r��column�idxr��datarrrr�ts



$zContext._report_decode_errorc
Cs�tjj|�\}}tjj|�\}}d|kr@|S|g}xK|j|�r�tjj|�\}}	||kr�P|j|	�|}qLW|j�dj|�S)NrT)r+r,r]rbr�rn�reverser/)
r4r,r(rzrsrM�_�names�parent�package_namerrr�extract_module_name�s	


zContext.extract_module_namecCsUtj�|jr2tj|jd�}|_nd}tjd|d|j�dS)Nz.lisr,Zecho_to_stderr)	r�reset�use_listing_filerr}�main_source_file�listing_fileZopen_listing_file�errors_to_stderr)r4r(rPr,rrr�setup_errors�s
	zContext.setup_errorscCs�|jj}t|t�s'td��tj�tj|_|jdkrRd}|r�|jr�y#t	j
|jtj|j
��Wntk
r�YnXd|_dS)Nz$Only file sources for code supportedrT)�compilation_sourcerKrFrr�rZclose_listing_filer��c_filerZ
castrate_filer+�statrs�EnvironmentError)r4rfr(rPrKrrr�teardown_errors�s
#
zContext.teardown_errors)rrrr"r7r3rBrDrQrSrgr[rprtr^rwryr�r�r�r~rZr\r�r�r�r�r�rrrrr9s6	X!
		rcCs�|jrd}nd}tj||�}|jr�tjj||j�}tjj|�r|tjj|tjj|��S|Sn|SdS)Nz.cppz.c)	�cplusrr}�output_filer+r,r/�isdir�basename)r��cwdr(Zc_suffixZsuggested_file_nameZout_pathrrr�get_output_filename�s			r�cCsUt�}|jj|_||_|j}t|j|j|�|_|j|_|S)N)	�CompilationResultrKrsr�r�r�r�r��embedded_metadata)r�r(rPrKrrrrI�s				rIcCs�ddlm}tjj|�d}|j|dd��|dkrU|j�}tj�}tjj|�}|p�|j	||�}|j
r�|jdtj�|}|j
|�s�|}n|}t||�}	t|	||�}t||�}
|jdkrytjj|
j�dd}tjj|�rytj|ddd��%}d	|jd
�krrd|_WdQRX|j�dks�|r�|j|||
�}
n|j|||
�}
|j||
�|j|
|�\}}|j|||
�|
S)
Nr)rErTrz.htmlr�r?zUTF-8z<!-- Generated by Cython�dTz.py)r rEr+r,rb�configure_language_defaults�create_contextrHr-r��'relative_path_in_code_position_commentsr`rar_rrGrI�annotater�r|r�r��read�lowerZcreate_py_pipelineZcreate_pyx_pipeliner�rJr�)rNr(r�r�rEZ
source_extr�Zabs_pathrerKrPZ
html_filenameZ	html_filerOrfZenddatarrrrJ�s:		rJc@s"eZdZdZdd�ZdS)rGzk
    Contains the data necessary to start up a compilation pipeline for
    a single compilation unit.
    cCs||_||_||_dS)N)rKr�r�)r4rKr�r�rrrr7s		zCompilationSource.__init__N)rrr�__doc__r7rrrrrG�srGc@s=eZdZdZddd�Zdd�Zdd�ZdS)	�CompilationOptionsar
    Options to the Cython compiler:

    show_version      boolean   Display version number
    use_listing_file  boolean   Generate a .lis file
    errors_to_stderr  boolean   Echo errors to stderr when using .lis
    include_path      [string]  Directories to search for include files
    output_file       string    Name of generated .c file
    generate_pxi      boolean   Generate .pxi file for public declarations
    capi_reexport_cincludes
                      boolean   Add cincluded headers to any auto-generated
                                header files.
    timestamps        boolean   Only compile changed source files.
    verbose           boolean   Always print source names being compiled
    compiler_directives  dict   Overrides for pragma options (see Options.py)
    embedded_metadata    dict   Metadata to embed in the C file as json.
    evaluate_tree_assertions boolean  Test support: evaluate parse tree assertions
    language_level    integer   The Python language level: 2 or 3
    formal_grammar    boolean  Parse the file with the formal grammar

    cplus             boolean   Compile as c++ code
    Nc	Ks�g|_|r*t|t�r0|j}nt}t|�}|j|�t|�tt�}|jdg�|r�dt	|�dkr�dnddj
|�f}t|��t|d�}t|�ttj
��}|r!dt	|�dkr�dnddj
|�f}t|��||d<|jd	d
�rk|drkddl}|jd
�d|d<d|kr�d|kr�t|d�|d<d|kr�d|kr�|d|d<|ddkr�tjjd�|d<|jj|�dS)N�include_pathz3got unknown compilation option%s, please remove: %srr�r z, r&z$got unknown compiler directive%s: %s�
np_pythranFr�rz%C++ mode forced when in Pythran mode!Tr5r��cachez
~/.cycache)r�rFr��__dict__�default_options�dictr<r$�difference_updater�r/�
ValueErrorr�get_directive_defaultsr��warnings�warn�intr+r,�
expanduser)	r4�defaults�kwr(Zunknown_options�message�
directivesZunknown_directivesr�rrrr7!sB	



zCompilationOptions.__init__cCs5|dkr1|jjd�dkr1d|jd<dS)N�pyZbindingT)r&r�)r4Zsource_extensionrrrr�Msz.CompilationOptions.configure_language_defaultscCs%t|j|j|j|jd|�S)Nr()rr�r&r�r5)r4rrrr�Rsz!CompilationOptions.create_context)rrrr�r7r�r�rrrrr�	s,r�c@s"eZdZdZdd�ZdS)r�af
    Results from the Cython compiler:

    c_file           string or None   The generated C source file
    h_file           string or None   The generated C header file
    i_file           string or None   The generated .pxi file
    api_file         string or None   The generated C API .h file
    listing_file     string or None   File of error messages
    object_file      string or None   Result of compiling the C file
    extension_file   string or None   Result of linking the object file
    num_errors       integer          Number of compilation errors
    compilation_source CompilationSource
    cCsLd|_d|_d|_d|_d|_d|_d|_d|_dS)N)r�Zh_fileZi_fileZapi_filer�Zobject_fileZextension_filer�)r4rrrr7fs							zCompilationResult.__init__N)rrrr�r7rrrrr�Ws
r�c@s(eZdZdZdZdd�ZdS)�CompilationResultSetz�
    Results from compiling multiple Pyrex source files. A mapping
    from source file paths to CompilationResult instances. Also
    has the following attributes:

    num_errors   integer   Total number of compilation errors
    rcCs |||<|j|j7_dS)N)r�)r4rNrPrrr�add|s
zCompilationResultSet.addN)rrrr�r�r�rrrrr�qsr�cCst|||�S)z�
    compile_single(source, options, full_module_name)

    Compile the given Pyrex implementation file and return a CompilationResult.
    Always compiles a single file; does not perform timestamp checking or
    recursion.
    )rJ)rNr(r�rrr�compile_single�sr�cCsdd�|D�}t�}t�}|j}|j}d}tj�}x�|D]�}||krP|dkrz|j�}t|||�}	|j||	�}
|s�|
r�|r�t	j
jd|�t||d|�}|j
||�d}|j
|�qPW|S)z�
    compile_multiple(sources, options)

    Compiles the given sequence of Pyrex implementation files and returns
    a CompilationResultSet. Performs timestamp checking and/or recursion
    if these are specified in the options.
    cSs"g|]}tjj|��qSr)r+r,r-)r�rNrrrr��s	z$compile_multiple.<locals>.<listcomp>Nz
Compiling %s
r�)r$r��
timestamps�verboser+rHr�r�r��sys�stderr�writerJr�)�sourcesr(�	processed�resultsr�r�r�r�rN�output_filenameZout_of_daterPrrr�compile_multiple�s*
				

r�cKsLtd||�}t|t�r;|jr;t|||�St||�SdS)a�
    compile(source [, options], [, <option> = <value>]...)

    Compile one or more Pyrex implementation files, with optional timestamp
    checking and recursing on dependencies.  The source argument may be a string
    or a sequence of strings.  If it is a string and no recursion or timestamp
    checking is requested, a CompilationResult is returned, otherwise a
    CompilationResultSet is returned.
    r�N)r�rFrr�r�r�)rNr(r��kwdsrrr�compile�s
r�cCs
tdd�S)N�command_liner)�mainrrrr�setuptools_main�sr�cCstjdd�}d}|rDddlm}||�\}}ntt�}|}|jrstjjdt	�|j
dkr�tj|j
�y(t
||�}|jdkr�d}WnKttfk
r}z%tjjt|�d�d}WYdd}~XnX|rtjd�dS)Nrr)�parse_command_linezCython version %s
r �
)r��argvZCmdLiner�r�r��show_versionr�r��version�working_pathr+�chdirr�r�r�r�str�exit)r�r�Zany_failuresr�r(r�rPr�rrrr��s(	
r�r�r�r�r�r�r�Zannotate_coverage_xml�generate_pxiZcapi_reexport_cincludesr�r r�r��quietr&r�Zevaluate_tree_assertionsF�
emit_linenumsr�T�c_line_in_tracebackr5r��	gdb_debug�compile_time_envZcommon_utility_include_dir�
output_dir�	build_dirr�Zcreate_extensionr�)3�
__future__rr+�rer�r��version_infor�r�rur�rrr�r�r rZStringEncodingr	ZScanningr
rrr
rrZSymtabrrrrr�r�rXr��objectrrr�rIrJrGr�r�r�r�r�r�r�r�r�rrrr�<module>s�T'

"	�x3N$