Path: blob/main/python/cpython/src/__pycache__/cowasm_bundler.cpython-311.pyc
1067 views
� ���c� � � � d Z ddlZddlZddlZddlZddlZddlZ G d� dej � � Zd� Z e dk r& e ej d ej dd� � � dS dS ) aN Creates a "CoWasm bundle", which is a PyZipFile (so has pyc files), plus we also include .so files and possibly some other extra files on a case-by-case basis. There is no version information, since that's going to be in the npm package.json file, and obviously no architecture since there is only one architecture. The idea of making Python modules only available in maximally compiled zip archive form is very inspired by Javascript web bundlers. It is is antithetical to how wheels, and Python packaging generally works! But that is because the constraints are very, very different. � Nc �* � e Zd Zd� Zdd�Zdd�Zd� ZdS ) �CoWasmBundlec �V � t j j | g|�R i |�� d| _ d| _ d S )N� � )�zipfile� PyZipFile�__init__�debug� compresslevel)�self�args�kwdss ��/Users/wstein/build/cocalc/src/data/projects/2c9318d1-4f8b-4910-8da7-68a965514c95/cowasm-python/packages/cpython/src/cowasm_bundler.pyr zCoWasmBundle.__init__ s; � ���"�4�7�$�7�7�7�$�7�7�7��� ������ � Nc �� � t j |� � }|rL ||� � sA| j r8t j � |� � rdnd}t |�d|�d�� � d S t j � |� � \ }}t j � |� � �r�t j � |d� � }t j � |� � �r�|r|�d|��}n|}| j rt d|d|� � t t j |� � � � }|� d� � |D �]*} t j � || � � } t j � | � � \ }}t j � | � � rVt j � t j � | d� � � � r| � | ||� � � ��|d k rj|r% || � � s| j rt d| z � � ��| � | |� � } | j rt d| � � | � | | � � ��,d S d S t j � |� � d d k rE| � ||� � } | j rt d| � � | � || � � d S d S )N�path�file� z skipped by filterfuncz__init__.py�/�Adding package in�as�� filterfuncz.sozfile %r skipped by filterfunc�Addingr �Adding file)�os�fspathr r �isdir�print�split�join�isfile�sorted�listdir�remove�splitext�write_so�get_archive_name�write)r �pathname�basenamer �label�dir�name�initname�dirlist�filenamer �root�ext�arcnames r r) zCoWasmBundle.write_so s� � ��9�X�&�&��� �j�j��2�2� ��z� I�"$�'�-�-��"9�"9�E���v���u�u�u�h�h�h�G�H�H�H��F��G�M�M�(�+�+� ��T� �7�=�=��"�"� % *��w�|�|�H�m�<�<�H��w�~�~�h�'�'� �� $�*2�(�(�D�D�9�H�H�#�H��:� I��-�x��x�H�H�H� ���H�!5�!5�6�6�����}�-�-�-� '� 2� 2�H��7�<�<��(�;�;�D� "�� 0� 0�� :� :�I�D�#��w�}�}�T�*�*� 2��7�>�>�"�'�,�,�t�]�*K�*K�L�L� 7� �M�M� $�h�+5� *� 7� 7� 7�� ��� 2�%� %�j�j��.>�.>� %�#�z� N� %�&E��&L� M� M� M�$�"&�"7�"7��h�"G�"G���:� 5�!�(�G�4�4�4�� � �4��1�1�1��#2� 2�&