� ,�Re�.� �@�dZddlZddlZddlZddlZddlZddlZddlmZddl m Z ddl m Z ddl mZmZmZmZddlmZmZdd lmZejd gd gd gd gdgdgdgddgejd� ��Zd�ZdZGd�de ��ZGd�de��ZdZdZdZ d�Z!d�Z"dZ#dS)adistutils.cygwinccompiler Provides the CygwinCCompiler class, a subclass of UnixCCompiler that handles the Cygwin port of the GNU C compiler to Windows. It also contains the Mingw32CCompiler class which handles the mingw32 port of GCC (same as cygwin in no-cygwin mode). �N)� check_output�)� UnixCCompiler)� write_file)�DistutilsExecError�DistutilsPlatformError�CCompilerError� CompileError)� LooseVersion�suppress_known_deprecation)�RangeMap�msvcr70�msvcr71�msvcr80�msvcr90�msvcr100�msvcr110�msvcr120�ucrt� vcruntime140) iiixi�i@i�iili�c��tjdtj��} t |�d����}n#t $rYdSwxYw t|S#t$rtd|z���wxYw)zaInclude the appropriate MSVC runtime library if Python was built with MSVC 7.0 or later. zMSC v\.(\d{4})rNzUnknown MS Compiler version %s ) �re�search�sys�version�int�group�AttributeError� _msvcr_lookup�KeyError� ValueError)�match�msc_vers ��/builddir/build/BUILDROOT/alt-python311-setuptools-65.6.3-2.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/setuptools/_distutils/cygwinccompiler.py� get_msvcrr%4s��� �I�'��� 5� 5�E���e�k�k�!�n�n�%�%���� �����������F��W�%�%�� �F�F�F��:�W�D�E�E�E�F���s�"A� A�A� A#�#BzxUnable to set runtime library search path on Windows, usually indicated by `runtime_library_dirs` parameter to Extensionc���eZdZdZdZdZdZdZdZdZ dZ dZ d Z d�fd � Z ed ���Zd �Z dd�Zd�Z�fd�Ze�fd���Z�xZS)�CygwinCCompilerz9Handles the Cygwin port of the GNU C compiler to Windows.�cygwinz.oz.az.dll.az.dllzlib%s%szcyg%s%sz.exerc ���t���|||��t��\}}|�d�||����|t ur|�d|z��tj� dd��|_ tj� dd��|_ |j |_ d}|� d|j zd |j zd|j zd |j zd �|j |��� ��t��|_dS) Nz%Python's GCC status: {} (details: {})z�Python's pyconfig.h doesn't seem to support your compiler. Reason: %s. Compiling may fail because of undefined preprocessor macros.�CC�gcc�CXXzg++�-sharedz%s -mcygwin -O -Wallz%s -mcygwin -mdll -O -Wallz %s -mcygwinz{} -mcygwin {}��compiler� compiler_so� compiler_cxx� linker_exe� linker_so)�super�__init__�check_config_h� debug_print�format� CONFIG_H_OK�warn�os�environ�get�cc�cxx� linker_dll�set_executablesr%� dll_libraries)�self�verbose�dry_run�force�status�details� shared_option� __class__s �r$r5zCygwinCCompiler.__init__Vs7��� ������'�5�1�1�1�(�*�*���� ��� 3� :� :�6�7� K� K� � � � �� $� $� �I�I�O�QX�Y� � � � �*�.�.��u�-�-����:�>�>�%��/�/����'���!� � ���+�d�g�5�4�t�w�>�/�$�(�:�$�t�w�.�'�.�.�t�� �N�N� � � � �'�[�[�����c��tjdtd���t��5t d��cddd��S#1swxYwYdS)Nz�gcc_version attribute of CygwinCCompiler is deprecated. Instead of returning actual gcc version a fixed value 11.2.0 is returned.�)� stacklevelz11.2.0)�warningsr:�DeprecationWarningr r )rCs r$� gcc_versionzCygwinCCompiler.gcc_versionws��� � � X� ��  � � � � (� )� )� *� *���)�)� *� *� *� *� *� *� *� *� *� *� *� *���� *� *� *� *� *� *s�A�A �A c�*�|dks|dkr> |�dd|d|g��dS#t$r}t|���d}~wwxYw |�|j|z|d|gz|z��dS#t$r}t|���d}~wwxYw)z:Compiles the source by spawning GCC and windres if needed.�.rc�.res�windresz-iz-oN)�spawnrr r0)rC�obj�src�ext�cc_args�extra_postargs�pp_opts�msgs r$�_compilezCygwinCCompiler._compile�s��� �%�<�<�3�&�=�=� (�� � �I�t�S�$��<�=�=�=�=�=��%� (� (� (�"�3�'�'�'����� (���� (�� � ��$�w�.�#�t�S�1A�A�N�R�������&� (� (� (�"�3�'�'�'����� (���s,�*� A�A�A� &A4�4 B�>B � BNc��tj| pg��} tj|pg��}tj|pg��}|r|�t��|�|j��|��||jks |jdkr�tj� |d��}tj� tj� |����\}}tj� ||dz��}dtj� |��zdg}|D]}|� |���|�t||fd|z��|� |��| s| � d��t!j||||||||d| | | | | ��dS) zLink the objects.Nr+rz.defz LIBRARY %s�EXPORTSz writing %sz-s)�copyr:�_runtime_library_dirs_msg�extendrB� EXECUTABLEr@r;�path�dirname�splitext�basename�join�append�executerr�link)rC� target_desc�objects�output_filename� output_dir� libraries� library_dirs�runtime_library_dirs�export_symbols�debug� extra_preargsr[� build_temp� target_lang�temp_dir�dll_name� dll_extension�def_file�contents�syms r$rlzCygwinCCompiler.link�s���$� �-�"5�2�6�6� ��I�i�o�2�.�.� ��)�G�M�r�*�*�� � 1� �I�I�/� 0� 0� 0� ����+�,�,�,� � &� �4�?� *� *�d�o��.F�.F��w���w�q�z�2�2�H�(*��(8�(8��� � ��1�1�)�)� %�X�}� �w�|�|�H�h��.?�@�@�H�%�r�w�'7�'7��'H�'H�H�)�T�H�%� %� %������$�$�$�$� �L�L��h��%9�<�(�;R� S� S� S� �N�N�8� $� $� $�� '� � � �� &� &� &��� � � � � � � � � � � � � � � � � � � rKc�:�|�t��gS�N)r:rb�rC�dirs r$�runtime_library_dir_optionz*CygwinCCompiler.runtime_library_dir_option�s�� � � �+�,�,�,�� rKc���tj�|��}t���|||��Sr�)r;re�normcaser4�_make_out_path)rCrp� strip_dir�src_name� norm_src_namerJs �r$r�zCygwinCCompiler._make_out_path�s4�����(�(��2�2� ��w�w�%�%�j�)�]�K�K�KrKc�L���it��j��fd�dD���S)z3 Add support for rc and res files. c�&��i|] }||�jz��S�)� obj_extension)�.0rYrCs �r$� z2CygwinCCompiler.out_extensions..s#���H�H�H��s�C�$�,�,�H�H�HrK)rTrS)r4�out_extensions)rCrJs`�r$r�zCygwinCCompiler.out_extensions�s9����  ��g�g�$� �H�H�H�H��H�H�H� � rK�rrr) NNNNNrNNNN)�__name__� __module__� __qualname__�__doc__� compiler_typer��static_lib_extension�shared_lib_extension�dylib_lib_extension�static_lib_format�shared_lib_format�dylib_lib_format� exe_extensionr5�propertyrQr^rlr�r�r�� __classcell__�rJs@r$r'r'Is,�������C�C��M��M���#�� ��!��!�� ���M�)�)�)�)�)�)�B� *� *��X� *�(�(�(�*���!�������X �X �X �X �t���L�L�L�L�L� � � � � ��X� � � � � rKr'c�.��eZdZdZdZd�fd� Zd�Z�xZS)�Mingw32CCompilerz:Handles the Mingw32 port of the GNU C compiler to Windows.�mingw32rc �>��t���|||��d}t|j��rt d���|�d|jzd|jzd|jzd|jzd�|j|�����dS)Nr-z1Cygwin gcc cannot be used with --compiler=mingw32z %s -O -Wallz%s -mdll -O -Wallz%sz{} {}r.) r4r5� is_cygwinccr>r rAr?r8r@)rCrDrErFrIrJs �r$r5zMingw32CCompiler.__init__s���� ������'�5�1�1�1�!� � �t�w� � � V� �!T�U�U� U� ���"�T�W�,�+�d�g�5�&���1��d�g�~��n�n�T�_�m�D�D� � � � � � rKc�*�tt���r�)rrbr�s r$r�z+Mingw32CCompiler.runtime_library_dir_option s��$�%>�?�?�?rKr�)r�r�r�r�r�r5r�r�r�s@r$r�r� s^�������D�D��M� � � � � � �"@�@�@�@�@�@�@rKr��okznot ok� uncertainc��ddlm}dtjvr tdfSdtjvr tdfS|���} t |��} d|���vr td|zf|���Std |zf|���S#|���wxYw#t$r,}td � ||j ��fcYd }~Sd }~wwxYw) awCheck if the current Python installation appears amenable to building extensions with GCC. Returns a tuple (status, details), where 'status' is one of the following constants: - CONFIG_H_OK: all is well, go ahead and compile - CONFIG_H_NOTOK: doesn't look good - CONFIG_H_UNCERTAIN: not sure -- unable to read pyconfig.h 'details' is a human-readable string explaining the situation. Note there are two ways to conclude "OK": either 'sys.version' contains the string "GCC" (implying that this Python was built with GCC), or the installed "pyconfig.h" contains the string "__GNUC__". r)� sysconfig�GCCzsys.version mentions 'GCC'�Clangzsys.version mentions 'Clang'�__GNUC__z'%s' mentions '__GNUC__'z '%s' does not mention '__GNUC__'zcouldn't read '{}': {}N)� distutilsr�rrr9�get_config_h_filename�open�read�close�CONFIG_H_NOTOK�OSError�CONFIG_H_UNCERTAINr8�strerror)r��fn�config_h�excs r$r6r6-s4��*$�#�#�#�#�#� �� ����8�8�8��#�+����:�:�:� � (� (� *� *�B� W���8�8�� ��X�]�]�_�_�,�,�"�$>��$C�C� �N�N� � � � �&�'I�B�'N�N� �N�N� � � � ��H�N�N� � � � ����� �W�W�W�"�$<�$C�$C�B�� �$U�$U�V�V�V�V�V�V�V�����W���sB� C �!B0�;C � B0�C �0C�C � C?�!C:�4C?�:C?c��ttj|��dgz��}|����d��S)zCTry to determine if the compiler that would be used is from cygwin.z -dumpmachinescygwin)r�shlex�split�strip�endswith)r>� out_strings r$r�r�\s?���e�k�"�o�o��0@�@�A�A�J� � � � � � &� &�y� 1� 1�1rK)$r�r;rrrar�rO� subprocessr� unixccompilerr� file_utilr�errorsrrr r rr r � _collectionsr �left�undefined_valuerr%rbr'r�r9r�r�r6r�� get_versionsr�rKr$�r�s����� � � � � � � � � � � � � � � � � � � � �����#�#�#�#�#�#�(�(�(�(�(�(�!�!�!�!�!�!������������� >�=�=�=�=�=�=�=�"�"�"�"�"�"��� ��k��k��k��k��l��l��l��~�&��&�#���� �. F� F� F� I�� } �} �} �} �} �m�} �} �} �B@�@�@�@�@��@�@�@�<� ��� ��,W�,W�,W�^2�2�2� � ��rK