WcbcsjdZddlZddlZddlmZmZddlmZiad dZ d dZ dd Z d Z dd Z d ZdS)zWdistutils.dir_util Utility functions for manipulating directories and directory trees.N)DistutilsFileErrorDistutilsInternalError)logc st|tstd|dtjj |}g}tjj |s|dkr|Stjtjj|r|Stjj|\}}|g}|r|r~tjj |s]tjj|\}}|jd||r$|r"tjj |s]|D]}tjj||}tjj|} tj| r^|dkrtjd||s+ tj|||j+|dt| <|S#t $rm} | j"t"j$kr!tjj |s#t'd|d| j(d Yd } ~ d } ~ wwxYw) aCreate a directory and any missing ancestor directories. If the directory already exists (or if 'name' is the empty string, which means the current directory, which of course exists), then do nothing. Raise DistutilsFileError if unable to create some directory along the way (eg. some sub-path exists, but is a file rather than a directory). If 'verbose' is true, print a one-line summary of each mkdir to stdout. Return the list of directories actually created. z%mkpath: 'name' must be a string (got z)Zrrz creating %szcould not create '': iN)Z isinstanceZstrrospathZnormpathisdir _path_createdZgetabspathZsplitZinsertjoinrinfoZmkdirOSErrorerrnoZEEXISTrZargsappend) Znamemodeverbosedry_runZ created_dirsZheadZtailZtailsZdZabs_headexcs +/usr/lib64/python3.12/distutils/dir_util.pymkpathrs5 dC $$<@DDBD D 77  D !DL ww}}Tdbjj.//77==<4 FE $44 d 3 3ww}}T* t Q $44 d 3 3$$ww||D!$77??4(   X & &  a<< HH]D ) )w Nt$$    % %"# h  N N N U\\11bggmmD6I6I,,9=sxx||LNN7J6I6I6I6I NsH  JA#I<<Jc st}|D]S}|jtjj |tjj |Ut |D]}t||||dS)aCreate all the empty directories under 'base_dir' needed to put 'files' there. 'base_dir' is just the name of a directory which doesn't necessarily exist yet; 'files' is a list of filenames to be interpreted relative to 'base_dir'. 'base_dir' + the directory portion of every file in 'files' will be created if it doesn't already exist. 'mode', 'verbose' and 'dry_run' flags are as for 'mkpath()'. rrN)ZsetZaddrrr ZdirnameZsortedr)Zbase_dirZfilesrrrZneed_dirZfileZdirs r create_treerPsuHDD RWW\\(BGGOOD,ABCCCh<<sD'7;;;;<<c sddlm}|s1tjj |st d|z tj |} |st||g} | D]J} tjj|| } tjj|| }| jdr[|rtjj| rctj| }|d krtjd |||stj ||| j#|tjj | r'| j%t'| ||||||| )|| |||||| | j#|M| S#t$r-} |rg} nt d|d| jYd} ~ d} ~ wwxYw) aCopy an entire directory tree 'src' to a new location 'dst'. Both 'src' and 'dst' must be directory names. If 'src' is not a directory, raise DistutilsFileError. If 'dst' does not exist, it is created with 'mkpath()'. The end result of the copy is that every file in 'src' is copied to 'dst', and directories under 'src' are recursively copied to 'dst'. Return the list of files that were copied or might have been copied, using their output name. The return value is unaffected by 'update' or 'dry_run': it is simply the list of all files under 'src', with the names changed to be under 'dst'. 'preserve_mode' and 'preserve_times' are the same as for 'copy_file'; note that they only apply to regular files, not to directories. If 'preserve_symlinks' is true, symlinks will be copied as symlinks (on platforms that support them!); otherwise (the default), the destination of the symlink will be copied. 'update' and 'verbose' are the same as for 'copy_file'. r) copy_filez&cannot copy tree '%s': not a directoryzerror listing files in 'rN)rz.nfsrzlinking %s -> %sr)Zdistutils.file_utilrrrr rlistdirrZstrerrorrr Z startswithislinkZreadlinkrr ZsymlinkrZextend copy_tree)ZsrcZdstZ preserve_modeZpreserve_timesZpreserve_symlinksZupdaterrrZnamesZeZoutputsZnZsrc_nameZdst_nameZ link_dests rrrcs*.----- 7277==-- 6<> >I 3 7sG$$$G %%77<<Q'77<<Q' <<     !9!9 H-I!||+XyAA7 9h// NN8 $ $ $ WW]]8 $ $ NN(Hm(*;V")7<< = = = Ih-$fg% ' ' ' NN8 $ $ $ NO III 7EE$$7:ssAJJJGI I EEEEIsF66 G-"G((G-cstj|D]}tjj||}tjj |r0tjj |st ||v|jtj|f|jtj|fdS)zHelper for remove_tree().N) rrrr r r_build_cmdtuplerZremoveZrmdir)r cmdtuplesZfZreal_fs rrrs ZZ 22d1% 77== )?)? FI . . .   bii0 1 1 1 bhh%&&&&rcsr|dkrtjd||rdSg}t|||D]P} |d|dtjj |d}|t vrt |=RdS#t$r#}tjd||Yd}~|d}~wwxYw)zRecursively remove an entire directory tree. Any errors are ignored (apart from being reported to stdout if 'verbose' is true). rz'removing '%s' (and everything under it)Nrzerror removing %s: %s) rr rrrr r rZwarn)Z directoryrrrZcmdr rs r remove_treer s!|| :IFFwIIy))>> > CF3q6NNggooc!f-G-''!'* >> > > > HH,i = = = = = = = >sA B  B6B11B6cstjj|\}}|ddtjkr||ddz}|S)zTake the full path 'path', and make it a relative path. This is useful to make 'path' the second argument to os.path.join(). rrN)rrZ splitdriveZsep)rZdrives rensure_relativer!sF ''$$T*KE4 AayBFFtABx Kr)rrr)rrrrrr)rr)Z__doc__rrZdistutils.errorsrrZ distutilsrr rrrrr r!)rrr"sGG GGGGGGGG ====~<<<<&9:@ACCCCJ'''>>>>0r