ó zfc@sÓdZddlZddlZddlmZmZmZmZdddgZiZ dZ d d „Z d „Z d „Z ddd „ƒYZd d„Zee d„Zd„Zd„ZedkrÏeƒndS(sžUtilities for comparing files and directories. Classes: dircmp Functions: cmp(f1, f2, shallow=1) -> int cmpfiles(a, b, common) -> ([], [], []) iÿÿÿÿN(tifiltert ifilterfalsetimaptiziptcmptdircmptcmpfilesiiicCsôttj|ƒƒ}ttj|ƒƒ}|dtjksP|dtjkrTtS|rj||krjtS|d|dkr‚tStj||||fƒ}|dkrðt ||ƒ}t tƒdkr×tj ƒn|t||||f prints a report on the differences between dir1 and dir2 or x.report_partial_closure() -> prints report on differences between dir1 and dir2, and reports on common immediate subdirectories. x.report_full_closure() -> like report_partial_closure, but fully recursive. Attributes: left_list, right_list: The files in dir1 and dir2, filtered by hide and ignore. common: a list of names in both dir1 and dir2. left_only, right_only: names only in dir1, dir2. common_dirs: subdirectories in both dir1 and dir2. common_files: files in both dir1 and dir2. common_funny: names in both dir1 and dir2 where the type differs between dir1 and dir2, or the name is not stat-able. same_files: list of identical files. diff_files: list of filenames which differ. funny_files: list of files which could not be compared. subdirs: a dictionary of dircmp objects, keyed by names in common_dirs. cCsm||_||_|dkr6tjtjg|_n ||_|dkr`dddg|_n ||_dS(NtRCStCVSttags(tlefttrightRRtcurdirtpardirthidetignore(tselftatbR/R.((s/usr/lib64/python2.7/filecmp.pyt__init__os     cCsnttj|jƒ|j|jƒ|_ttj|jƒ|j|jƒ|_|jj ƒ|jj ƒdS(N( t_filterRtlistdirR*R.R/t left_listR+t right_listtsort(R0((s/usr/lib64/python2.7/filecmp.pytphase0{s  cCs»ttttjj|jƒ|jƒƒ}ttttjj|jƒ|jƒƒ}t|j t |j |ƒƒ|_ t|j t |j |ƒƒ|_t|j t |j |ƒƒ|_dS(N(tdictRRRtpathtnormcaseR6R7tmapt __getitem__Rt __contains__tcommonRt left_onlyt right_only(R0R1R2((s/usr/lib64/python2.7/filecmp.pytphase1ƒs **!!c Cs}g|_g|_g|_x[|jD]P}tjj|j|ƒ}tjj|j|ƒ}d}ytj |ƒ}Wntj k r’}d}nXytj |ƒ}Wntj k rÄ}d}nX|ret j |j ƒ}t j |j ƒ} || kr|jj |ƒqut j|ƒr0|jj |ƒqut j|ƒrR|jj |ƒqu|jj |ƒq%|jj |ƒq%WdS(Nii(t common_dirst common_filest common_funnyR@RR;tjoinR*R+R terrorRRtappendtS_ISDIRtS_ISREG( R0txta_pathtb_pathtokta_stattwhytb_statta_typetb_type((s/usr/lib64/python2.7/filecmp.pytphase2Šs4      cCs7t|j|j|jƒ}|\|_|_|_dS(N(RR*R+REt same_filest diff_filest funny_files(R0txx((s/usr/lib64/python2.7/filecmp.pytphase3­scCssi|_xc|jD]X}tjj|j|ƒ}tjj|j|ƒ}t|||j|j ƒ|j| s   " &  ¤