K iD\dZddlZddlZddlZddlZddlmZddlmZddl m Z m Z Gdde Z e jZej edd ej"d dfd Zej&d efd Zej&dd ZddZ ddZdZdZddZdZy)zWdistutils.dir_util Utility functions for manipulating directories and directory trees.N) file_util)log)DistutilsFileErrorDistutilsInternalErrorc8eZdZdZdZefdZdZxZS)SkipRepeatAbsolutePathsz Cache for mkpath. In addition to cheapening redundant calls, eliminates redundant "creating /foo/bar/baz" messages in dry-run mode. c|t_yN)r instance)selfs d/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/setuptools/_distutils/dir_util.py__init__z SkipRepeatAbsolutePaths.__init__s +/(c6t||j yr )superr clear)cls __class__s rrzSkipRepeatAbsolutePaths.clears c3<<&(rcFtjfd}|S)Nc|jvry|g|i|}j|j|Sr )absoluteadd)pathargskwargsresultfuncr s rwrapperz-SkipRepeatAbsolutePaths.wrap..wrappers?}}$&$000F HHT]]_ %Mr) functoolswraps)r rrs`` rwrapzSkipRepeatAbsolutePaths.wraps%     r) __name__ __module__ __qualname____doc__r classmethodrr" __classcell__)rs@rr r s&0)) rr namereturnc|r&|jstjd| |xs|j|ddyy#t$r#}t d|d|j dd}~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, log the directory created. z creating %sT)modeparentsexist_okzcould not create '': N)is_dirrinfomkdirOSErrorrr)r)r,verbosedry_runexcs rmkpathr8.spt{{} %OE4::4:EE O #5dV3sxx|n!MNNOsAA A1A,,A1cFttj|g|i|Sr )r8pathlibPathr)rrs r_r=Bs ',,t$ 6t 6v 66rc td|d)z. Detect a common bug -- name is None. z%mkpath: 'name' must be a string (got ))rr<s rr=r=Gs !#HPQ!R SSrcltfd|D}t|D]}t||||y)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()'. c3K|]A}tjjtjj|Cywr )osrjoindirname).0filebase_dirs r zcreate_tree..Zs-ST277<<"''//$*?@SsAA r5r6N)setsortedr8)rGfilesr,r5r6need_dirdirs` r create_treerOOs9SUSSHh<sD'7; %srI) rBrrC startswithislinkreadlinkrr2symlinkrWrdr copy_file) r)rQrRrSr5r6rTrUrVsrc_namedst_name link_dests rr[r[sww||C&Hww||C&H vRWW^^H5KK) a< HH'9 = JJy( + x                ) sC7D"9D :'D"ctj|D]}tjj||}tjj |r,tjj |s t ||n|jtj|f|jtj|fy)zHelper for remove_tree().N) rBrXrrCrWrg_build_cmdtupleappendremovermdir)r cmdtuplesfreal_fs rroros ZZ 2dA& 77== )? FI .   bii0 1 2 bhh%&rc |dk\rtjd||ryg}t|||D]%} |d|dtj 'y#t $r!}tj d||Yd}~Nd}~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)rr2ror rr4warning) directoryr5r6rscmdr7s r remove_treerzs !| :IFIIy)A A CF3q6N # ) ) + A  A KK/C @ @ As"A B!A==Bctjj|\}}|ddtjk(r||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)rBr splitdrivesep)rdrives rensure_relativersC ''$$T*KE4 AayBFFtABx Kr)iTF)r)N)TTFFTF)TF)r&r r]rBr:r_logrerrorsrrrJr r"rsingledispatchr;r8registerstrr=rOrdr[rorzrrrrsG >c8 " # ( ( OO4O O$7C77TT<*   5Ep0f'A*r