3 \b@slddlZddlZddlmZmZddlmZiadddZddd Z dd d Z d d Z dddZ ddZ dS)N)DistutilsFileErrorDistutilsInternalError)logc Cspt|tstd|ftjj|}g}tjj|s<|dkr@|Stjtjj |rV|Stjj |\}}|g}x6|r|rtjj| rtjj |\}}|j d|qnWx|D]}tjj ||}tjj |} tj| rq|dkrt jd||s`ytj||WnVtk rT} z8| jtjko*tjj|sDtd|| jdfWYdd} ~ XnX|j|dt| <qW|S)Nz(mkpath: 'name' must be a string (got %r)rrz creating %szcould not create '%s': %s) isinstancestrrospathnormpathisdir _path_createdgetabspathsplitinsertjoinrinfomkdirOSErrorerrnoZEEXISTrargsappend) namemodeverbosedry_runZ created_dirsheadtailZtailsdZabs_headexcr#*/usr/lib64/python3.6/distutils/dir_util.pymkpaths>       &  r%cCsVt}x(|D] }|jtjj|tjj|q Wx t|D]}t||||dq:WdS)N)rr)setaddr r rdirnamesortedr%)Zbase_dirfilesrrrZneed_dirfiledirr#r#r$ create_treePs   r-cCsfddlm}| r,tjj| r,td|ytj|} Wn>tk rx} z"|rVg} ntd|| jfWYdd} ~ XnX|st ||dg} x| D]} tjj || } tjj || }| j drq|otjj | rtj | }|dkrtjd|||stj||| j|qtjj| r>| jt| |||||||d q|| ||||||d | j|qW| S) Nr) copy_filez&cannot copy tree '%s': not a directoryzerror listing files in '%s': %s)rz.nfsrzlinking %s -> %s)rr)Zdistutils.file_utilr.r r rrlistdirrstrerrorr%r startswithislinkreadlinkrrsymlinkrextend copy_tree)srcdstZ preserve_modeZpreserve_timesZpreserve_symlinksupdaterrr.nameseZoutputsnZsrc_nameZdst_nameZ link_destr#r#r$r6csH  "      r6cCslxVtj|D]H}tjj||}tjj|rDtjj| rDt||q |jtj|fq W|jtj |fdS)N) r r/r rrr2_build_cmdtuplerremovermdir)r cmdtuplesfZreal_fr#r#r$r=s  r=cCs|dkrtjd||rdSg}t||xp|D]h}y2|d|dtjj|d}|tkrdt|=Wq0tk r}ztjd||WYdd}~Xq0Xq0WdS)Nrz'removing '%s' (and everything under it)rzerror removing %s: %s) rrr=r r rrrwarn)Z directoryrrr@cmdrr"r#r#r$ remove_trees    rDcCs6tjj|\}}|ddtjkr2||dd}|S)Nrr)r r splitdrivesep)r Zdriver#r#r$ensure_relativesrG)rrr)rrr)rrrrrr)rr)r rZdistutils.errorsrrZ distutilsrrr%r-r6r=rDrGr#r#r#r$s  ?  D