
    y9>i                     b    d Z ddlmZmZ ddlmZmZmZ ddlZddlZexZ	Z
d ZeZd Zd	 Zd
 ZdS )z&Archive commands for the gzip program.   )extract_singlefile_standardtest_singlefile_standard   )utilfileutillog    Nc           
         t          j        |          g}|dk    r|                    d           t          |||           }|                    dddt          j        |           dt          j        |          g           |ddifS )	zExtract given gzip archive.r   -v-cz-d-->shellT)r   shell_quoteappendget_original_filenameextend)archivecompressioncmd	verbosityinteractiveoutdircmdlistoutfiles           V/var/www/html/auto_sub_bot/venv/lib/python3.11/site-packages/patoolib/programs/gzip.pyextract_gzipr      s    $$%G1}}t#C99GNN	tT4+G44c4;KG;T;TU   gt_%%    c                 h   t          j        ||          }| dd|g}	 t          j        |                                          }|                                }|d                                         }t          j        	                    |          }t          j        	                    |d                   }	t          j        
                    |          t          j        
                    |	          k    rt          j        	                    |          }
t          j        
                    |	          t          j        
                    |
          k    r t          j                            ||	          }n=# t          t          j        f$ r$}t          j        d|  d|            Y d}~nd}~ww xY w|S )zgGet the original filename inside a gzip archive.
    This parses the output of gzip --name --list.
    z--namez--listr   zcould not run z: N)r   get_single_outfiler   backtickstrip
splitlinessplitospathbasenamenormcasejoinOSError
subprocessCalledProcessErrorr   	log_error)r   r   r   r   r   outputlinesvaluesbaseoutfilebasefilenamebasearchiveerrs               r   r   r   (   ss    )&'::GHh0G5w''--//!!##q!!g&&w//w''r
337K((BG,<,<\,J,JJJ'**733Kw--1A1A+1N1NNN',,v|<<Z23 5 5 53s33c33444444445Ns   EE5 5F/F**F/c                 ,   t          j        |          g}|dk    r|                    d           |                    ddg           |                    d |D                        |                    dt          j        |           g           |ddifS )	zCreate a GZIP archive.r   r   r   r   c                 6    g | ]}t          j        |          S  )r   r   ).0xs     r   
<listcomp>zcreate_gzip.<locals>.<listcomp>D   s#    ;;;AD$Q'';;;r   r   r   T)r   r   r   r   )r   r   r   r   r   	filenamesr   s          r   create_gzipr=   >   s    $$%G1}}tNND$<   NN;;;;;<<<NNC)'223444gt_%%r   c                 r    |g}|dk    r|                     d           |                    dd| g           |S )zList a GZIP archive.r	   r   z-lr   )r   r   )r   r   r   r   r   r   s         r   	list_gzipr?   I   sB    eG1}}tNND$()))Nr   )__doc__ r   r   r   r   r   r&   r,   	test_gziptest_compressr   extract_compressr   r=   r?   r8   r   r   <module>rE      s    - , C C C C C C C C " " " " " " " " " " 				    4 4	M	& 	& 	& /   ,& & &    r   