ó
½ÞZc           @   s   d  d l  Z  d  d l m Z m Z m Z d d l Te Z e Z	 e
 Z d Z d „  Z d „  Z d „  Z e d	 k r{ e ƒ  n  d S(
   iÿÿÿÿN(   t   PYQT_VERSION_STRt   QDirt   QFilei   (   t   *t    c         C   s:  t  r t j j d ƒ n  t ƒ  } | j |  ƒ | j t  ƒ | j t ƒ | j	 t
 ƒ | j t ƒ | j ƒ  ss t S| d k rˆ d } n  | r-| rÓ y t | d ƒ } WqÜ t k
 rÏ t j j d | ƒ t SXn	 t j } x. | j ƒ  D]  } | j d t j | ƒ ƒ qé W| t j k	 r)| j ƒ  n  t S| j | ƒ S(   Ns   PyQt5 resource compiler
t   -R   t   ws   Unable to open %s for writing
s   %s
(   t   verboset   syst   stderrt   writet   RCCResourceLibraryt   setInputFilest
   setVerboset   setCompressLevelt   compressLevelt   setCompressThresholdt   compressThresholdt   setResourceRoott   resourceRoott	   readFilest   Falset   opent	   Exceptiont   stdoutt	   dataFilesR   t	   cleanPatht   closet   Truet   output(   t   filenamesInt   filenameOutt	   listFilest   libraryt   out_fdt   df(    (    s/   lib/python2.7/site-packages/PyQt5/pyrcc_main.pyt   processResourceFile!   s6    				c         C   sA   t  j j d ƒ |  r- t  j j d |  ƒ n  t  j j d ƒ d  S(   Ns   PyQt5 resource compiler
s   pyrcc5: %s
sŸ  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
   (   t   error(    (    s/   lib/python2.7/site-packages/PyQt5/pyrcc_main.pyt   showHelpJ   s
    	c          C   sñ  d }  t  } t  } g  } d  } t t j ƒ } d } xW| | k  rŒt j | } | d 7} | d d k r<| d } | d k r¯ | | k r• d } Pn  t j | }  | d 7} q‰| d k r| | k rÑ d } Pn  t j t j | ƒ }	 | d 7} |	 d k s|	 d d	 k r9d
 } Pq9q‰| d k r\| | k r<d } Pn  t t j | ƒ }
 | d 7} q‰| d k rž| | k r~d } Pn  t t j | ƒ } | d 7} q‰| d k r³t } q‰| d k rÈt } q‰| d k røt j	 j
 d t ƒ t j d ƒ q‰| d k s| d k rt } q‰| d k r.d }
 q‰d | } Pq6 t j | ƒ s|t j	 j
 d t j d | f ƒ t j d ƒ n  | j | ƒ q6 Wt | ƒ d k s±| d  k	 s±| rËt | ƒ t j d ƒ n  t | |  | ƒ sít j d ƒ n  d  S(   NR   i   i    R   t   os   Missing output namet   roots   Missing root patht   /s   Root must start with a /t   compresss   Missing compression levelt	   thresholds   Missing compression thresholdR   t   listt   versions   pyrcc5 v%s
t   helpt   hs   no-compressiþÿÿÿs   Unknown option: '%s's   %s: File does not exist '%s'
(   R   t   Nonet   lenR   t   argvR   R   t   intR   R	   R
   R    t   exitR   t   existst   appendR&   R$   (   t   outFilenamet   helpRequestedR    t   filest   errorMsgt   argct   it   argt   optR   R   R   R   (    (    s/   lib/python2.7/site-packages/PyQt5/pyrcc_main.pyt   main]   s|    


				
	$
t   __main__(   R   t   PyQt5.QtCoreR    R   R   t   pyrccR   R   t   CONSTANT_COMPRESSLEVEL_DEFAULTR   t"   CONSTANT_COMPRESSTHRESHOLD_DEFAULTR   R   R$   R&   R?   t   __name__(    (    (    s/   lib/python2.7/site-packages/PyQt5/pyrcc_main.pyt   <module>   s   
	)		[