Your IP : 18.117.91.170
3
\7� � @ s� d Z ddlZddlZddlZddlT ddlmZ ddlmZ ddl m
Z
ddlmZm
Z
ddlmZmZ dd lmZ G d
d� d�Zd-Zd.dd�Zd/d0d1d2d3d!�Zd"d#� Zd4d$d%�Zd&d'� Zd(d)� ZdS )5z�distutils.ccompiler
Contains CCompiler, an abstract base class that defines the interface
for the Distutils compiler abstraction model.� N)�*)�spawn)� move_file)�mkpath)�newer_pairwise�newer_group)�split_quoted�execute)�logc
@ s e Zd ZdZdZdZdZdZdZdZ dZ
dZdddddd�ZdddgZ
dqdd �Zd
d� Zdd
� Zdd� Zdd� Zdrdd�Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zd d!� Zd"d#� Zd$d%� Zd&d'� Zd(d)� Zd*d+� Zd,d-� Z d.d/� Z!dsd0d1�Z"d2d3� Z#d4d5� Z$d6d7� Z%d8d9� Z&dtd:d;�Z'dud<d=�Z(d>d?� Z)dvd@dA�Z*dBZ+dCZ,dDZ-dwdEdF�Z.dxdGdH�Z/dydIdJ�Z0dzdKdL�Z1dMdN� Z2dOdP� Z3dQdR� Z4d{dSdT�Z5d|dUdV�Z6d}dXdY�Z7d~dZd[�Z8dd\d]�Z9d�d_d`�Z:d�dbdc�Z;ddde� Z<dfdg� Z=d�dhdi�Z>djdk� Z?dldm� Z@d�dodp�ZAdS )�� CCompilera� Abstract base class to define the interface that must be implemented
by real compiler classes. Also has some utility methods used by
several compiler classes.
The basic idea behind a compiler abstraction class is that each
instance can be used for all the compile/link steps in building a
single project. Thus, attributes common to all of those compile and
link steps -- include directories, macros to define, libraries to link
against, etc. -- are attributes of the compiler instance. To allow for
variability in how individual files are treated, most of those
attributes may be varied on a per-compilation or per-link basis.
N�czc++Zobjc)z.cz.ccz.cppz.cxxz.mr c C sf || _ || _|| _d | _g | _g | _g | _g | _g | _g | _ x$| j
j� D ]}| j|| j
| � qHW d S )N)
�dry_run�force�verbose�
output_dir�macros�include_dirs� libraries�library_dirs�runtime_library_dirs�objects�executables�keys�set_executable)�selfr r
r �key� r �+/usr/lib64/python3.6/distutils/ccompiler.py�__init__U s zCCompiler.__init__c K s@ x:|D ]2}|| j kr(td|| jjf ��| j||| � qW dS )a� Define the executables (and options for them) that will be run
to perform the various stages of compilation. The exact set of
executables that may be specified here depends on the compiler
class (via the 'executables' class attribute), but most will have:
compiler the C/C++ compiler
linker_so linker used to create shared objects and libraries
linker_exe linker used to create binary executables
archiver static library creator
On platforms with a command-line (Unix, DOS/Windows), each of these
is a string that will be split into executable name and (optional)
list of arguments. (Splitting the string is done similarly to how
Unix shells operate: words are delimited by spaces, but quotes and
backslashes can override this. See
'distutils.util.split_quoted()'.)
z$unknown executable '%s' for class %sN)r �
ValueError� __class__�__name__r )r �kwargsr r r r �set_executablesy s
zCCompiler.set_executablesc C s, t |t�rt| |t|�� nt| ||� d S )N)�
isinstance�str�setattrr )r r �valuer r r r � s
zCCompiler.set_executablec C s0 d}x&| j D ]}|d |kr |S |d7 }qW d S )Nr � )r )r �name�i�defnr r r �_find_macro� s zCCompiler._find_macroc C sd x^|D ]V}t |t�oFt|�dkoFt |d t�s:|d dkoFt |d t�std| d d ��qW dS ) z�Ensures that every element of 'definitions' is a valid macro
definition, ie. either (name,value) 2-tuple or a (name,) tuple. Do
nothing if all definitions are OK, raise TypeError otherwise.
r( � Nr zinvalid macro definition '%s': z.must be tuple (string,), (string, string), or z(string, None))r( r- )r$ �tuple�lenr% � TypeError)r Zdefinitionsr+ r r r �_check_macro_definitions� s
z"CCompiler._check_macro_definitionsc C s. | j |�}|dk r| j|= | jj||f� dS )a_ Define a preprocessor macro for all compilations driven by this
compiler object. The optional parameter 'value' should be a
string; if it is not supplied, then the macro will be defined
without an explicit value and the exact outcome depends on the
compiler used (XXX true? does ANSI say anything about this?)
N)r, r �append)r r) r'