o
    JXh                     @   sT   d Z ddlZddlZddlZddlZdd Zdd Zdd Zed	ko'e  dS  dS )
z
Generate the zip test data files.

Run to build the tests/zipdataNN/ziptestdata.zip files from
files in tests/dataNN.

Replaces the file with the working copy, but does commit anything
to the source repo.
    Nc                  C   s   d} t tt|  dS )a;  
    >>> from unittest import mock
    >>> monkeypatch = getfixture('monkeypatch')
    >>> monkeypatch.setattr(zipfile, 'ZipFile', mock.MagicMock())
    >>> print(); main()  # print workaround for bpo-32509
    <BLANKLINE>
    ...data01... -> ziptestdata/...
    ...
    ...data02... -> ziptestdata/...
    ...
    )Z01Z02N)tuplemapgenerate)suffixes r   I/opt/python-3.10.19/usr/lib/python3.10/test/test_importlib/update-zips.pymain   s   r   c                 C   s   t tjt }|d|  d }t|d,}t	|d|   D ]\}}dt 
|  }t|d| ||| q#W d    d S 1 sHw   Y  d S )NZzipdataz/ziptestdata.zipwdataZziptestdataz->)pathlibPath__file__parentrelative_toosgetcwdzipfileZipFilewalkPurePosixPathas_posixprintwrite)suffixrootZzfpathzfsrcreldstr   r   r   r   !   s   "r   c              	   c   s|    t | D ]5\}}}tt |d W d    n1 s w   Y  |D ]}t|| }|| }||fV  q'qd S )N__pycache__)	r   r   
contextlibsuppressKeyErrorremover   r   r   )datapathdirpathdirnames	filenamesfilenameresr   r   r   r   r   +   s   
r   __main__)	__doc__r    r   r   r   r   r   r   __name__r   r   r   r   <module>   s    


