
    N
f;                     p    d dl Z d dlZd dlmZmZmZmZmZmZ ddl	 d Z
d Zd Zd Zed	k(  r e        yy)
    N)PYQT_VERSION_STRQDirQFile	QFileInfo	QIODeviceQTextStream   )*c                  B    t         j                  j                  d       y )Na  Usage:
    pylupdate5 [options] project-file
    pylupdate5 [options] source-files -ts ts-files

Options:
    -help  Display this information and exit
    -version
           Display the version of pylupdate5 and exit
    -verbose
           Explain what is being done
    -noobsolete
           Drop all obsolete strings
    -tr-function name
           name() may be used instead of tr()
    -translate-function name
           name() may be used instead of translate()
)sysstderrwrite     6/usr/lib/python3/dist-packages/PyQt5/pylupdate_main.py
printUsager      s    JJ9:r   c           	         t               }|D ]  }|j                  |      }t               }t               }	|j                  |       |r|j	                  |       t        || |	|||       |r|	j                          |	j                          |	j                  |      rt        j                  j                  d|z          y )Nz#pylupdate5 error: Cannot save '%s'
)r   relativeFilePathMetaTranslatorloadsetCodecmergestripObsoleteMessagesstripEmptyContextssaver   r   r   )

fetchedTortsFileNames
codecForTr
noObsoleteverbosedirtfntorouts
             r   updateTsFilesr&   0   s    
&C J!!!$LL$c:sJ<%%' xx{JJCbHI%Jr   c                 Z    t        j                         d   }|d}| j                  |      S )Nr	   C)localegetdefaultlocaleencode)pathencodings     r   _encoded_pathr.   H   s/    &&(+H;;x  r   c                  
   d} t               }d}d}g }g }d}d}d}d}	d}
d}d }d }t        j                  dd  D ]
  }|dk(  s	d}
 t        t        j                        }d}||k  rt        j                  |   }|dz  }|dk(  rt	                t        j
                  d       |d	k(  r;t        j                  j                  d
t        z         t        j
                  d       |dk(  rd}|dk(  rd}|dk(  rd}|dk(  rR||k\  r4t        j                  j                  d       t        j
                  d       t        j                  |   }|dz  }|dk(  rS||k\  r4t        j                  j                  d       t        j
                  d       t        j                  |   }|dz  }I|	dz  }	d}|st        |      }|j                  t        j                        s7t        j                  j                  d|z         t        j
                  d       t        |      }|j                         }|j                          |
rt!        j"                         }t!        j$                  t'        |      j)                                t               }d}d}g }g }t+        |      j-                         D ]  \  }}|j/                  d      D ]  }|dk(  r>t1        t3        t!        j4                         j7                  |            || d|||       d}F|dk(  r5|j9                  t!        j4                         j7                  |             d}|dv r|}|j;                  |       |dk(  r|}|dk(  st=        t3        t!        j4                         j7                  |            || d         t?        |||||       |s#t        j                  j                  d|z         n0t        |      dk(  r"t        j                  j                  d|z         t!        j$                  |       n|r|jA                         jC                  d      r`t'        |      }|jE                         r|jG                         r|j9                  |       nt        j                  j                  d|z         nyt        j                  j                  d|z         nVt'        |      }t3        |j7                               }|jI                         dv rt1        ||| d|||       nt=        ||| d       ||k  r|
st?        |||||       |	dk(  r t	                t        j
                  d       y y )Nz@default Fr   Tr	   z-tsz-helpz-versionzpylupdate5 v%s
z-noobsoletez-verbosez-tr-functionz,pylupdate5 error: missing -tr-function name
   z-translate-functionz3pylupdate5 error: missing -translate-function name
z(pylupdate5 error: Cannot open file '%s'
 SOURCESTRANSLATIONS)CODECDEFAULTCODEC
CODECFORTRCODECFORSRCFORMSz@pylupdate5 warning: File '%s' does not look like a project file
zEpylupdate5 warning: Met no 'TRANSLATIONS' entry in project file '%s'
z.tsz8pylupdate5 warning: For some reason, I cannot save '%s'
z0pylupdate5 error: File '%s' lacks .ts extension
)pypyw)%r   r   argvlenr   exitr   r   r   r   openr   ReadOnlyr   readAllcloser   currentPath
setCurrentr   r,   proFileTagMapitemssplit
fetchtr_pyr.   currentabsoluteFilePathappendr   
fetchtr_uir&   lowerendswithexists
isWritablesuffix)defaultContextr   r   codecForSourcer   uiFileNamesr    r   metSomethingnumFilesstandardSyntax	metTsFlagtr_functranslate_funcargargcifullTextfr"   oldDirkeyvaluefir,   s                            r   mainrd   P   s     N!JJNKKGJLHNIGN xx| #%<"N# sxx=D	A
d(hhqk	Q'>LHHQK*JJ/2BBCHHQK-J*G%<I. Dy

  GIhhqkGFA''Dy

  NP XXa[NFAAc
A66),,-

  CcIKAAyy{HGGI%%'FOOIcN//12')JJNKK+H5;;= B
US) BAi'" -(,(G(G(J!L *ND .	I
 (,.#**4<<>+J+J1+MN'+ GG%&
"++J7-)*" -(,(G(G(J!L *NDB+BB6 *k:z  

  )+./0 [!Q&

  .0345 OOF#99;''."3B99;"--/#**3/

((!57:!;< JJ$$ORUUW s^$R%8%8%:;99;-/tZ*G^E tZFI d(L j+z:wO1} r   __main__)r)   r   PyQt5.QtCorer   r   r   r   r   r   	pylupdater   r&   r.   rd   __name__r   r   r   <module>ri      sG   &  
  ;(J0!gT zF r   