B
    ½ÞZ–  ã               @   s^   d dl Z d dlmZmZmZ ddlT dZeZe	Z
dZdd„ Zd	d
„ Zdd„ ZedkrZeƒ  dS )é    N)ÚPYQT_VERSION_STRÚQDirÚQFileé   )Ú*FÚ c             C   sê   t rtj d¡ tƒ }| | ¡ | t ¡ | t¡ | 	t
¡ | t¡ | ¡ sTdS |dkr`d}|rà|ržyt|dƒ}W q¤ tk
rš   tj d| ¡ dS X ntj}x$| ¡ D ]}| dt |¡ ¡ q®W |tjk	rÜ| ¡  dS | |¡S )	NzPyQt5 resource compiler
Fú-r   ÚwzUnable to open %s for writing
z%s
T)ÚverboseÚsysÚstderrÚwriteZRCCResourceLibraryZsetInputFilesZ
setVerboseZsetCompressLevelÚcompressLevelZsetCompressThresholdÚcompressThresholdZsetResourceRootÚresourceRootZ	readFilesÚopenÚ	ExceptionÚstdoutZ	dataFilesr   Ú	cleanPathÚcloseÚoutput)ZfilenamesInZfilenameOutÚ	listFilesZlibraryZout_fdZdf© r   ú/lib/python3.7/site-packages/PyQt5/pyrcc_main.pyÚprocessResourceFile!   s6    






r   c             C   s0   t j d¡ | r t j d|  ¡ t j d¡ d S )NzPyQt5 resource compiler
zpyrcc5: %s
aŸ  Usage: pyrcc5 [options] <inputs>

Options:
    -o file           Write output to file rather than stdout
    -threshold level  Threshold to consider compressing files
    -compress level   Compress input files by level
    -root path        Prefix resource access path with root path
    -no-compress      Disable all compression
    -version          Display version
    -help             Display this information
)r   r   r   )Úerrorr   r   r   ÚshowHelpJ   s
    r   c              C   s:  d} d}d}g }d }t tjƒ}d}xÈ||k rìtj| }|d7 }|d dkr°|dd … }|dkrˆ||krrd}P tj| } |d7 }qê|dkrÒ||kržd	}P t tj| ¡}	|d7 }|	dksÊ|	d d
krÐd}P nÜ|dkr||krêd}P ttj| ƒ}
|d7 }n¬|dkr4||krd}P ttj| ƒ}|d7 }nz|dkrDd}nj|dkrTd}nZ|dkrztj dt ¡ t 	d¡ n4|dksŽ|dkr”d}n|dkr¤d}
n
d| }P q&t
 |¡sàtj dtjd |f ¡ t 	d¡ | |¡ q&W t |ƒdks|d k	s|rt|ƒ t 	d¡ t|| |ƒs6t 	d¡ d S )Nr   Fr   r   r   ÚozMissing output nameÚrootzMissing root pathú/zRoot must start with a /ÚcompresszMissing compression levelZ	thresholdzMissing compression thresholdr
   TÚlistÚversionzpyrcc5 v%s
ÚhelpÚhzno-compresséþÿÿÿzUnknown option: '%s'z%s: File does not exist '%s'
)Úlenr   Úargvr   r   Úintr   r   r   Úexitr   ÚexistsÚappendr   r   )ZoutFilenameZhelpRequestedr   ÚfilesZerrorMsgZargcÚiÚargZoptr   r   r   r
   r   r   r   Úmain]   s|    













r/   Ú__main__)r   ZPyQt5.QtCorer   r   r   Zpyrccr
   ZCONSTANT_COMPRESSLEVEL_DEFAULTr   Z"CONSTANT_COMPRESSTHRESHOLD_DEFAULTr   r   r   r   r/   Ú__name__r   r   r   r   Ú<module>   s   )[