Browse Source

Add forceRecreate option for BaseGitPackage.SetupVenv

pull/109/head
Ionite 1 year ago
parent
commit
6524a58c1a
No known key found for this signature in database
  1. 14
      StabilityMatrix.Core/Models/Packages/BaseGitPackage.cs

14
StabilityMatrix.Core/Models/Packages/BaseGitPackage.cs

@ -105,13 +105,13 @@ public abstract class BaseGitPackage : BasePackage
/// <summary>
/// Setup the virtual environment for the package.
/// </summary>
/// <param name="installedPackagePath"></param>
/// <param name="venvName"></param>
/// <returns></returns>
[MemberNotNull(nameof(VenvRunner))]
protected async Task<PyVenvRunner> SetupVenv(string installedPackagePath, string venvName = "venv")
public async Task<PyVenvRunner> SetupVenv(
string installedPackagePath,
string venvName = "venv",
bool forceRecreate = false)
{
var venvPath = Path.Combine(installedPackagePath, "venv");
var venvPath = Path.Combine(installedPackagePath, venvName);
if (VenvRunner != null)
{
await VenvRunner.DisposeAsync().ConfigureAwait(false);
@ -123,9 +123,9 @@ public abstract class BaseGitPackage : BasePackage
EnvironmentVariables = SettingsManager.Settings.EnvironmentVariables,
};
if (!VenvRunner.Exists())
if (!VenvRunner.Exists() || forceRecreate)
{
await VenvRunner.Setup().ConfigureAwait(false);
await VenvRunner.Setup(forceRecreate).ConfigureAwait(false);
}
return VenvRunner;
}

Loading…
Cancel
Save