diff --git a/comfy-test.toml b/comfy-test.toml index 71977b3..80a7ee1 100644 --- a/comfy-test.toml +++ b/comfy-test.toml @@ -1,18 +1,9 @@ [test] -levels = ["syntax", "install", "registration", "instantiation", "execution"] +levels = ["syntax", "javascript", "install", "registration", "instantiation", "execution"] [test.workflows] cpu = ["!pano"] -gpu = "all" +cuda = "all" [test.platforms] -linux = true -macos = true -windows = true -windows_portable = true -linux_gpu = true -windows_gpu = true -windows_portable_gpu = true -macos_desktop = true -windows_desktop = true -windows_desktop_gpu = true +platforms = ["linux", "macos", "windows", "windows_portable", "macos_desktop", "windows_desktop", "linux_cuda", "windows_cuda", "windows_portable_cuda", "windows_desktop_cuda"] diff --git a/prestartup_script.py b/prestartup_script.py index 1b4f8db..82b7773 100644 --- a/prestartup_script.py +++ b/prestartup_script.py @@ -1,12 +1,47 @@ """ComfyUI-Sharp Prestartup Script.""" +import logging +import shutil from pathlib import Path -from comfy_env import setup_env, copy_files +import folder_paths +from comfy_env import setup_env + +log = logging.getLogger("sharp") setup_env() +# The CONFIGURED input directory, never the code-tree one. ComfyUI Desktop +# (--base-directory) and --input-directory both relocate it, and the load +# nodes only ever scan folder_paths.get_input_directory(). main.py runs +# apply_custom_paths() before prestartup scripts, so this is already resolved. +INPUT = Path(folder_paths.get_input_directory()) + + +def copy_files(src: Path, dst: Path, pattern: str = "*") -> int: + """Copy bundled assets into a directory. Returns files written. + + Seeds rather than syncs: an existing file is left alone, so a user's + edited demo asset survives every relaunch. Raises if `src` is missing -- + a typo'd asset directory is a packaging bug, and silence is how it stays + one. + """ + src, dst = Path(src), Path(dst) + if not src.is_dir(): + raise FileNotFoundError(f"asset directory not found: {src}") + written = 0 + for f in src.glob(pattern): + if not f.is_file(): + continue + target = dst / f.relative_to(src) + if target.exists(): + continue + target.parent.mkdir(parents=True, exist_ok=True) + shutil.copy2(f, target) + written += 1 + return written + + SCRIPT_DIR = Path(__file__).resolve().parent -COMFYUI_DIR = SCRIPT_DIR.parent.parent # Copy assets -copy_files(SCRIPT_DIR / "assets", COMFYUI_DIR / "input") +copy_files(SCRIPT_DIR / "assets", INPUT) diff --git a/pyproject.toml b/pyproject.toml index 154464b..1133cfa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,4 +11,5 @@ Repository = "https://github.com/PozzettiAndrea/ComfyUI-Sharp" [tool.comfy] PublisherId = "pznodes" DisplayName = "Sharp" +web = "javascript" Icon = "https://raw.githubusercontent.com/PozzettiAndrea/ComfyUI-Sharp/main/assets/icon.png" diff --git a/requirements.txt b/requirements.txt index 7cd753f..085622c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ comfy-env==0.3.89 -comfy-3d-viewers==0.2.44 -trimesh \ No newline at end of file +trimesh