
    BhD                        d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlm	Z	 d dl
mZ d dlmZ e j                  j                  e      Ze j                  j%                  e j                  j'                  edd            Zd	 Z G d
 de      Zy)    N)Path)CommandError)has_bom)TestCase)TemporaryDirectoryz..localec            	      Z   	 t        j                  ddgt         j                  t         j                        } t
        j                  j                  dd      dg}t
        j                  j                  d      r!dd	l
m} |j                  |j                         t        t        t
        j                  j                   t#        t
        j                  j$                  |                  }|st	        d
      |D ]  }t        j&                  |      D ]  \  }}}|D ]  }|j)                  d      st+        |      |z  }	t-        |	      rt	        d|	z        t
        j                  j/                  |	      d   }
t0        j2                  dk(  rddd|
dz   |
dz   g}nddd|
dz   |
dz   g}t        j                  |t         j                  t         j                        } | j5                         d   }| j6                  dk7  sd|fc c c S    y# t        $ r}t	        d|       d }~ww xY w)Nmsgfmtz	--version)stdoutstderrzSUnable to run msgfmt (gettext) command. You probably don't have gettext installed. confr   DJANGO_SETTINGS_MODULEr   )settingszvThis script should be run from the Django SVN tree or your project or app tree, or with the settings module specified.z.pozmThe %s file has a BOM (Byte Order Mark). Django only supports .po files encoded in UTF-8 and without any BOM.win32z--check-formatz-oz.moF)T )
subprocessPopenPIPEOSErrorr   ospathjoinenvirongetdjango.confr   extendLOCALE_PATHSsetmapabspathfilterisdirwalkendswithr   r   splitextsysplatformcommunicate
returncode)pipeebasedirsr   basedirdirpathdirnames	filenamesfpfnpfbitsr   s                A/home/dcms/DCMS/lib/python3.12/site-packages/cms/tests/test_po.pycompile_messagesr7      s   
; 7
XbXgXgh VX.9H	zz~~./(--. 3rwwrww}}h(GHIH5
 	

  -,.GGG,< 	-(GXy -::e$w-!+Cs|*cehi  ))#.q1B ||w. (*:D"u*bSXjY (*:D"u*bSXjY%++DQ[Q`Q`aD!--/3F!+$f},+-	--0 W  
bcdbef
 	

s   6H 	H*H%%H*c                       e Zd Zd Zy)PoTestc                    t               5 }t        j                  t        t        j
                  j                  |d             t	        j                         }t	        j                  |       	 t               \  }}t	        j                  |       	 d d d        | j                         y # t	        j                  |       w xY w# 1 sw Y   6xY w)Nr   )r   shutilcopytree
SOURCE_DIRr   r   r   getcwdchdirr7   
assertTrue)selftmpdirolddirokr   s        r6   test_po_sanityzPoTest.test_po_sanityD   s    ! 	!VOOJVX(FGYY[FHHV!-/
F 	! 	F#  	! 	!s$   A"C.B,;C,CCCN)__name__
__module____qualname__rE        r6   r9   r9   C   s    	$rJ   r9   )r   r;   r   r'   pathlibr   django.core.management.baser   /django.core.management.commands.compilemessagesr   django.test.testcasesr   $cms.test_utils.util.context_managersr   r   dirname__file__THIS_DIRr!   r   r=   r7   r9   rI   rJ   r6   <module>rS      sg    	   
  4 C * C77??8$WW__RWW\\(D(CD
/d
$X 
$rJ   