� �fc@s�dZdZddlZddlZddlZddlZyddlZWn:ek r�ddd��YZe�ZejdIJnXej d�Z ej d�Z d �Z d �Z d �Zd ejd Zy#ejejdd�\ZZWn=ejk r5ZejeIJejeIJejd�nXejZeZxAeD]9\ZZedkrpejZqLedkrLeZqLqLWes�ejeIJejd�nxFejee�D]2Zer�deGHnee�Z e r�eGHq�q�WdS(s_List all those Python files that require a coding directive Usage: nocoding.py dir1 [dir2...] sOleg Broytmann, Georg Brandli����NtpysourcecBseZdZZZd�ZRS(c os�x�|D]�}tjj|�r0|jd�Vqtjj|�rxZtj|�D]F\}}}x4|D],}|jd�rhtjj||�VqhqhWqRWqqWdS(Ns.py(tostpathtisfiletendswithtisdirtwalktjoin( tselftpathstargstkwargsRtroottdirstfilestfilename((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pytwalk_python_filess  N(t__name__t __module__tNonethas_python_exttlooks_like_pythontcan_be_compiledR(((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pyRss^The pysource module is not available; no sophisticated Python source file search will be done.s&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)cCs&tj|�}|r"|jd�SdS(Nit(tdecl_retmatchtgroup(tlineR((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pytget_declaration&s cCs.yt||�Wntk r%tSXtSdS(N(tunicodetUnicodeDecodeErrortFalsetTrue(ttexttcodec((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pythas_correct_encoding,s  cCs�yt|d�}Wntk r'dSX|j�}|j�}t|�sgtj|�rut|�ru|j�tS|j �}|j�t |||d�r�tSt S(NtrUtascii( topentIOErrorRtreadlineRtblank_reRtcloseRtreadR#R (tfullpathtinfiletline1tline2trest((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pytneeds_declaration4s       sjUsage: %s [-cd] paths... -c: recognize Python source files trying to compile them -d: debug outputiitcds-cs-dsTesting for coding: %s((!t__doc__t __author__tsysRtretgetoptRt ImportErrortstderrtcompileRR)RR#R1targvtusagetoptsR terrortmsgtexitRt is_pythonRtdebugtotaRR RR,tresult(((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pytsH0     #