ó
i4Vdc           @  s¢   d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l m Z m Z d  d l m	 Z	 m
 Z
 d  d l m Z m Z d „  Z d „  Z d e f d	 „  ƒ  YZ d S(
   iÿÿÿÿ(   t   unicode_literalsN(   t   BaseCommandt   CommandError(   t   find_commandt   popen_wrapper(   t   npatht   upathc         C  sP   t  |  d ƒ  } | j d ƒ } Wd  QX| d  d k pO | j t j t j f ƒ S(   Nu   rbi   i   s   ï»¿(   t   opent   readt
   startswitht   codecst   BOM_UTF16_LEt   BOM_UTF16_BE(   t   fnt   ft   sample(    (    s}   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/core/management/commands/compilemessages.pyt   has_bom   s    c         C  sI   y* t  |  d ƒ  t j |  d  ƒ Wd  QXWn t t f k
 rD t SXt S(   Nu   a(   R   t   ost   utimet   Nonet   IOErrort   OSErrort   Falset   True(   t   path(    (    s}   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/core/management/commands/compilemessages.pyt   is_writable   s    t   Commandc           B  sD   e  Z d  Z e Z e Z d Z d g Z d „  Z	 d „  Z
 d „  Z RS(   uE   Compiles .po files to .mo files for use with builtin gettext support.u   msgfmtu   --check-formatc         C  s|   | j  d d d d d d d g  d d	 ƒ| j  d
 d d d d d d g  d d ƒ| j  d d d d d d d t d d ƒd  S(   Nu   --localeu   -lt   destu   localet   actionu   appendt   defaultt   helpuY   Locale(s) to process (e.g. de_AT). Default is to process all. Can be used multiple times.u	   --excludeu   -xu   excludeu@   Locales to exclude. Default is none. Can be used multiple times.u   --use-fuzzyu   -fu   fuzzyu
   store_trueu   Use fuzzy translations.(   t   add_argumentR   (   t   selft   parser(    (    s}   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/core/management/commands/compilemessages.pyt   add_arguments'   s    !!!c           sº  | j  d ƒ } | j  d ƒ } t | j  d ƒ ƒ |  _ | j  d ƒ r[ |  j d g |  _ n  t |  j ƒ d  k r† t d |  j ƒ ‚ n  t j	 j
 d d ƒ d g } t j j  d ƒ rà d	 d
 l m } | j d „  | j Dƒ ƒ n  xb t j d d t ƒD]K \ ‰  } } x9 | D]1 } | d k r| j t j	 j
 ˆ  | ƒ ƒ qqWqö Wt t t j	 j t t j	 j | ƒ ƒ ƒ } | s„t d ƒ ‚ n  g  }	 xL | D]D }
 t t j	 j t j d |
 ƒ ƒ } |	 j t t j	 j | ƒ ƒ q‘W| pâ|	 } t | ƒ t | ƒ } x¸ | D]° }
 | r<g  | D] } t j	 j
 |
 | d ƒ ^ q} n	 |
 g } g  } xN | D]F } x= t j | ƒ D], \ ‰  } } | j ‡  f d †  | Dƒ ƒ qhWqRW| r|  j | ƒ qqWd  S(   Nu   localeu   excludeu	   verbosityu   fuzzyu   -fuL   Can't find %s. Make sure you have GNU gettext tools 0.15 or newer installed.u   confu   DJANGO_SETTINGS_MODULEiÿÿÿÿ(   t   settingsc         s  s   |  ] } t  | ƒ Vq d  S(   N(   R   (   t   .0R   (    (    s}   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/core/management/commands/compilemessages.pys	   <genexpr>>   s    u   .t   topdownuz   This script should be run from the Django Git checkout or your project or app tree, or with the settings module specified.u   %s/*u   LC_MESSAGESc         3  s*   |  ]  } | j  d  ƒ r ˆ  | f Vq d S(   u   .poN(   t   endswith(   R$   R   (   t   dirpath(    s}   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/core/management/commands/compilemessages.pys	   <genexpr>`   s    (   t   gett   intt	   verbosityt   program_optionsR   t   programR   R   R   R   t   joint   environt   django.confR#   t   extendt   LOCALE_PATHSt   walkR   t   appendt   sett   mapt   abspatht   filtert   isdirt   globt   basenamet   compile_messages(   R    t   optionst   localet   excludet   basedirsR#   t   dirnamest	   filenamest   dirnamet   all_localest   basedirt   locale_dirst   localest   lt   dirst	   locationst   ldir(    (   R'   s}   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/core/management/commands/compilemessages.pyt   handle0   sF    %'*" .	%c         C  s_  xXt  | ƒ D]J\ } \ } } |  j d k rK |  j j d | | f ƒ n  t j j | | ƒ } t | ƒ r t d | ƒ ‚ n  t j j	 | ƒ d } | d k rÐ t
 t | d ƒ ƒ rÐ |  j j d | ƒ d S|  j g |  j d t | d ƒ t | d ƒ g } t | ƒ \ } }	 }
 |
 r |	 r;d	 |  j |	 f } n d
 |  j } t | ƒ ‚ q q Wd S(   uI   
        Locations is a list of tuples: [(directory, file), ...]
        i    u   processing file %s in %s
um   The %s file has a BOM (Byte Order Mark). Django only supports .po files encoded in UTF-8 and without any BOM.u   .moue   The po files under %s are in a seemingly not writable location. mo files will not be updated/created.Nu   -ou   .pou   Execution of %s failed: %su   Execution of %s failed(   t	   enumerateR*   t   stdoutt   writeR   R   R-   R   R   t   splitextR   R   t   stderrR,   R+   R   (   R    RI   t   iR'   R   t   po_patht	   base_patht   argst   outputt   errorst   statust   msg(    (    s}   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/core/management/commands/compilemessages.pyR;   d   s(    #!(   t   __name__t
   __module__R   R   t   requires_system_checksR   t   leave_locale_aloneR,   R+   R"   RK   R;   (    (    (    s}   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/core/management/commands/compilemessages.pyR      s   				4(   t
   __future__R    R
   R9   R   t   django.core.management.baseR   R   t   django.core.management.utilsR   R   t   django.utils._osR   R   R   R   R   (    (    (    s}   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/core/management/commands/compilemessages.pyt   <module>   s   		