o bc'@s ddlZddlZddlmZddlmZgdZiZdZgdZ ddZ dd d Z d d Z ddZ GdddZdddZee fddZddZddZedkrVedSdS)N) filterfalse) GenericAlias) clear_cachecmpdircmpcmpfilesDEFAULT_IGNORESi )ZRCSZCVSZtagsz.gitz.hgz.bzrZ_darcs __pycache__cCs tdSN)_cacheclearr r h/home/lily/lilypond-2.24.1/release/binaries/dependencies/install/Python-3.10.8/lib/python3.10/filecmp.pyrs rTcCs tt|}tt|}|dtjks|dtjkrdS|r'||kr'dS|d|dkr1dSt||||f}|durTt||}ttdkrLt|t||||f<|S)NrFTd) _sigosstatS_IFREGr get_do_cmplenr)f1f2shallows1s2Zoutcomer r rrs    rcCst|j|j|jfSr )rS_IFMTst_modest_sizest_mtime)str r rrFs rc Cst}t|dG}t|d1} ||}||}||kr, WdWddS|s= WdWddSq1sAwYWddS1sQwYdS)NrbTF)BUFSIZEopenread)rrbufsizefp1fp2Zb1Zb2r r rrKs  4rc@seZdZ dddZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ e eeeeeeeeeeeed ZddZeeZdS)rNcCsF||_||_|durtjtjg|_n||_|durt|_dS||_dSr )leftrightrcurdirpardirhiderignore)selfabr.r-r r r__init__|s  zdircmp.__init__cCsPtt|j|j|j|_tt|j|j|j|_|j |j dSr ) _filterrlistdirr)r-r. left_listr* right_listsortr/r r rphase0s     z dircmp.phase0cCsttttjj|j|j}ttttjj|j|j}tt|j t |j ||_ tt|j t |j ||_tt|j t |j ||_dSr )dictzipmaprpathnormcaser5r6list __getitem__filter __contains__commonr left_only right_only)r/r0r1r r rphase1s z dircmp.phase1c Csg|_g|_g|_|jD]x}tj|j|}tj|j|}d}zt |}Wn t y2d}Ynwzt |}Wn t yEd}Ynw|r~t |j }t |j }||kr_|j |q t |rk|j |q t |rw|j |q |j |q |j |q dS)Nrr) common_dirs common_files common_funnyrCrr=joinr)r*rOSErrorrrappendS_ISDIRS_ISREG) r/xZa_pathZb_pathokZa_statZb_statZa_typeZb_typer r rphase2s:       z dircmp.phase2cCs&t|j|j|j}|\|_|_|_dSr )rr)r*rH same_files diff_files funny_files)r/Zxxr r rphase3sz dircmp.phase3cCsPi|_|jD]}tj|j|}tj|j|}||||j|j |j|<qdSr ) subdirsrGrr=rJr)r* __class__r.r-)r/rOZa_xZb_xr r rphase4s  z dircmp.phase4cCs$||jD]}|q dSr )rXrVvaluesphase4_closurer/Zsdr r rrZs zdircmp.phase4_closurecCstd|j|j|jr|jtd|jd|j|jr*|jtd|jd|j|jr8|jtd|j|jrF|jtd|j|jrT|jtd|j|j rb|j td|j |j rr|j td|j dSdS) NZdiffzOnly in:zIdentical files :zDiffering files :zTrouble with common files :zCommon subdirectories :zCommon funny cases :) printr)r*rDr7rErRrSrTrGrIr8r r rreports.           z dircmp.reportcCs*||jD] }t|q dSr )r^rVrYr]r[r r rreport_partial_closure  zdircmp.report_partial_closurecCs*||jD] }t|q dSr )r^rVrYr]report_full_closurer[r r rrar`zdircmp.report_full_closure) rVrRrSrTrGrHrIrCrDrEr5r6cCs*||jvr t||j||t||Sr ) methodmapAttributeErrorgetattr)r/attrr r r __getattr__s  zdircmp.__getattr__)NN)__name__ __module__ __qualname__r2r9rFrQrUrXrZr^r_rar:rbrf classmethodr__class_getitem__r r r rrXs( # #  rcCsL gggf}|D]}tj||}tj||}|t||||q|Sr )rr=rJ_cmprL)r0r1rCrresrOZaxZbxr r rrs rcCs*z ||||| WStyYdSw)N)rK)r0r1Zshabsrr r rrls  rlcCstt|j|Sr )r?rrB)flistskipr r rr3&sr3cCstddl}ddl}||jddd\}}t|dkr!|ddt|d|d}d|vr4|dS|dS)Nrrrrnzneed exactly two args)z-r)sysgetoptargvrZ GetoptErrorrrar^)rtruZoptionsargsZddr r rdemo,s    rx__main__)T)rr itertoolsrtypesr__all__r r#rrrrrrrrorlr3rxrgr r r rs,    (  +