a
    xd                     @   sN   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oHe  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0102N)tuplemapgenerate)suffixes r   ]/var/www/html/Ranjet/env/lib/python3.9/site-packages/importlib_resources/tests/update-zips.pymain   s    r	   c                 C   s   t tjt }|d|  d }t|dV}t	|d|   D ]2\}}dt 
|  }t|d| ||| qFW d    n1 s0    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   sz   t | D ]j\}}}tt |d W d    n1 s>0    Y  |D ]&}t|| }|| }||fV  qLq
d S )N__pycache__)	r   r   
contextlibsuppress
ValueError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   


