def extract_and_copy_pyyaml_files(version, filename, build_dir='build'):
    extracted = Path(tempfile.gettempdir(), 'pyyaml-for-robot')
    if extracted.is_dir():
        shutil.rmtree(str(extracted))
    print(f"Extracting '{filename}' to '{extracted}'.")
    with tarfile.open(filename) as t:
        t.extractall(extracted)
    source = Path(extracted, f'PyYAML-{version}', 'lib', 'yaml')
    target = Path(build_dir, 'Lib', 'yaml')
    shutil.copytree(str(source), str(target), ignore=shutil.ignore_patterns('*.pyc'))
def extract_and_copy_pyyaml_files(version, filename, build_dir='build'):
    extracted = Path(tempfile.gettempdir(), 'pyyaml-for-robot')
    if extracted.is_dir():
        shutil.rmtree(str(extracted))
    print(f"Extracting '{filename}' to '{extracted}'.")
    with tarfile.open(filename) as t:
        t.extractall(extracted)
    source = Path(extracted, f'PyYAML-{version}', 'lib', 'yaml')
    target = Path(build_dir, 'Lib', 'yaml')
    shutil.copytree(str(source), str(target), ignore=shutil.ignore_patterns('*.pyc'))