Browse Source

Add default env vars, set SETUPTOOLS_USE_DISTUTILS=stdlib

pull/629/head
Ionite 7 months ago
parent
commit
4e42eee757
No known key found for this signature in database
  1. 4
      StabilityMatrix.Avalonia/ViewModels/Settings/MainSettingsViewModel.cs
  2. 13
      StabilityMatrix.Core/Models/Settings/Settings.cs

4
StabilityMatrix.Avalonia/ViewModels/Settings/MainSettingsViewModel.cs

@ -365,7 +365,7 @@ public partial class MainSettingsViewModel : PageViewModelBase
var viewModel = dialogFactory.Get<EnvVarsViewModel>(); var viewModel = dialogFactory.Get<EnvVarsViewModel>();
// Load current settings // Load current settings
var current = settingsManager.Settings.EnvironmentVariables ?? new Dictionary<string, string>(); var current = settingsManager.Settings.UserEnvironmentVariables ?? new Dictionary<string, string>();
viewModel.EnvVars = new ObservableCollection<EnvVarKeyPair>( viewModel.EnvVars = new ObservableCollection<EnvVarKeyPair>(
current.Select(kvp => new EnvVarKeyPair(kvp.Key, kvp.Value)) current.Select(kvp => new EnvVarKeyPair(kvp.Key, kvp.Value))
); );
@ -385,7 +385,7 @@ public partial class MainSettingsViewModel : PageViewModelBase
.EnvVars.Where(kvp => !string.IsNullOrWhiteSpace(kvp.Key)) .EnvVars.Where(kvp => !string.IsNullOrWhiteSpace(kvp.Key))
.GroupBy(kvp => kvp.Key, StringComparer.Ordinal) .GroupBy(kvp => kvp.Key, StringComparer.Ordinal)
.ToDictionary(g => g.Key, g => g.First().Value, StringComparer.Ordinal); .ToDictionary(g => g.Key, g => g.First().Value, StringComparer.Ordinal);
settingsManager.Transaction(s => s.EnvironmentVariables = newEnvVars); settingsManager.Transaction(s => s.UserEnvironmentVariables = newEnvVars);
} }
} }

13
StabilityMatrix.Core/Models/Settings/Settings.cs

@ -110,7 +110,18 @@ public class Settings
public bool IsDiscordRichPresenceEnabled { get; set; } public bool IsDiscordRichPresenceEnabled { get; set; }
public Dictionary<string, string>? EnvironmentVariables { get; set; } [JsonIgnore]
public Dictionary<string, string> DefaultEnvironmentVariables { get; } =
new() { ["SETUPTOOLS_USE_DISTUTILS"] = "stdlib" };
[JsonPropertyName("EnvironmentVariables")]
public Dictionary<string, string>? UserEnvironmentVariables { get; set; }
[JsonIgnore]
public IReadOnlyDictionary<string, string> EnvironmentVariables =>
DefaultEnvironmentVariables
.Concat(UserEnvironmentVariables ?? [])
.ToDictionary(x => x.Key, x => x.Value);
public HashSet<string>? InstalledModelHashes { get; set; } = new(); public HashSet<string>? InstalledModelHashes { get; set; } = new();

Loading…
Cancel
Save