
    9bh                     ,   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mZm	Z	 d dl
mZ  ee      dz  dz  dz  Z e j                  de j                        Z e j                  d	      Zd
ddZd Zd Z e	        G d dej(                               Zd Zy)    N)Path)	REPO_ROOTTEST_HOME_DIRrequires_subprocess)skip_if_missingToolsi18nzpygettext.pyz)msgid(.*?)(?:msgid_plural|msgctxt|msgstr)z"((?:\\"|[^"])*)"Tstdout_onlyc                    t        j                  t        j                  t        ddd| gt         j
                  t         j
                  d      }|r|j                  S |S )Nz--no-locationz-o-T)stdoutstderrtext)
subprocessrunsys
executable	pygettextPIPEr   )pathr   ress      B/opt/python-3.12.12/usr/lib/python3.12/test/support/i18n_helper.py_generate_po_filer      sJ    
..#..))4d< *
"$C zzJ    c                     g }t         j                  |       D ]L  }dj                  t        j                  |            }|j	                  dd      }|s<|j                  |       N t        |      S )N z\"")msgid_patternfindalljoinmsgid_string_patternreplaceappendsorted)pomsgidsmsgidmsgid_strings       r   _extract_msgidsr*      sc    F&&r*ww3;;EBC#++E37MM,'	 +
 &>r   c                 2    t        t              dz  | z  dz  S )Ntranslationdataz
msgids.txt)r   r   )module_names    r   _get_snapshot_pathr.   %   s    !22[@<OOr   c                       e Zd Zd Zy)TestTranslationsBasec                 n   	 t        d       t        |j                  d      }| j                  |j                  d       | j                  |j
                  d       t        |j                        }t        |j                        }|j                         j                         }| j                  ||       y )Nr	   Fr
   r   r   )r   r   __file__assertEqual
returncoder   r*   r   r.   __name__	read_text
splitlinesassertListEqual)selfmoduler   r'   snapshot_pathsnapshots         r   assertMsgidsEqualz&TestTranslationsBase.assertMsgidsEqual,   s    	 	UC+R( ,*6??; **,779VX.r   N)r5   
__module____qualname__r=    r   r   r0   r0   )   s    /r   r0   c                     t        | j                        }t        |      }t        | j                        }|j                  dj                  |             y )N
)r   r2   r*   r.   r5   
write_textr!   )r:   contentsr'   r;   s       r   update_translation_snapshotsrE   ;   s?     1HX&F&v7MTYYv./r   )rer   r   unittestpathlibr   test.supportr   r   r   test.test_toolsr   r   compileDOTALLr   r"   r   r*   r.   TestCaser0   rE   r@   r   r   <module>rN      s    	  
   F F + Og%.?	

G99&!rzz"67  ,0 P /8,, / /"0r   