Skip to content

Commit

Permalink
[Refactor] Rename for clarity (#882)
Browse files Browse the repository at this point in the history
Standardises use of basePath in VirtualEnvironment - renames from venvRootPath to the same basePath used elsewhere.
  • Loading branch information
webfiltered authored Feb 9, 2025
1 parent 5a5938f commit 4b1ad49
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/services/cmCli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class CmCli implements HasTelemetry {
},
},
{
COMFYUI_PATH: this.virtualEnvironment.venvRootPath,
COMFYUI_PATH: this.virtualEnvironment.basePath,
...env,
},
cwd
Expand Down
14 changes: 7 additions & 7 deletions src/virtualEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function fixDeviceMirrorMismatch(device: TorchDeviceType, mirror: string | undef
* @todo Split either installation or terminal management to a separate class.
*/
export class VirtualEnvironment implements HasTelemetry {
readonly venvRootPath: string;
readonly basePath: string;
readonly venvPath: string;
readonly pythonVersion: string;
readonly uvPath: string;
Expand Down Expand Up @@ -124,15 +124,15 @@ export class VirtualEnvironment implements HasTelemetry {
handleFlowControl: false,
conptyInheritCursor: false,
name: 'xterm',
cwd: this.venvRootPath,
cwd: this.basePath,
env,
});
}
return this.uvPty;
}

constructor(
venvPath: string,
basePath: string,
{
telemetry,
selectedDevice,
Expand All @@ -149,7 +149,7 @@ export class VirtualEnvironment implements HasTelemetry {
torchMirror?: string;
}
) {
this.venvRootPath = venvPath;
this.basePath = basePath;
this.telemetry = telemetry;
this.pythonVersion = pythonVersion ?? '3.12';
this.selectedDevice = selectedDevice ?? 'cpu';
Expand All @@ -158,7 +158,7 @@ export class VirtualEnvironment implements HasTelemetry {
this.torchMirror = fixDeviceMirrorMismatch(selectedDevice!, torchMirror);

// uv defaults to .venv
this.venvPath = path.join(venvPath, '.venv');
this.venvPath = path.join(basePath, '.venv');
const resourcesPath = app.isPackaged ? path.join(process.resourcesPath) : path.join(app.getAppPath(), 'assets');
this.comfyUIRequirementsPath = path.join(resourcesPath, 'ComfyUI', 'requirements.txt');
this.comfyUIManagerRequirementsPath = path.join(
Expand All @@ -169,7 +169,7 @@ export class VirtualEnvironment implements HasTelemetry {
'requirements.txt'
);

this.cacheDir = path.join(venvPath, 'uv-cache');
this.cacheDir = path.join(basePath, 'uv-cache');

const filename = `${compiledRequirements()}.compiled`;
this.requirementsCompiledPath = path.join(resourcesPath, 'requirements', filename);
Expand Down Expand Up @@ -413,7 +413,7 @@ export class VirtualEnvironment implements HasTelemetry {
args: string[],
env: Record<string, string>,
callbacks?: ProcessCallbacks,
cwd: string = this.venvRootPath
cwd: string = this.basePath
): ChildProcess {
log.info(`Running command: ${command} ${args.join(' ')} in ${cwd}`);
const childProcess = spawn(command, args, {
Expand Down

0 comments on commit 4b1ad49

Please sign in to comment.