Skip to content

Commit

Permalink
clean all __pycache__ from standalone python before making tarball
Browse files Browse the repository at this point in the history
  • Loading branch information
telamonian committed Aug 27, 2024
1 parent 0348aa4 commit bb81569
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions comfy_cli/standalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ def __init__(self, rpath: PathLike):
# upgrade pip if needed, install uv
self.pip_install("-U", "pip", "uv")

def clean(self):
for pycache in self.rpath.glob("**/__pycache__"):
shutil.rmtree(pycache)

def run_module(self, mod: str, *args: list[str]):
cmd: list[str] = [
str(self.executable),
Expand Down Expand Up @@ -172,6 +176,10 @@ def rehydrate_comfy_deps(self):
def to_tarball(self, outPath: Optional[PathLike] = None, progress: bool = True):
outPath = self.rpath.with_suffix(".tgz") if outPath is None else Path(outPath)

# do a little clean up prep
outPath.unlink(missing_ok=True)
self.clean()

if progress:
fileSize = sum(f.stat().st_size for f in self.rpath.glob("**/*"))

Expand Down

0 comments on commit bb81569

Please sign in to comment.