
    daf                     Z    d Z ddlZddlZddlZddlZd Zd Zd Zedk(  xr	  e        y y)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                  :    d} t        t        t        |              y)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/...
    ...
    )0102N)tuplemapgenerate)suffixess    D/root/Python-3.12.4/Lib/test/test_importlib/resources/update-zips.pymainr      s     H	#h
!"    c                    t        j                  t              j                  j	                  t        j                               }|d|  dz  }t        j                  |d      5 }t        |d|  z        D ]J  \  }}dt        j                  |j                               z  }t        |d|       |j                  ||       L 	 d d d        y # 1 sw Y   y xY w)Nzipdataz/ziptestdata.zipwdataziptestdataz->)pathlibPath__file__parentrelative_toosgetcwdzipfileZipFilewalkPurePosixPathas_posixprintwrite)suffixrootzfpathzfsrcreldsts          r
   r   r   !   s    <<!((44RYY[ADgfX%566F		% Td6(O34 	HC'"7"7"GGC#tS!HHS#	  s   $ACCc              #   2  K   t        j                  |       D ]o  \  }}}t        j                  t              5  |j                  d       d d d        |D ]1  }t        j                  |      |z  }|j                  |       }||f 3 q y # 1 sw Y   BxY ww)N__pycache__)	r   r   
contextlibsuppress
ValueErrorremover   r   r   )datapathdirpathdirnames	filenamesfilenameresr%   s          r
   r   r   +   s     (*(9 $9  , 	+OOM*	+! 	H,,w'(2C//(+Cs(N		+ 	+s   6BB
ABB	B__main__)	__doc__r)   r   r   r   r   r   r   __name__ r   r
   <module>r7      s;     	  #  	J  !46 !r   