
    LȂib                     ~    S SK r S SKrS SKrS SKrS SKrS SKJr  S SKJ	r	J
r
  S SKJrJrJr  S rS r " S S\	5      rg)	    N)Path)BaseCommandCommandError)find_commandis_ignored_pathpopen_wrapperc                     U R                  S5       nUR                  S5      nS S S 5        WR                  [        R                  [        R
                  [        R                  45      $ ! , (       d  f       NL= f)Nrb   )openread
startswithcodecsBOM_UTF8BOM_UTF16_LEBOM_UTF16_BE)fnfsamples      `D:\sksbv-state-backend\venv\Lib\site-packages\django/core/management/commands/compilemessages.pyhas_bomr      sV    	! 
	&--v/B/BC  
s   A**
A8c                      [         R                  " U S9    S S S 5        g! , (       d  f       g= f! [         a     gf = f)N)dirFT)tempfileNamedTemporaryFileOSError)paths    r   is_dir_writabler      sC    ((T2 3 	 32   s    2 !2 
/2 2 
??c                   8    \ rS rSrSr/ rSrS/rS rS r	S r
Srg	)
Command   zECompiles .po files to .mo files for use with builtin gettext support.msgfmtz--check-formatc           
          UR                  SSS/ SS9  UR                  SSS/ SS9  UR                  S	S
SSSS9  UR                  SSSS/ SSS9  g )Nz--localez-lappendzYLocale(s) to process (e.g. de_AT). Default is to process all. Can be used multiple times.)actiondefaulthelpz	--excludez-xz@Locales to exclude. Default is none. Can be used multiple times.z--use-fuzzy-ffuzzy
store_truezUse fuzzy translations.)destr%   r'   z--ignorez-iignore_patternsPATTERNzWIgnore directories matching this glob-style pattern. Use multiple times to ignore more.)r%   r+   r&   metavarr'   )add_argument)selfparsers     r   add_argumentsCommand.add_arguments%   s    * 	 	
 	S 	 	
 	* 	 	
 	"1 	 		
    c           
        ^ US   nUS   n[        US   5      nUS   U l        US   (       a  / U R                  QSPU l        [        U R                  5      c  [        SU R                   S35      e[        R                  R                  S	S5      S/n[        R                  R                  S
5      (       a!  SSKJn  UR                  UR                  5        [        R                  " SSS9 H  u  mpx[!        U5       H  n	[#        [        R                  R%                  [        R                  R                  TU	5      5      U5      (       a  UR'                  U	5        Mb  U	S:X  d  Mj  UR)                  [        R                  R                  TU	5      5        M     M     [        [+        [        R                  R,                  [/        [        R                  R0                  U5      5      5      nU(       d  [        S5      e/ n
U Hq  n[/        [        R                  R0                  [2        R2                  " SU-  5      5      nU
R                  [+        [        R                  R4                  U5      5        Ms     U=(       d    U
n[        U5      R7                  U5      nSU l        U H  nU(       a0  U Vs/ sH#  n[        R                  R                  XS5      PM%     nnOU/n/ nU H>  n[        R                  " U5       H!  u  mpxUR                  U4S jU 5       5        M#     M@     U(       d  M  U R;                  U5        M     U R8                  (       a  [        S5      eg s  snf )Nlocaleexcluder,   	verbosityr)   r(   zCan't find z?. Make sure you have GNU gettext tools 0.19 or newer installed.confDJANGO_SETTINGS_MODULEr   )settings.T)topdownzzThis script should be run from the Django Git checkout or your project or app tree, or with the settings module specified.z%s/*FLC_MESSAGESc              3   X   >#    U H   oR                  S 5      (       d  M  TU4v   M"     g7f)z.poN)endswith).0r   dirpaths     r   	<genexpr>!Command.handle.<locals>.<genexpr>   s#      %.7::e;L!is   **z-compilemessages generated one or more errors.)setr8   program_optionsr   programr   osr   joinenvirongetdjango.confr;   extendLOCALE_PATHSwalklistr   normpathremover$   mapabspathfilterisdirglobbasename
difference
has_errorscompile_messages)r0   optionsr6   r7   r,   basedirsr;   dirnames	filenamesdirnameall_localesbasedirlocale_dirslocalesdirs	locationsldirrB   s                    @r   handleCommand.handleG   s   ")$g&789 -7#@T%9%9#@4#@D %-dll^ ,1 1 
 GGLL2H=::>>233,OOH112 -/GGC,F(GX>"GG$$RWW\\'7%CDo  OOG,(OOBGGLL'$BC * -G s277??F277==(,KLM1  G 		&7:J0KLKs277#3#3[AB  
 'Kg,))'2GOVOVVBGGLL-@w    yI46GGDM0GX$$ %.7%  5B 
 y%%i0    ??NOO s   6)M&c                 @   [         R                  R                  5        n/ n[        U5       GH  u  nu  pV[	        U5      U-  nUR                  S5      n UR                  5       R                  UR                  5       R                  :  a0  U R                  S:  a  U R                  R                  SU-  5        M   U R                  S:  a#  U R                  R                  SU< SU< 35        [        U5      (       a'  U R                  R                  SU-  5        SU l        M  US:X  aI  [        UR                   5      (       d/  U R                  R                  SU-  5        SU l          S	S	S	5        g	U R"                  /U R$                  QS
PUPUPn	UR'                  UR)                  [*        U	5      5        GM     [         R                  R-                  U5       H  n
U
R/                  5       u  pnU(       d  M  U R                  S:  a]  U(       a.  U R                  R                  SU R"                  < SU< 35        O(U R                  R                  SU R"                  -  5        SU l        M     S	S	S	5        g	! [         a     GNf = f! , (       d  f       g	= f)z9
Locations is a list of tuples: [(directory, file), ...]
z.mor   u1   File “%s” is already compiled and up to date.zprocessing file z in zmThe %s file has a BOM (Byte Order Mark). Django only supports .po files encoded in UTF-8 and without any BOM.TzeThe po files under %s are in a seemingly not writable location. mo files will not be updated/created.Nz-ozExecution of z	 failed: zExecution of %s failed)
concurrentfuturesThreadPoolExecutor	enumerater   with_suffixstatst_mtimer8   stdoutwriteFileNotFoundErrorr   stderrrZ   r   parentrG   rF   r$   submitr   as_completedresult)r0   rf   executorrl   irB   r   po_pathmo_pathargsfutureoutputerrorsstatuss                 r   r[   Command.compile_messages   s?    224G#,Y#7<Gw-!+!--e4	||~..',,.2I2II>>A- KK-- S")!* ! J >>A%KK%%Aw&OP7##KK%%S!"
 '+DO 6/'.."A"AKK%%JLST '+DOE 54H Tt';';TTT7TGTx}dCDG $8J %,,99'B)/&6~~)! KK--@Df U !KK--.F.UV&*DO CO 54 )  54s?   6JA$I>:B3J6BJ=A8J>
JJJJ
J)rZ   rF   r8   N)__name__
__module____qualname____firstlineno__r'   requires_system_checksrG   rF   r2   rh   r[   __static_attributes__ r4   r   r    r       s-    RDG'(O 
DEPN5+r4   r    )r   concurrent.futuresrk   rW   rH   r   pathlibr   django.core.management.baser   r   django.core.management.utilsr   r   r   r   r   r    r   r4   r   <module>r      s8       	   A U Uf+k f+r4   