0
     ‹      Õ•]oÓ0†ï÷+Œ/¸kO“u:Çh4•¨ÖµUW„B“;�µ$Ž§¡üzœ&¥eZaHLŒ+Ÿ¿çã9IlòÂŸ—Ÿæ#ô~y=Aóï&ã!Â€�§C é7ýnÏM1Â±1ù  ªªnuÚUzËÄ&MúP-CÓå†czBj=A$ŒÛ#M"è8ãâ+RUšBraã6p±–¡(jÛˆR‘*½i§ïB¦¸èA˜—DR§Óâ¶öAQM�¦€-	mM(¾©[qž²¬Í¾ÅcÁ¶zmjJLŒÖ,‘«ÌÃFå˜™®P¡CƒUV@�°ì®»’F,1þ<Î¾X˜¸Ž¦„¡X‹ÈÃo‡Þôbæù˜NY*°‡5×Vs‰é„¥ŠËH
~T|Óˆoä·ã	ýFã‹"Ô27Re{)XÄCÔP%EÎ,ë™%ˆõ¡ª‘ðßMƒ…?c~¹M—þxÑŒ„×)öÝý¥—ˆéÜÚ™A¾Ô"4VÞ6å^fA‘_ìQÛ¿–«Ø`ŠP=¨üèH%\èCìcÀ;DLwÖa§÷Zs{îyÇq:Îä¼ôÎzZ®…Þ2´Ösa(³»LUÙ!„ý¶qËJ›J«@ü Ù»�åº¨çÎ^Å²'îÕ?Àº‡ô¿â”bmkL›õéyB{GØ^Lš;ò;ócø'†    B   ˆl–Ðz¾”Šj"Tâ‚À½q¶”Å£�þBXÞYÆÊFãt2=+ÀþÇƒuçÆ_ŠI|¥�+Wé3ž¯ÅÄ ¸    """distutils.file_util

Utility functions for operating on single files.
"""

import os

from ._log import log
from .errors import DistutilsFileError

# for generating verbose output in 'copy_file()'
_copy_action = {None: 'copying', 'hard': 'hard linking', 'sym': 'symbolically linking'}


def _copy_file_contents(src, dst, buffer_size=16 * 1024):  # noqa: C901
    """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.
    """
    # Stolen from shutil module in the standard library, but with
    # custom error-handling added.
    fsrc = None
    fdst = None
    try:
        try:
            fsrc = open(src, 'rb')  # noqa: SIM115 # closed in the finally below
        except OSError as e:
            raise DistutilsFileError(f"could not open '{src}': {e.strerror}")

        if os.path.exists(dst):
            try:
                os.unlink(dst)
            except OSError as e:
                raise DistutilsFileError(f"could not delete '{dst}': {e.strerror}")

        try:
            fdst = open(dst, 'wb')  # noqa: SIM115 # closed in the finally below
        except OSError as e:
            raise DistutilsFileError(f"could not create '{dst}': {e.strerror}")

        while True:
            try:
                buf = fsrc.read(buffer_size)
            except OSError as e:
                raise DistutilsFileError(f"could not read from '{src}': {e.strerror}")

            if not buf:
                break

            try:
                fdst.write(buf)
            except OSError as e:
                raise DistutilsFileError(f"could not write to '{dst}': {e.strerror}")
    finally:
        if fdst:
            fdst.close()
        if fsrc:
            fsrc.close()


def copy_file(  # noqa: C901
    src,
    dst,
    preserve_mode=True,
    preserve_times=True,
    update=False,
    link=None,
    verbose=True,
):
    """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.
    """
    # XXX if the destination file already exists, we clobber it if
    # copying, but blow up if linkin