Skip to content

Commit

Permalink
Fixed: Running pip commands on Windows (#168)
Browse files Browse the repository at this point in the history
Moved logic into __init__
  • Loading branch information
robinjhuang committed Aug 29, 2024
1 parent 0f84130 commit b92d983
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions comfy_cli/standalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,17 @@ def FromTarball(fpath: PathLike, name: PathLike = "python") -> "StandalonePython

shutil.move(old_rpath, rpath)

if os_platform.system() == "Windows":
return StandlonePythonWindows(rpath=rpath)
return StandalonePythonUnix(rpath=rpath)
return StandalonePython(rpath=rpath)

def __init__(self, rpath: PathLike):
self.rpath = Path(rpath)
self.name = self.rpath.name
self.bin = self.rpath / "bin"
self.executable = self.bin / "python"
if os_platform.system() == "Windows":
self.bin = self.rpath
self.executable = self.bin / "python.exe"
else:
self.bin = self.rpath / "bin"
self.executable = self.bin / "python"

# paths to store package artifacts
self.cache = self.rpath / "cache"
Expand Down Expand Up @@ -213,19 +215,3 @@ def _filter(tinfo: tarfile.TarInfo):
if progress:
barProg.advance(addTar, _size)
pathProg.update(pathTar, description="")


class StandalonePythonUnix(StandalonePython):
def get_bin_path(self) -> Path:
return self.rpath / "bin"

def get_executable_path(self) -> Path:
return self.bin / "python"


class StandlonePythonWindows(StandalonePython):
def get_bin_path(self) -> Path:
return self.rpath

def get_executable_path(self) -> Path:
return self.bin / "python.exe"

0 comments on commit b92d983

Please sign in to comment.