
    vKg                     d    S r SSKrSSKJr  SSKJr  SSSS	.rSS
 jr      SS jrSS jr	S r
g)zFdistutils.file_util

Utility functions for operating on single files.
    N   )log)DistutilsFileErrorcopyingzhard linkingzsymbolically linking)Nhardsymc                    SnSn  [        U S5      n[        R
                  R                  U5      (       a   [        R                  " U5         [        US5      n  UR                  U5      nU(       d  O UR                  U5        M.  U(       a  UR                  5         U(       a  UR                  5         gg! [         a   n[        SU  SUR                   35      eSnAff = f! [         a   n[        SU SUR                   35      eSnAff = f! [         a   n[        SU SUR                   35      eSnAff = f! [         a   n[        SU  SUR                   35      eSnAff = f! [         a   n[        S	U SUR                   35      eSnAff = f! U(       a  UR                  5         U(       a  UR                  5         f f = f)
a!  Copy 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.
Nrbzcould not open '': zcould not delete 'wbzcould not create 'zcould not read from 'zcould not write to ')openOSErrorr   strerrorospathexistsunlinkreadwriteclose)srcdstbuffer_sizefsrcfdstebufs          _/var/www/highfloat_scraper/venv/lib/python3.13/site-packages/setuptools/_distutils/file_util.py_copy_file_contentsr      s    DD"	NT?D 77>>#T		#	PT?D Wii, V

3  JJLJJL =  	N$'7uC

|%LMM	N  T(+=cU#ajj\)RSST
  	P$'9#c!**%NOO	P  W(+@S)UVVW  V(+?uC

|)TUUV JJLJJL s   B: $F C' D F E .F 7E. F :
C$CC$$F '
D1DDF 
D>D99D>>F 
E+E&&E++F .
F8FFF 1Gc                 
   SSK Jn  SSKJn	Jn
JnJn  [        R                  R                  U 5      (       d  [        SU  S35      e[        R                  R                  U5      (       a@  Un[        R                  R                  U[        R                  R                  U 5      5      nO[        R                  R                  U5      nU(       a.  U" X5      (       d!  US:  a  [        R                   " SU 5        US4$  ["        U   nUS:  aq  [        R                  R                  U5      [        R                  R                  U 5      :X  a  [        R(                  " S
XU5        O[        R(                  " S
XU5        U(       a  US4$ US:X  ad  [        R                  R+                  U5      (       a$  [        R                  R-                  X5      (       d   [        R.                  " X5        US4$ OhUS:X  ab  [        R                  R+                  U5      (       a$  [        R                  R-                  X5      (       d  [        R2                  " X5        US4$ [5        X5        U(       d  U(       a_  [        R                  " U 5      nU(       a  [        R6                  " XU
   X   45        U(       a  [        R8                  " X" X   5      5        US4$ ! [$         a    ['        SU S	35      ef = f! [0         a     Nf = f)a  Copy 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_IMODEST_ATIMEST_MODEST_MTIMEzcan't copy 'z&': doesn't exist or not a regular filer   z"not copying %s (output up-to-date)zinvalid value 'z' for 'link' argumentz%s %s -> %sr   r   )distutils._modifiedr!   statr"   r#   r$   r%   r   r   isfiler   isdirjoinbasenamedirnamer   debug_copy_actionKeyError
ValueErrorinfor   samefilelinkr   symlinkr   utimechmod)r   r   preserve_modepreserve_timesupdater3   verbosedry_runr!   r"   r#   r$   r%   diractionsts                   r   	copy_filer?   ?   sM   R *9977>># 3%EF
 	
 
ww}}Sggll3 0 0 56ggooc"eCooa<II:C@QxHd# !|77C BGG$4$4S$99HH]F5HH]F5Qx 
s##(8(8(B(B ! Qx )C 
s##(8(8(B(BJJs 8O !WWS\ HHSh<67HHS'"+./8OW  H?4&0EFGGH$   	s   ?	K K5 K25
LLc                 t   SSK nSSKJnJnJnJnJn	  US:  a  [        R                  " SX5        U(       a  U$ U	" U 5      (       d  [        SU  S35      eU" U5      (       a&  [        R                  R                  X" U 5      5      nOU" U5      (       a  [        SU  SU S	35      eU" U" U5      5      (       d  [        SU  SU S
35      eSn
 [        R                  " X5        U
(       a#  [#        XUS9   [        R$                  " U 5        U$ U$ ! [         a=  nUR                  u  pXR                   :X  a  Sn
 SnANZ[        SU  SU SU 35      eSnAff = f! [         aR  nUR                  u  p [        R$                  " U5        O! [         a     Of = f[        SU  SU SU  SU 35      eSnAff = f)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???
r   N)r+   r,   r   r)   r(   r   zmoving %s -> %szcan't move 'z': not a regular filez': destination 'z' already existsz' not a valid pathFTzcouldn't move 'z' to 'r   )r:   z' by copy/delete: delete 'z
' failed: )errnoos.pathr+   r,   r   r)   r(   r   r1   r   r   r   r*   renamer   argsEXDEVr?   r   )r   r   r:   r;   rA   r+   r,   r   r)   r(   copy_itr   nummsgs                 r   	move_filerI      s    @@!|"C-
#;; <u4I!JKKSzzggll3.	 3%/u4DE
 	
  3%/u4FG
 	
 GQ
		# #G,	IIcN J3J+  QVV
++G$se6#c#%OPPQ  		JS		# $!#fSE 2%z#0 		sZ   D 7E 
EE?EE
F7%F24F
F2
FF2FF22F7c                 ~    [        U SSS9 nUR                  S U 5       5        SSS5        g! , (       d  f       g= f)zsCreate a file with the specified name and write 'contents' (a
sequence of strings without line terminators) to it.
wzutf-8)encodingc              3   (   #    U H	  oS -   v   M     g7f)
N ).0lines     r   	<genexpr>write_file.<locals>.<genexpr>   s     6XTD[Xs   N)r   
writelines)filenamecontentsfs      r   
write_filerX      s0     
hg	.!	6X66 
/	.	.s   .
<)i @  )TTFNTF)TF)__doc__r   _logr   errorsr   r.   r   r?   rI   rX   rO       r   <module>r]      sP   
 
  &  @VW-f 	iZ8v7r\   