option to add MSVC redist DLL, closes #8

This commit is contained in:
Florian Förster 2025-06-26 08:41:15 +02:00
parent e9b259d4b9
commit a584b285c9
2 changed files with 7 additions and 3 deletions

View File

@ -1,10 +1,10 @@
from pathlib import Path from pathlib import Path
from typing import Final from typing import Final
LIB_ROOT_FOLDER: Final[Path] = Path(__file__) LIB_ROOT_FOLDER: Final[Path] = Path(__file__).parent
if not LIB_ROOT_FOLDER.exists(): if not LIB_ROOT_FOLDER.exists():
raise FileNotFoundError(f"Lib root folder not found under: >{LIB_ROOT_FOLDER}<") raise FileNotFoundError(f"Lib root folder not found under: >{LIB_ROOT_FOLDER}<")
MSVC_FOLDER: Final[Path] = LIB_ROOT_FOLDER / "msvc-redist" MSVC_FOLDER: Final[Path] = LIB_ROOT_FOLDER / "_files/msvc-redist"
if not MSVC_FOLDER.exists(): if not MSVC_FOLDER.exists():
raise FileNotFoundError(f"Folder for MSVC Redist files not found under: >{MSVC_FOLDER}<") raise FileNotFoundError(f"Folder for MSVC Redist files not found under: >{MSVC_FOLDER}<")

View File

@ -185,8 +185,12 @@ def add_msvc_redist() -> None:
dll_files = MSVC_FOLDER.glob("**/*.dll") dll_files = MSVC_FOLDER.glob("**/*.dll")
click.echo("Start copying files...")
for dll_src in dll_files: for dll_src in dll_files:
shutil.copy(dll_src, target_path) click.echo(f"Copy file >{dll_src.name}<")
shutil.copy2(dll_src, target_path)
click.echo("Copied files successfully.")
venv.add_command(create) venv.add_command(create)