%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/setuptools/_distutils/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/setuptools/_distutils/__pycache__/ccompiler.cpython-312.pyc

�


_�d�����dZddlZddlZddlZddlZddlmZmZmZm	Z	m
Z
ddlmZddlm
Z
ddlmZddlmZdd	lmZmZdd
lmZGd�d�Zd
Zdd�Zdddddd�Zd�Zdd�Zd�Zd�Zy)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�B�eZdZdZdZdZdZdZdZdZ	dZ
dZdddddd�Zgd�Z
gZ	gZ	d?d�Zd	�Zd
�Zd�Zd�Zd@d
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#d@d�Z$d�Z%d�Z&d�Z'd �Z(					dAd!�Z)							dBd"�Z*d#�Z+	dCd$�Z,d%Z-d&Z.d'Z/										dDd(�Z0										dDd)�Z1										dDd*�Z2								dEd+�Z3d,�Z4d-�Z5d.�Z6				dFd/�Z7dGd0�Z8dHd1�Z9e:d2��Z;d3�Z<e=d4��Z>dHd5�Z?dHd6�Z@	dId7�ZAdJd8�ZBd9�ZCd:�ZDdKd;�ZEd<�ZFd=�ZGdLd>�ZHy)M�	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�c�c++�objc)�.cz.ccz.cppz.cxxz.m)rrrc��||_||_||_d|_g|_g|_g|_g|_g|_g|_	|jj�D]!}|j||j|��#y�N)
�dry_run�force�verbose�
output_dir�macros�include_dirs�	libraries�library_dirs�runtime_library_dirs�objects�executables�keys�set_executable)�selfrrr�keys     �A/usr/lib/python3/dist-packages/setuptools/_distutils/ccompiler.py�__init__zCCompiler.__init__js��������
�������������������%'��!�����#�#�(�(�*�	<�C�����T�%5�%5�c�%:�;�	<�c��|D]J}||jvr%td|�d|jj����|j	|||��Ly)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()'.)
        zunknown executable 'z' for class N)r"�
ValueError�	__class__�__name__r$)r%�kwargsr&s   r'�set_executableszCCompiler.set_executables�sX��4�	2�C��$�*�*�*� ��D�N�N�3�3�5���
����V�C�[�1�
	2r)c�l�t|t�rt||t|��yt|||�yr)�
isinstance�str�setattrr
)r%r&�values   r'r$zCCompiler.set_executable�s)���e�S�!��D�#�|�E�2�3��D�#�u�%r)c�L�d}|jD]}|d|k(r|cS|dz
}�y)Nrr)r)r%�name�i�defns    r'�_find_macrozCCompiler._find_macro�s8��
���K�K�	�D��A�w�$����
��F�A�	�r)c���|D]^}t|t�r9t|�dvr,t|dt�s|d�t|dt�r�Lt	d|zdzdz��y)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�rNrzinvalid macro definition '%s': z.must be tuple (string,), (string, string), or z(string, None))r1�tuple�lenr2�	TypeError)r%�definitionsr8s   r'�_check_macro_definitionsz"CCompiler._check_macro_definitions�ss��
 �
	�D��4��'���I��'�#�D��G�S�1�T�!�W�_��t�A�w��,��6��=�F�G�&�'���
	r)c�~�|j|�}|�
|j|=|jj||f�y)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�r9r�append)r%r6r4r7s    r'�define_macrozCCompiler.define_macro�s:��
���T�"���=����A�������D�%�=�)r)c��|j|�}|�
|j|=|f}|jj|�y)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.
        NrB)r%r6r7�undefns    r'�undefine_macrozCCompiler.undefine_macro�s=��
���T�"���=����A����������6�"r)c�:�|jj|�y)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)rrC�r%�dirs  r'�add_include_dirzCCompiler.add_include_dir����	
��� � ��%r)c��|dd|_y)aySet 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%�dirss  r'�set_include_dirszCCompiler.set_include_dirs�s��!��G��r)c�:�|jj|�y)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)rrC)r%�libnames  r'�add_libraryzCCompiler.add_librarys��	
�����g�&r)c��|dd|_y)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%�libnamess  r'�
set_librarieszCCompiler.set_librariess��"�!���r)c�:�|jj|�y)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)rrCrIs  r'�add_library_dirzCCompiler.add_library_dirrLr)c��|dd|_y)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)rrOs  r'�set_library_dirszCCompiler.set_library_dirs's��
!��G��r)c�:�|jj|�y)zlAdd 'dir' to the list of directories that will be searched for
        shared libraries at runtime.
        N)r rCrIs  r'�add_runtime_library_dirz!CCompiler.add_runtime_library_dir.s��	
�!�!�(�(��-r)c��|dd|_y)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 rOs  r'�set_runtime_library_dirsz"CCompiler.set_runtime_library_dirs4s��%)��G��!r)c�:�|jj|�y)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!rC)r%�objects  r'�add_link_objectzCCompiler.add_link_object<s��	
�����F�#r)c��|dd|_y)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!s  r'�set_link_objectszCCompiler.set_link_objectsDs���q�z��r)c��|j|||�\}}}|�g}|j|d|��}t|�t|�k(sJ�t||�}i}	t	t|��D]c}
||
}||
}t
jj|�d}
|jt
jj|��||
f|	|<�e|||||	fS)z;Process arguments and decide which source files to compile.r)�	strip_dirrr)
�_fix_compile_args�object_filenamesr=�gen_preprocess_options�range�os�path�splitextr�dirname)r%�outdirr�incdirs�sources�depends�extrar!�pp_opts�buildr7�src�obj�exts              r'�_setup_compilezCCompiler._setup_compileQs���"&�"8�"8����"Q������=��E��'�'��1��'�P���7�|�s�7�|�+�+�+�(���9�����s�7�|�$�	$�A��!�*�C��!�*�C��'�'�"�"�3�'��*�C��K�K�������,�-��s��E�#�J�	$��w��w��5�5r)c�0�|dgz}|rdg|dd|r||dd|S)Nz-cz-gr�)r%rt�debug�before�cc_argss     r'�_get_cc_argszCCompiler._get_cc_argshs1���T�F�"����&�G�B�Q�K�� �G�B�Q�K��r)c��|�
|j}nt|t�std��|�
|j}n/t|t
�r||jxsgz}ntd��|�t|j�}n>t|t
tf�rt|�|jxsgz}ntd��||jjz
}|||fS)a'Typecheck and fix-up some of the arguments to the 'compile()'
        method, and return fixed-up values.  Specifically: if 'output_dir'
        is None, replaces it with 'self.output_dir'; ensures that 'macros'
        is a list, and augments it with 'self.macros'; ensures that
        'include_dirs' is a list, and augments it with 'self.include_dirs'.
        Guarantees that the returned values are of the correct type,
        i.e. for 'output_dir' either string or None, and for 'macros' and
        'include_dirs' either list or None.
        �%'output_dir' must be a string or Nonez/'macros' (if supplied) must be a list of tuplesz6'include_dirs' (if supplied) must be a list of strings)	rr1r2r>r�listrr<r,)r%rrrs    r'rgzCCompiler._fix_compile_argsqs��������J��J��,��C�D�D��>��[�[�F�
���
%��t�{�{�0�b�1�F��M�N�N����� 1� 1�2�L�
��t�U�m�
4���-��1B�1B�1H�b�I�L��T�U�U�	����3�3�3���6�<�/�/r)c�b�|j||��}t|�t|�k(sJ�|ifS)a,Decide which source files must be recompiled.

        Determine the list of object files corresponding to 'sources',
        and figure out which ones really need to be recompiled.
        Return a list of all object files and a dictionary telling
        which source files can be skipped.
        �r)rhr=)r%rqrrrr!s     r'�
_prep_compilezCCompiler._prep_compile�s;���'�'��J�'�G���7�|�s�7�|�+�+�+���{�r)c��t|ttf�std��t|�}|�|j}||fSt|t
�std��||fS)z�Typecheck and fix up some arguments supplied to various methods.
        Specifically: ensure that 'objects' is a list; if output_dir is
        None, replace with self.output_dir.  Return fixed versions of
        'objects' and 'output_dir'.
        z,'objects' must be a list or tuple of stringsr�)r1r�r<r>rr2)r%r!rs   r'�_fix_object_argszCCompiler._fix_object_args�sf���'�D�%�=�1��J�K�K��w�-�������J���$�$��J��,��C�D�D���$�$r)c��|�
|j}n>t|ttf�rt|�|jxsgz}nt	d��|�
|j
}n>t|ttf�rt|�|j
xsgz}nt	d��||jj
z
}|�
|j}n>t|ttf�rt|�|jxsgz}nt	d��|||fS)a;Typecheck and fix up some of the arguments supplied to the
        'link_*' methods.  Specifically: ensure that all arguments are
        lists, and augment them with their permanent versions
        (eg. 'self.libraries' augments 'libraries').  Return a tuple with
        fixed versions of all arguments.
        z3'libraries' (if supplied) must be a list of stringsz6'library_dirs' (if supplied) must be a list of stringsz>'runtime_library_dirs' (if supplied) must be a list of strings)rr1r�r<r>rr,r )r%rrr s    r'�
_fix_lib_argszCCompiler._fix_lib_args�s�������I�
�	�D�%�=�
1��Y��4�>�>�+?�R�@�I��Q�R�R����,�,�L�
��t�U�m�
4���-��1B�1B�1H�b�I�L��T�U�U�	����3�3�3���'�#'�#<�#<� �
�,�t�U�m�
<�#'�(<�#=��)�)�/�R�$� ��S��
��<�)=�>�>r)c�p�|jry|jrt||d��}|St||�}|S)zjReturn true if we need to relink the files listed in 'objects'
        to recreate 'output_file'.
        T�newer)�missing)rrr)r%r!�output_filer�s    r'�
_need_linkzCCompiler._need_link�s=���:�:���|�|�#�G�[�'�J���L�$�G�[�9���Lr)c�J�t|t�s|g}d}t|j�}|D]d}tj
j
|�\}}|jj|�}	|jj|�}||kr|}|}�f|S#t$rY�twxYw)z|Detect the language of a given file, or list of files. Uses
        language_map, and language_order to do the job.
        N)r1r�r=�language_orderrkrlrm�language_map�get�indexr+)	r%rq�langr��source�baserx�extlang�extindexs	         r'�detect_languagezCCompiler.detect_language�s����'�4�(��i�G����D�'�'�(���		�F����(�(��0�I�D�#��'�'�+�+�C�0�G�
��.�.�4�4�W�=���e�#�"�D�$�E��		�����
��
�s�.$B�	B"�!B"c��y)a�Preprocess a single C/C++ source file, named in 'source'.
        Output will be written to file named 'output_file', or stdout if
        'output_file' not supplied.  'macros' is a list of macro
        definitions as for 'compile()', which will augment the macros set
        with 'define_macro()' and 'undefine_macro()'.  'include_dirs' is a
        list of directory names that will be added to the default list.

        Raises PreprocessError on failure.
        Nr{)r%r�r�rr�
extra_preargs�extra_postargss       r'�
preprocesszCCompiler.preprocess�s��$	
r)c		���|j||||||�\}}	}}
}|j|
||�}|	D]!}
	||
\}}|j|
|||||
��#|	S#t$rY�1wxYw)aK	Compile one or more source files.

        'sources' must be a list of filenames, most likely C/C++
        files, but in reality anything that can be handled by a
        particular compiler and compiler class (eg. MSVCCompiler can
        handle resource files in 'sources').  Return a list of object
        filenames, one per source filename in 'sources'.  Depending on
        the implementation, not all source files will necessarily be
        compiled, but all corresponding object filenames will be
        returned.

        If 'output_dir' is given, object files will be put under it, while
        retaining their original path component.  That is, "foo/bar.c"
        normally compiles to "foo/bar.o" (for a Unix implementation); if
        'output_dir' is "build", then it would compile to
        "build/foo/bar.o".

        'macros', if given, must be a list of macro definitions.  A macro
        definition is either a (name, value) 2-tuple or a (name,) 1-tuple.
        The former defines a macro; if the value is None, the macro is
        defined without an explicit value.  The 1-tuple case undefines a
        macro.  Later definitions/redefinitions/ undefinitions take
        precedence.

        'include_dirs', if given, must be a list of strings, the
        directories to add to the default include file search path for this
        compilation only.

        'debug' is a boolean; if true, the compiler will be instructed to
        output debug symbols in (or alongside) the object file(s).

        'extra_preargs' and 'extra_postargs' are implementation- dependent.
        On platforms that have the notion of a command-line (e.g. Unix,
        DOS/Windows), they are most likely lists of strings: extra
        command-line arguments to prepend/append to the compiler command
        line.  On other platforms, consult the implementation class
        documentation.  In any event, they are intended as an escape hatch
        for those occasions when the abstract compiler framework doesn't
        cut the mustard.

        'depends', if given, is a list of filenames that all targets
        depend on.  If a source file is older than any file in
        depends, then the source file will be recompiled.  This
        supports dependency tracking, but only at a coarse
        granularity.

        Raises CompileError on failure.
        )ryr�KeyError�_compile)r%rqrrrr|r�r�rrr!rtrur~rwrvrxs                r'�compilezCCompiler.compiles���z;?�:M�:M����g�w��;
�7�����%��#�#�G�U�M�B���	K�C�
� ��:���S�
�M�M�#�s�C��.�'�J�	K�����
��
�s�A�	A$�#A$c��y)zCompile 'src' to product 'obj'.Nr{)r%rwrvrxr~r�rts       r'r�zCCompiler._compile]s��	
r)c��y)a&Link a bunch of stuff together to create a static library file.
        The "bunch of stuff" consists of the list of object files supplied
        as 'objects', the extra object files supplied to
        'add_link_object()' and/or 'set_link_objects()', the libraries
        supplied to 'add_library()' and/or 'set_libraries()', and the
        libraries supplied as 'libraries' (if any).

        'output_libname' should be a library name, not a filename; the
        filename will be inferred from the library name.  'output_dir' is
        the directory where the library file will be put.

        'debug' is a boolean; if true, debugging information will be
        included in the library (note that on most platforms, it is the
        compile step where this matters: the 'debug' flag is included here
        just for consistency).

        'target_lang' is the target language for which the given objects
        are being compiled. This allows specific linkage time treatment of
        certain languages.

        Raises LibError on failure.
        Nr{)r%r!�output_libnamerr|�target_langs      r'�create_static_libzCCompiler.create_static_libcs��2	
r)�
shared_object�shared_library�
executablec��t�)auLink a bunch of stuff together to create an executable or
        shared library file.

        The "bunch of stuff" consists of the list of object files supplied
        as 'objects'.  'output_filename' should be a filename.  If
        'output_dir' is supplied, 'output_filename' is relative to it
        (i.e. 'output_filename' can provide directory components if
        needed).

        'libraries' is a list of libraries to link against.  These are
        library names, not filenames, since they're translated into
        filenames in a platform-specific way (eg. "foo" becomes "libfoo.a"
        on Unix and "foo.lib" on DOS/Windows).  However, they can include a
        directory component, which means the linker will look in that
        specific directory rather than searching all the normal locations.

        'library_dirs', if supplied, should be a list of directories to
        search for libraries that were specified as bare library names
        (ie. no directory component).  These are on top of the system
        default and those supplied to 'add_library_dir()' and/or
        'set_library_dirs()'.  'runtime_library_dirs' is a list of
        directories that will be embedded into the shared library and used
        to search for other shared libraries that *it* depends on at
        run-time.  (This may only be relevant on Unix.)

        'export_symbols' is a list of symbols that the shared library will
        export.  (This appears to be relevant only on Windows.)

        'debug' is as for 'compile()' and 'create_static_lib()', with the
        slight distinction that it actually matters on most platforms (as
        opposed to 'create_static_lib()', which includes a 'debug' flag
        mostly for form's sake).

        'extra_preargs' and 'extra_postargs' are as for 'compile()' (except
        of course that they supply command-line arguments for the
        particular linker being used).

        'target_lang' is the target language for which the given objects
        are being compiled. This allows specific linkage time treatment of
        certain languages.

        Raises LinkError on failure.
        ��NotImplementedError)r%�target_descr!�output_filenamerrrr �export_symbolsr|r�r��
build_tempr�s              r'�linkzCCompiler.link�s��v"�!r)c
�|�|jtj||j|d��|||||||	|
||�
y)N�shared)�lib_type)r�r�SHARED_LIBRARY�library_filename)
r%r!r�rrrr r�r|r�r�r�r�s
             r'�link_shared_libzCCompiler.link_shared_lib�sM��	
�	�	��$�$���!�!�.�8�!�D���� �������	
r)c
�Z�|jtj|||||||||	|
||�
yr)r�r�
SHARED_OBJECT)
r%r!r�rrrr r�r|r�r�r�r�s
             r'�link_shared_objectzCCompiler.link_shared_object�s=��	
�	�	��#�#������ �������	
r)c�x�|jtj||j|�||||d|||	d|
�
yr)r�r�
EXECUTABLE�executable_filename)r%r!�output_prognamerrrr r|r�r�r�s           r'�link_executablezCCompiler.link_executablesH��	
�	�	�� � ���$�$�_�5���� �������	
r)c��t�)zkReturn the compiler option to add 'dir' to the list of
        directories searched for libraries.
        r�rIs  r'�library_dir_optionzCCompiler.library_dir_option"�
��"�!r)c��t�)zsReturn the compiler option to add 'dir' to the list of
        directories searched for runtime libraries.
        r�rIs  r'�runtime_library_dir_optionz$CCompiler.runtime_library_dir_option(r�r)c��t�)zReturn the compiler option to add 'lib' to the list of libraries
        linked into the shared library or executable.
        r�)r%�libs  r'�library_optionzCCompiler.library_option.r�r)c��ddl}|�g}ntjdt�|�g}ntjdt�|�g}|�g}|j	d|d��\}}tj|d�}		|D]}
|	jd	|
z��|s|	jd
|z�|	jd|z�|	j�	|j|g|��}	tj|�	|j|d||��tj|jd|jxsd���	|D]}tj|��y#|	j�wxYw#t$rYtj|�y
wxYw#tj|�wxYw#tt f$rY|D]}tj|��y
wxYw#|D]}tj|��wxYw)aRReturn a boolean indicating whether funcname is provided as
        a symbol on the current platform.  The optional arguments can
        be used to augment the compilation environment.

        The libraries argument is a list of flags to be passed to the
        linker to make additional symbol definitions available for
        linking.

        The includes and include_dirs arguments are deprecated.
        Usually, supplying include files with function declarations
        will cause function detection to fail even in cases where the
        symbol is available for linking.

        rNzincludes is deprecatedzinclude_dirs is deprecatedrT)�text�wz#include "%s"
z4#ifdef __cplusplus
extern "C"
#endif
char %s(void);
z=int main (int argc, char **argv) {
    %s();
    return 0;
}
rNFza.out)rr�r�)�tempfile�warnings�warn�DeprecationWarning�mkstemprk�fdopen�write�closer�r�remover�r�rrr>)
r%�funcname�includesrrrr��fd�fname�f�inclr!�fns
             r'�has_functionzCCompiler.has_function4s
��2	����H��M�M�2�4F�G����L��M�M�6�8J�K����I����L��$�$�T�8�$�$�?�	��E��I�I�b�#���	� �
6�����-��4�5�
6�������
��
�G�G���
�
�
�G�G�I�	��l�l�E�7��l�F�G�
�I�I�e��	�� � ���I�L�
!�
�
�I�I��(�(��T�_�_�=R�PR�(�S�
��
���	�	�"�
�
���+
�G�G�I���	���I�I�e��	��
�I�I�e����9�%�	���
���	�	�"�
�
�	���
���	�	�"�
�
�s[�9AE!�E6�:F4�4G%�!E3�6	F�?F�F�F�F1�4G"�G%�!G"�"G%�%Hc��t�)aHSearch the specified list of directories for a static or shared
        library file 'lib' and return the full path to that file.  If
        'debug' true, look for a debugging version (if that makes sense on
        the current platform).  Return None if 'lib' wasn't found in any of
        the specified directories.
        r�)r%rPr�r|s    r'�find_library_filezCCompiler.find_library_file�s
��"�!r)c�<������d�t���fd�|D��S)Nr�c3�D�K�|]}�j��|����y�wr)�_make_out_path)�.0�src_namerr%rfs  ���r'�	<genexpr>z-CCompiler.object_filenames.<locals>.<genexpr>�s(�����
��
���
�I�x�@�
�s� )r�)r%�source_filenamesrfrs` ``r'rhzCCompiler.object_filenames�s(������J��
�,�
�
�	
r)c�V�tj|j|j�Sr)�dict�fromkeys�src_extensions�
obj_extension)r%s r'�out_extensionszCCompiler.out_extensions�s���}�}�T�0�0�$�2D�2D�E�Er)c�`�tjj|�\}}|j|�}	|j|}|rtjj|�}tjj|||z�S#t
$rt
dj||���wxYw)Nz"unknown file type '{}' (from '{}'))
rkrlrm�_make_relativer��LookupErrorr�format�basename�join)r%rrfr�r�rx�new_exts       r'r�zCCompiler._make_out_path�s����G�G�$�$�X�.�	��c��"�"�4�(��	��)�)�#�.�G�
��7�7�#�#�D�)�D��w�w�|�|�J��w��7�7��
�	�"�4�;�;�C��J��
�	�s�B�%B-c��tjj|�d}|tjj|�dS)z�
        In order to ensure that a filename always honors the
        indicated output_dir, make sure it's relative.
        Ref python/cpython#37775.
        rN)rkrl�
splitdrive�isabs)r��no_drives  r'r�zCCompiler._make_relative�s8���7�7�%�%�d�+�A�.������
�
�h�/�1�2�2r)c��|�J�|rtjj|�}tjj|||jz�Sr)rkrlr�r��shared_lib_extension�r%r�rfrs    r'�shared_object_filenamez CCompiler.shared_object_filename�sE���%�%�%���w�w�'�'��1�H��w�w�|�|�J��4�3L�3L�(L�M�Mr)c��|�J�|rtjj|�}tjj|||jxsdz�S)Nr�)rkrlr�r��
exe_extensionr�s    r'r�zCCompiler.executable_filename�sJ���%�%�%���w�w�'�'��1�H��w�w�|�|�J��D�4F�4F�4L�"�(M�N�Nr)c��|�J�d}|t|�vrtd|����t||dz�}t||dz�}tjj|�\}}	||	|fz}
|rd}tjj
|||
�S)Nz)"static", "shared", "dylib", "xcode_stub"z'lib_type' must be �_lib_format�_lib_extensionr�)�evalr+�getattrrkrl�splitr�)r%rSr�rfr�expected�fmtrxrJr��filenames           r'r�zCCompiler.library_filename�s����%�%�%�>���4��>�)��2�8�*�=�>�>��d�H�}�4�5���d�H�'7�7�8���G�G�M�M�'�*�	��T��$���$����C��w�w�|�|�J��X�6�6r)c�.�tj|�yr)rr|)r%�msg�levels   r'�announcezCCompiler.announces
���	�	�#�r)c�,�ddlm}|rt|�yy)Nr)�DEBUG)�distutils.debugr�print)r%rrs   r'�debug_printzCCompiler.debug_prints��)���#�J�r)c�H�tjjd|z�y)Nzwarning: %s
)�sys�stderrr�)r%rs  r'r�zCCompiler.warn
s���
�
����3�.�/r)c�4�t||||j�yr)rr)r%�func�argsrrs     r'rzCCompiler.execute
s����d�C����.r)c�4�t|fd|ji|��y)Nr)r	r)r%�cmdr.s   r'r	zCCompiler.spawns��
�c�2�4�<�<�2�6�2r)c�2�t|||j��S�N)r)r
r)r%rv�dsts   r'r
zCCompiler.move_files����c�4�<�<�8�8r)c�4�t|||j��yr)rr)r%r6�modes   r'rzCCompiler.mkpaths���t�T�4�<�<�0r))rrrr)NNNNN)NNNrNNN)NrN)
NNNNNrNNNN)NNNNrNNN)NNNN)r)rr�)�staticrr�)r)Nr)i�)Ir-�
__module__�__qualname__�__doc__�
compiler_typer�r��static_lib_extensionr��static_lib_format�shared_lib_formatr�r�r�rrr(r/r$r9r@rDrGrKrQrTrWrYr[r]r_rbrdryrrgr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rh�propertyr�r��staticmethodr�r�r�r�r	rr�rr	r
rr{r)r'rrsn���*�M�2�N��M����������M�������L�*�N��L���L��"<�H 2�D&���,
*�#�$&�$�'� %�&�$�.�,�$�"�6�.� 0�D� %�"#?�J��4�����
�.�������J�X
�NR�
�8$�M�%�N��J����!�������;"�F���!�������
�F���!�������
�F���!�����
�D"�"�"�����
\�|"�V
��F��F�8��	3��	3�N�O�CE�7�&��0�/�3�9�1r)r))zcygwin.*�unix)�posixr&)�nt�msvcc���|�tj}|�tj}tD]5\}}tj||��tj||���3|cSy)a\Determine the default compiler to use for the given platform.

    osname should be one of the standard Python OS names (i.e. the
    ones returned by os.name) and platform the common value
    returned by sys.platform for the platform in question.

    The default values are os.name and sys.platform in case the
    parameters are not given.
    r&)rkr6r�platform�_default_compilers�re�match)�osnamer+�pattern�compilers    r'�get_default_compilerr2)sa���~��������<�<��/������H�H�W�h�'�3��x�x���(�4��O��r))�
unixccompiler�
UnixCCompilerzstandard UNIX-style compiler)�
_msvccompiler�MSVCCompilerzMicrosoft Visual C++)�cygwinccompiler�CygwinCCompilerz'Cygwin port of GNU C Compiler for Win32)r7�Mingw32CCompilerz(Mingw32 port of GNU C Compiler for Win32)�bcppcompiler�BCPPCompilerzBorland C++ Compiler)r&r)�cygwin�mingw32�bcppc���ddlm}g}tj�D]#}|j	d|zdt|df��%|j�||�}|j
d�y)zyPrint list of available compilers (used by the "--help-compiler"
    options to "build", "build_ext", "build_clib").
    r)�FancyGetoptz	compiler=Nr;zList of available compilers:)�distutils.fancy_getoptr@�compiler_classr#rC�sort�
print_help)r@�	compilersr1�pretty_printers    r'�show_compilersrGUsn��3��I�"�'�'�)�V�����+��0�$��x�8P�QR�8S�T�U�V�
�N�N�� ��+�N����<�=r)c��|�tj}	|�t|�}t|\}}}	d|z}t
|�tj|}	t|	�|}
|
d||�S#t$rd|z}|�|d|zz}t|��wxYw#t$rtd|z��t$rtd|�d|�d���wxYw)	a[Generate an instance of some CCompiler subclass for the supplied
    platform/compiler combination.  'plat' defaults to 'os.name'
    (eg. 'posix', 'nt'), and 'compiler' defaults to the default compiler
    for that platform.  Currently only 'posix' and 'nt' are supported, and
    the default compilers are "traditional Unix interface" (UnixCCompiler
    class) and Visual C++ (MSVCCompiler class).  Note that it's perfectly
    possible to ask for a Unix compiler object under Windows, and a
    Microsoft compiler object under Unix -- if you supply a value for
    'compiler', 'plat' is ignored.
    Nz5don't know how to compile C/C++ code on platform '%s'z with '%s' compilerz
distutils.z4can't compile C/C++ code: unable to load module '%s'z0can't compile C/C++ code: unable to find class 'z
' in module '�')rkr6r2rBr�r�
__import__r�modules�vars�ImportErrorr)�platr1rrr�module_name�
class_name�long_descriptionr�module�klasss           r'�new_compilerrTfs����|��w�w��	*���+�D�1�H�6D�X�6N�3��j�"2�

�"�[�0���;�����[�)���V��Z�(����w��&�&��1�*�E��L�����-��8�8�C�$�S�)�)�	*���
�"�B�[�P�
�	
��
�"� *�K�
9�
�	
�
�s�A*�1B�*$B�2Cc��g}|D]�}t|t�rdt|�cxkrdksntd|z��t|�dk(r|j	d|dz��]t|�dk(s�l|d�|j	d|dz���|j	d|z���|D]}|j	d|z��|S)	aGenerate C pre-processor options (-D, -U, -I) as used by at least
    two types of compilers: the typical Unix compiler and Visual C++.
    'macros' is the usual thing, a list of 1- or 2-tuples, where (name,)
    means undefine (-U) macro 'name', and (name,value) means define (-D)
    macro 'name' to 'value'.  'include_dirs' is just a list of directory
    names to be added to the header file search path (-I).  Returns a list
    of command-line options suitable for either Unix compilers or Visual
    C++.
    rr;zPbad macro definition '%s': each element of 'macros' list must be a 1- or 2-tuplez-U%srz-D%sz-D%s=%sz-I%s)r1r<r=r>rC)rrrt�macrorJs     r'riri�s���*�G��2���5�%�(�Q�#�e�*�-A��-A��H�JO�P��
�
�u�:��?��N�N�6�E�!�H�,�-�
��Z�1�_��Q�x�����v��a��0�1�
���y�5�0�1�!2�$�%�����v��|�$�%��Nr)c���g}|D]"}|j|j|���$|D]:}|j|�}t|t�r||z}�*|j|��<|D]�}t
jj|�\}}	|r<|j|g|	�}
|
r|j|
��N|jd|z��c|j|j|����|S)acGenerate linker options for searching library directories and
    linking with specific libraries.  'libraries' and 'library_dirs' are,
    respectively, lists of library names (not filenames!) and search
    directories.  Returns a list of command-line options suitable for use
    with some compiler (depending on the two format strings passed in).
    z6no library file corresponding to '%s' found (skipping))rCr�r�r1r�rkrlrr�r�r�)r1rr r�lib_optsrJ�optr��lib_dir�lib_name�lib_files           r'�gen_lib_optionsr]�s����H��:������3�3�C�8�9�:�$�!���1�1�#�6���c�4� ��#�~�H��O�O�C� �!��:�� �g�g�m�m�C�0���(���1�1�7�)�X�F�H������)��
�
�O�RU�U��
�O�O�H�3�3�C�8�9�:��Or))NN)NNrrr)rrrkr-r��errorsrrrrrr	�	file_utilr
�dir_utilr�dep_utilr�utilr
r�_logrrr,r2rBrGrTrir]r{r)r'�<module>rds���1�
�	�	����� ��!�'��}1�}1�H ���8
O�E��
�

E���">�"+'�\*�Z%r)

Zerion Mini Shell 1.0