� !A?hV��`�dZddlZddlmZddlTddlmZddlmZd�Z Gd�d e��Z dS) z�distutils.command.build_clib Implements the Distutils 'build_clib' command, to build a C/C++ library that is included in the module distribution and needed by an extension module.�N)�Command)�*)�customize_compiler)�logc�&�ddlm}|��dS)Nr��show_compilers)�distutils.ccompilerr rs �I/opt/alt/python-internal/lib64/python3.11/distutils/command/build_clib.pyr r s(��2�2�2�2�2�2��N������c�Z�eZdZdZgd�ZddgZdddefgZd�Zd �Z d �Z d �Z d �Z d �Z d�ZdS)� build_clibz/build C/C++ libraries used by Python extensions))z build-clib=�bz%directory to build C/C++ libraries to)z build-temp=�tz,directory to put temporary build by-products)�debug�gz"compile with debugging information)�force�fz2forcibly build everything (ignore file timestamps))z compiler=�czspecify the compiler typerrz help-compilerNzlist available compilersc��d|_d|_d|_d|_d|_d|_d|_d|_d|_dS)Nr) r� build_temp� libraries� include_dirs�define�undefrr�compiler��selfs r �initialize_optionszbuild_clib.initialize_options4sJ�����������!����� ��� ��� ��� ��� � � r c�\�|�dddddd��|jj|_|jr|�|j��|j�|jjpg|_t |jt ��r+|j�tj ��|_dSdS)N�build)rr)rr)rr)rr)rr) �set_undefined_options� distributionr�check_library_listr� isinstance�str�split�os�pathseprs r �finalize_optionszbuild_clib.finalize_optionsDs��� �"�"�7�#?�#?�#;�#5�#5�  7� 7� 7��*�4��� �>� 4� � #� #�D�N� 3� 3� 3� � � $� $� 1� >� D�"�D� � �d�'�� -� -� D� $� 1� 7� 7�� � C� C�D� � � � D� Dr c���|jsdSddlm}||j|j|j���|_t |j��|j�|j�|j��|j �(|j D] \}}|j� ||���!|j �$|j D]}|j� |���|� |j��dS)Nr)� new_compiler)r�dry_runr)rr r,rr-rrr�set_include_dirsr� define_macror�undefine_macro�build_libraries)rr,�name�value�macros r �runzbuild_clib.run^s���~� � �F� 5�4�4�4�4�4�$� �d�m�-1�\�+/�:�7�7�7�� � �4�=�)�)�)� � � (� �M� *� *�4�+<� =� =� =� �;� "� $� � 8� 8� ��e�� �*�*�4��7�7�7�7� �:� !��� 4� 4��� �,�,�U�3�3�3�3� ���T�^�,�,�,�,�,r c���t|t��std���|D]�}t|t��s"t |��dkrtd���|\}}t|t ��std���d|vst jdkr&t j|vrtd|dz���t|t��std�����d S) a`Ensure that the list of libraries is valid. `library` is presumably provided as a command option 'libraries'. This method checks that it is a list of 2-tuples, where the tuples are (library_name, build_info_dict). Raise DistutilsSetupError if the structure is invalid anywhere; just returns otherwise. z+'libraries' option must be a list of tuples�z*each element of 'libraries' must a 2-tuplezNfirst element of each tuple in 'libraries' must be a string (the library name)�/z;bad library name '%s': may not contain directory separatorsrzMsecond element of each tuple in 'libraries' must be a dictionary (build info)N) r%�list�DistutilsSetupError�tuple�lenr&r(�sep�dict)rr�libr2� build_infos r r$zbuild_clib.check_library_listvs.���)�T�*�*� A�%�?�A�A� A�� ;� ;�C��c�5�)�)� D�c�#�h�h�!�m�m�)�B�D�D�D� #� �D�*��d�C�(�(� =�)�<�=�=�=��d�{�{�r�v��}�}���4���)�+>�@C�A��+G�H�H�H��j�$�/�/� ;�)�:�;�;�;� ;�! ;� ;r c�`�|jsdSg}|jD]\}}|�|���|S)N)r�append)r� lib_names�lib_namer@s r �get_library_nameszbuild_clib.get_library_names�sK���~� ��4�� �&*�n� '� '� "�X�z� � � �X� &� &� &� &��r c� �|�|j��g}|jD]_\}}|�d��}|�t|tt f��st d|z���|�|���`|S)N�sources�fin 'libraries' option (library '%s'), 'sources' must be present and must be a list of source filenames)r$r�getr%r9r;r:�extend)r� filenamesrDr@rGs r �get_source_fileszbuild_clib.get_source_files�s��� �����/�/�/�� �&*�n� &� &� "�X�z� �n�n�Y�/�/�G���j��4��-�&H�&H��)�4�6>�?�@�@�@� � � �W� %� %� %� %��r c���|D]�\}}|�d��}|�t|ttf��st d|z���t|��}t jd|��|�d��}|�d��}|j�||j |||j ���}|j� |||j |j �����dS)NrGrHzbuilding '%s' library�macrosr)� output_dirrNrr)rOr) rIr%r9r;r:r�infor�compilerr�create_static_libr)rrrDr@rGrNr�objectss r r1zbuild_clib.build_libraries�s��&/� >� >� "�X�z� �n�n�Y�/�/�G���j��4��-�&H�&H��)�4�6>�?�@�@�@��7�m�m�G� �H�,�h� 7� 7� 7�  �^�^�H�-�-�F�%�>�>�.�9�9�L��m�+�+�G�7;��39�9E�26�*� ,�>�>�G� �M� +� +�G�X�7;��26�*� ,� >� >� >� >�3 >� >r )�__name__� __module__� __qualname__� description� user_options�boolean_optionsr � help_optionsrr*r5r$rErLr1�r r rrs�������C�K�  �  �  �L���(�O� �$� #�^� 5� �L� � � � D�D�D�4-�-�-�0!;�!;�!;�H � � � � � �>�>�>�>�>r r) �__doc__r(�distutils.corer�distutils.errors�distutils.sysconfigr� distutilsrr rr[r r �ras��� � �  � � � �"�"�"�"�"�"�����2�2�2�2�2�2���������� u>�u>�u>�u>�u>��u>�u>�u>�u>�u>r