Файловый менеджер - Редактировать - /home/digitalm/venv/lib/python3.7/site-packages/setuptools/_distutils/__pycache__/ccompiler.cpython-37.pyc
Назад
B �5�g� � @ s� d Z ddlZddlZddlZddlZddlmZmZmZm Z m Z ddlmZ ddlm Z ddlmZ ddlmZ dd lmZmZ dd lmZ G dd� d�Zd Zddd�Zdddddd�Zdd� Zddd�Zdd� Zdd� ZdS ) z�distutils.ccompiler Contains CCompiler, an abstract base class that defines the interface for the Distutils compiler abstraction model.� N� )�CompileError� LinkError�UnknownFileError�DistutilsPlatformError�DistutilsModuleError)�spawn)� move_file)�mkpath)�newer_group)�split_quoted�execute)�logc @ s, e Zd ZdZdZdZdZdZdZdZ dZ dZdddddd�ZdddgZ g Zg Zdwdd �Zd d� Zdd � Zdd� Zdd� Zdxdd�Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zd d!� Zd"d#� Zd$d%� Zd&d'� Zd(d)� Z d*d+� Z!d,d-� Z"d.d/� Z#dyd0d1�Z$d2d3� Z%d4d5� Z&d6d7� Z'd8d9� Z(dzd:d;�Z)d{d<d=�Z*d>d?� Z+d|d@dA�Z,dBZ-dCZ.dDZ/d}dEdF�Z0d~dGdH�Z1ddIdJ�Z2d�dKdL�Z3dMdN� Z4dOdP� Z5dQdR� Z6d�dSdT�Z7d�dUdV�Z8d�dXdY�Z9e:dZd[� �Z;d\d]� Z<e=d^d_� �Z>d�d`da�Z?d�dbdc�Z@d�dedf�ZAd�dhdi�ZBdjdk� ZCdldm� ZDd�dndo�ZEdpdq� ZFdrds� ZGd�dudv�ZHdS )�� 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 �� D ]}| �|| 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 �G/tmp/pip-install-251nq386/setuptools/setuptools/_distutils/ccompiler.py�__init__j s zCCompiler.__init__c K s@ x:|D ]2}|| j kr(td|| jjf ��| �||| � 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_executables� 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 )r �name�i�defnr r r! �_find_macro� s zCCompiler._find_macroc C sd x^|D ]V}t |t�rHt|�dkrHt |d t�s:|d dkrHt |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 � r Nr zinvalid macro definition '%s': z.must be tuple (string,), (string, string), or z(string, None))r( �tuple�lenr) � TypeError)r Zdefinitionsr. r r r! �_check_macro_definitions� s z"CCompiler._check_macro_definitionsc C s. | � |�}|dk r| j|= | j�||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+ r- r r r! �define_macro� s zCCompiler.define_macroc C s0 | � |�}|dk r| j|= |f}| j�|� dS )a� Undefine a preprocessor macro for all compilations driven by this compiler object. If the same macro is defined by 'define_macro()' and undefined by 'undefine_macro()' the last call takes precedence (including multiple redefinitions or undefinitions). If the macro is redefined/undefined on a per-compilation basis (ie. in the call to 'compile()'), then that takes precedence. N)r/ r r5 )r r, r- Zundefnr r r! �undefine_macro� s zCCompiler.undefine_macroc C s | j �|� dS )z�Add 'dir' to the list of directories that will be searched for header files. The compiler is instructed to search directories in the order in which they are supplied by successive calls to 'add_include_dir()'. N)r r5 )r �dirr r r! �add_include_dir� s zCCompiler.add_include_dirc C s |dd� | _ dS )ay Set the list of directories that will be searched to 'dirs' (a list of strings). Overrides any preceding calls to 'add_include_dir()'; subsequence calls to 'add_include_dir()' add to the list passed to 'set_include_dirs()'. This does not affect any list of standard include directories that the compiler may search by default. N)r )r �dirsr r r! �set_include_dirs� s zCCompiler.set_include_dirsc C s | j �|� dS )a� Add 'libname' to the list of libraries that will be included in all links driven by this compiler object. Note that 'libname' should *not* be the name of a file containing a library, but the name of the library itself: the actual filename will be inferred by the linker, the compiler, or the compiler class (depending on the platform). The linker will be instructed to link against libraries in the order they were supplied to 'add_library()' and/or 'set_libraries()'. It is perfectly valid to duplicate library names; the linker will be instructed to link against libraries as many times as they are mentioned. N)r r5 )r �libnamer r r! �add_library s zCCompiler.add_libraryc C s |dd� | _ dS )z�Set the list of libraries to be included in all links driven by this compiler object to 'libnames' (a list of strings). This does not affect any standard system libraries that the linker may include by default. N)r )r Zlibnamesr r r! � set_libraries s zCCompiler.set_librariesc C s | j �|� dS )a' Add 'dir' to the list of directories that will be searched for libraries specified to 'add_library()' and 'set_libraries()'. The linker will be instructed to search for libraries in the order they are supplied to 'add_library_dir()' and/or 'set_library_dirs()'. N)r r5 )r r8 r r r! �add_library_dir s zCCompiler.add_library_dirc C s |dd� | _ dS )z�Set the list of library search directories to 'dirs' (a list of strings). This does not affect any standard library search path that the linker may search by default. N)r )r r: r r r! �set_library_dirs' s zCCompiler.set_library_dirsc C s | j �|� dS )zlAdd 'dir' to the list of directories that will be searched for shared libraries at runtime. N)r r5 )r r8 r r r! �add_runtime_library_dir. s z!CCompiler.add_runtime_library_dirc C s |dd� | _ dS )z�Set the list of directories to search for shared libraries at runtime to 'dirs' (a list of strings). This does not affect any standard search path that the runtime linker may search by default. N)r )r r: r r r! �set_runtime_library_dirs4 s z"CCompiler.set_runtime_library_dirsc C s | j �|� dS )z�Add 'object' to the list of object files (or analogues, such as explicitly named library files or the output of "resource compilers") to be included in every link driven by this compiler object. N)r r5 )r �objectr r r! �add_link_object< s zCCompiler.add_link_objectc C s |dd� | _ dS )z�Set the list of object files (or analogues) to be included in every link to 'objects'. This does not affect any standard object files that the linker may include by default (such as system libraries). N)r )r r r r r! �set_link_objectsD s zCCompiler.set_link_objectsc C s� | � |||�\}}}|dkr g }| j|d|d�}t|�t|�ksDt�t||�}i } xRtt|��D ]B} || }|| }tj�|�d } | � tj� |�� || f| |<