bg`dZddlZddlmZddlmZdddd Zdd Z ddZddZ dZ dS)zFdistutils.file_util Utility functions for operating on single files. N)log)DistutilsFileErrorcopyingz hard linkingzsymbolically linking)Nhardsym@cd}d} t|d}n,#t$r}td|d|jd}~wwxYwtj|rB t j|n,#t$r}td|d|jd}~wwxYw t|d}n,#t$r}td|d|jd}~wwxYw ||}n,#t$r}td |d|jd}~wwxYw|snD | |n,#t$r}td |d|jd}~wwxYw |r| |r| dSdS#|r| |r| wwxYw) a5Copy the file 'src' to 'dst'; both must be filenames. Any error opening either file, reading from 'src', or writing to 'dst', raises DistutilsFileError. Data is read/written in chunks of 'buffer_size' bytes (default 16k). No attempt is made to handle anything apart from regular files. Nrbzcould not open '': zcould not delete 'wbzcould not create 'Tzcould not read from 'zcould not write to ') openOSErrorrstrerrorospathexistsunlinkreadwriteclose)srcdst buffer_sizefsrcfdstebufs V/opt/cloudlinux/venv/lib64/python3.11/site-packages/setuptools/_distutils/file_util.py_copy_file_contentsr s~ D D" NT??DD N N N$%L%L%L %L%LMM M N 7>>#   T T # T T T()Rc)R)Raj)R)RSSS T PT??DD P P P$%N#%N%N!*%N%NOO O P V Wii ,, W W W()U)U)U)U)UVVV W  V 3 V V V()T)T)T )T)TUUU V V   JJLLL   JJLLLLL     JJLLL   JJLLLL sF A<A"F$A98F9 B"BB""F&B76F7 C CC  F%C;:F; D$DD$$F+EF E* E%%E**F/GTFcddlm}ddlm} m} m} m} tj |std|dtj |r@|} tj |tj |}ntj|} |r+|||s|dkrtjd||dfS t"|}n!#t$$rt'd|d wxYw|dkrotj |tj |krtjd ||| ntjd ||||r|dfS|d krjtj|r tj||s* tj|||dfS#t0$rYncwxYwn^|d krXtj|r tj||stj|||dfSt5|||s|r_tj|}|r#tj||| || f|r$tj|| || |dfS) aCopy a file 'src' to 'dst'. If 'dst' is a directory, then 'src' is copied there with the same name; otherwise, it must be a filename. (If the file exists, it will be ruthlessly clobbered.) If 'preserve_mode' is true (the default), the file's mode (type and permission bits, or whatever is analogous on the current platform) is copied. If 'preserve_times' is true (the default), the last-modified and last-access times are copied as well. If 'update' is true, 'src' will only be copied if 'dst' does not exist, or if 'dst' does exist but is older than 'src'. 'link' allows you to make hard links (os.link) or symbolic links (os.symlink) instead of copying: set it to "hard" or "sym"; if it is None (the default), files are copied. Don't set 'link' on systems that don't support it: 'copy_file()' doesn't check if hard or symbolic linking is available. If hardlink fails, falls back to _copy_file_contents(). Under Mac OS, uses the native file copy function in macostools; on other systems, uses '_copy_file_contents()' to copy file contents. Return a tuple (dest_name, copied): 'dest_name' is the actual name of the output file, and 'copied' is true if the file was copied (or would have been copied, if 'dry_run' true). r)newer)S_IMODEST_ATIMEST_MODEST_MTIMEz can't copy 'z&': doesn't exist or not a regular filerz"not copying %s (output up-to-date)zinvalid value 'z' for 'link' argumentz %s %s -> %srr)distutils._modifiedr"statr#r$r%r&rrisfilerisdirjoinbasenamedirnamerdebug _copy_actionKeyError ValueErrorinforsamefilelinkrsymlinkr utimechmod)rr preserve_modepreserve_timesupdater4verbosedry_runr"r#r$r%r&diractionsts r copy_filer@?s)R*)))))999999999999 7>>#    F3 F F F    w}}S#gll3 0 0 5 566gooc"" eeCoo a<< I:C @ @ @QxHd# HHHF4FFFGGGH!|| 7  C BG$4$4S$9$9 9 9 H]FC 5 5 5 5 H]FC 5 5 5Qx s## (8(8c(B(B  S!!!Qx        s## (8(8c(B(B  JsC 8OS!!!00 WS\\  8 HS2h<H6 7 7 7  0 HS''"W+.. / / / 8Os1 C??D!G:: HHc tddl}ddlm}m}m}m}m} |dkrtjd|||r|S| |std|d||r*tj |||}n!||rtd|d|d |||std|d|d d } tj ||nG#t$r:} | j\} } | |jkrd } ntd |d|d| Yd} ~ nd} ~ wwxYw| rt#||| tj|n]#t$rP} | j\} } tj|n#t$rYnwxYwtd |d|d|d| d} ~ wwxYw|S)a%Move a file 'src' to 'dst'. If 'dst' is a directory, the file will be moved into it with the same name; otherwise, 'src' is just renamed to 'dst'. Return the new full name of the file. Handles cross-device moves on Unix using 'copy_file()'. What about other systems??? rN)r,r-rr*r)rzmoving %s -> %sz can't move 'z': not a regular filez': destination 'z' already existsz' not a valid pathFTzcouldn't move 'z' to 'r )r;z' by copy/delete: delete 'z ' failed: )errnoos.pathr,r-rr*r)rr2rrrr+renamerargsEXDEVr@r)rrr;r<rBr,r-rr*r)copy_itrnummsgs r move_filerJsLLL@@@@@@@@@@@@@@!|| "C--- 6#;;L !J!J!J!JKKK uSzz gll3 ..   E3 E E E E E    5    G3 G G G G G   GQ #s QQQV c %+  GG$%Os%O%O#%O%O#%O%OPP P GGGGQ #sG,,,,  IcNNNN   JS#  #    $0#00S0000*-00   JsTC** D.40D))D.E F5% F00FF0 FF0FF00F5ct|dd5}|d|DddddS#1swxYwYdS)z{Create a file with the specified name and write 'contents' (a sequence of strings without line terminators) to it. wzutf-8)encodingc3 K|] }|dzV dS) N).0lines r zwrite_file..s&66TTD[666666N)r writelines)filenamecontentsfs r write_filerYs hg . . .7! 66X666666777777777777777777s AAA)r )TTFNTF)TF) __doc__r_logrerrorsrr/r r@rJrYrPrTrr]s  &&&&&& @VWW ----f   iiiiZ8888v77777rT