Browse Source

Merge pull request #91 from LykosAI/main

pull/103/head v2.3.3
Ionite 1 year ago committed by GitHub
parent
commit
14743dbf39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      CHANGELOG.md
  2. 9
      StabilityMatrix.Avalonia/Assets.cs
  3. BIN
      StabilityMatrix.Avalonia/Assets/macos-arm64/7zz
  4. 88
      StabilityMatrix.Avalonia/Assets/macos-arm64/7zz - LICENSE.txt
  5. 4
      StabilityMatrix.Avalonia/DesignData/DesignData.cs
  6. 4
      StabilityMatrix.Avalonia/Helpers/UnixPrerequisiteHelper.cs
  7. 4
      StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj
  8. 15
      StabilityMatrix.Avalonia/ViewModels/CheckpointManager/CheckpointFile.cs
  9. 37
      StabilityMatrix.Avalonia/Views/PackageManagerPage.axaml
  10. 6
      StabilityMatrix.Core/Helper/ArchiveHelper.cs
  11. 2
      StabilityMatrix.Core/Helper/Compat.cs
  12. 14
      StabilityMatrix.Core/Helper/HardwareHelper.cs
  13. 15
      StabilityMatrix.Core/Models/Packages/A3WebUI.cs
  14. 5
      StabilityMatrix.Core/Models/Packages/ComfyUI.cs
  15. 2
      StabilityMatrix.Core/Models/Packages/Fooocus.cs
  16. 6
      StabilityMatrix.Core/Models/Packages/InvokeAI.cs
  17. 4
      StabilityMatrix.Core/Models/Packages/VladAutomatic.cs
  18. 3
      StabilityMatrix.Core/Models/Packages/VoltaML.cs
  19. 15
      StabilityMatrix.Core/Python/PyRunner.cs
  20. 4
      StabilityMatrix.Core/Services/SettingsManager.cs

9
CHANGELOG.md

@ -5,6 +5,15 @@ All notable changes to Stability Matrix will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html).
## v2.3.3
### Fixed
- Fixed GPU recognition for Nvidia Tesla GPUs
- Fixed checkpoint file index extension identification with some path names
- Fixed issue where config file may be overwritten during Automatic1111 package updates
- Fixed "Directory Not Found" error on startup when previously selected Data directory does not exist
- Fixed [#83](https://github.com/LykosAI/StabilityMatrix/issues/83) - Display of packages with long names in the Package Manager
- Fixed [#64](https://github.com/LykosAI/StabilityMatrix/issues/64) - Package install error if venv already exists
## v2.3.2
### Added
- Added warning for exFAT / FAT32 drives when selecting a data directory

9
StabilityMatrix.Avalonia/Assets.cs

@ -27,17 +27,22 @@ internal static class Assets
[SupportedOSPlatform("windows")]
[SupportedOSPlatform("linux")]
[SupportedOSPlatform("macos")]
public static AvaloniaResource SevenZipExecutable => Compat.Switch(
(PlatformKind.Windows,
new AvaloniaResource("avares://StabilityMatrix.Avalonia/Assets/win-x64/7za.exe")),
(PlatformKind.Linux | PlatformKind.X64,
new AvaloniaResource("avares://StabilityMatrix.Avalonia/Assets/linux-x64/7zzs", (UnixFileMode) 0x777)));
new AvaloniaResource("avares://StabilityMatrix.Avalonia/Assets/linux-x64/7zzs", (UnixFileMode) 0777)),
(PlatformKind.MacOS | PlatformKind.Arm,
new AvaloniaResource("avares://StabilityMatrix.Avalonia/Assets/macos-arm64/7zz", (UnixFileMode) 0x777)));
[SupportedOSPlatform("windows")]
[SupportedOSPlatform("linux")]
[SupportedOSPlatform("macos")]
public static AvaloniaResource SevenZipLicense => Compat.Switch(
(PlatformKind.Windows, new AvaloniaResource("avares://StabilityMatrix.Avalonia/Assets/win-x64/7za - LICENSE.txt")),
(PlatformKind.Linux | PlatformKind.X64, new AvaloniaResource("avares://StabilityMatrix.Avalonia/Assets/linux-x64/7zzs - LICENSE.txt")));
(PlatformKind.Linux | PlatformKind.X64, new AvaloniaResource("avares://StabilityMatrix.Avalonia/Assets/linux-x64/7zzs - LICENSE.txt")),
(PlatformKind.MacOS | PlatformKind.Arm, new AvaloniaResource("avares://StabilityMatrix.Avalonia/Assets/macos-arm64/7zz - LICENSE.txt")));
public static AvaloniaResource PyScriptSiteCustomize => new(
"avares://StabilityMatrix.Avalonia/Assets/sitecustomize.py");

BIN
StabilityMatrix.Avalonia/Assets/macos-arm64/7zz

Binary file not shown.

88
StabilityMatrix.Avalonia/Assets/macos-arm64/7zz - LICENSE.txt

@ -0,0 +1,88 @@
7-Zip
~~~~~
License for use and distribution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7-Zip Copyright (C) 1999-2023 Igor Pavlov.
The licenses for 7zz and 7zzs files are:
- The "GNU LGPL" as main license for most of the code
- The "GNU LGPL" with "unRAR license restriction" for some code
- The "BSD 3-clause License" for some code
Redistributions in binary form must reproduce related license information from this file.
Note:
You can use 7-Zip on any computer, including a computer in a commercial
organization. You don't need to register or pay for 7-Zip.
GNU LGPL information
--------------------
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You can receive a copy of the GNU Lesser General Public License from
http://www.gnu.org/
BSD 3-clause License
--------------------
The "BSD 3-clause License" is used for the code in 7z.dll that implements LZFSE data decompression.
That code was derived from the code in the "LZFSE compression library" developed by Apple Inc,
that also uses the "BSD 3-clause License":
----
Copyright (c) 2015-2016, Apple Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----
unRAR license restriction
-------------------------
The decompression engine for RAR archives was developed using source
code of unRAR program.
All copyrights to original unRAR code are owned by Alexander Roshal.
The license for original unRAR code has the following restriction:
The unRAR sources cannot be used to re-create the RAR compression algorithm,
which is proprietary. Distribution of modified unRAR sources in separate form
or as a part of other software is permitted, provided that it is clearly
stated in the documentation and source comments that the code may
not be used to develop a RAR (WinRAR) compatible archiver.
--
Igor Pavlov

4
StabilityMatrix.Avalonia/DesignData/DesignData.cs

@ -63,7 +63,7 @@ public static class DesignData
new()
{
Id = Guid.NewGuid(),
DisplayName = "Dank Diffusion",
DisplayName = "Comfy Diffusion WebUI Dev Branch Long Name",
PackageName = "ComfyUI",
DisplayVersion = "main@ab73d4a",
LibraryPath = $"Packages{Path.DirectorySeparatorChar}example-webui",
@ -297,7 +297,7 @@ public static class DesignData
vm.SetPackages(settings.Settings.InstalledPackages);
vm.SetUnknownPackages(new InstalledPackage[]
{
UnknownInstalledPackage.FromDirectoryName("sd-unknown"),
UnknownInstalledPackage.FromDirectoryName("sd-unknown-with-long-name"),
});
vm.PackageCards[0].IsUpdateAvailable = true;

4
StabilityMatrix.Avalonia/Helpers/UnixPrerequisiteHelper.cs

@ -173,8 +173,8 @@ public class UnixPrerequisiteHelper : IPrerequisiteHelper
progress?.Report(new ProgressReport(0, "Installing Python", isIndeterminate: true));
await ArchiveHelper.Extract7ZAuto(downloadPath, PythonDir);
// For Linux, move the inner 'python' folder up to the root PythonDir
if (Compat.IsLinux)
// For Unix, move the inner 'python' folder up to the root PythonDir
if (Compat.IsUnix)
{
var innerPythonDir = PythonDir.JoinDir("python");
if (!innerPythonDir.Exists)

4
StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj

@ -8,7 +8,7 @@
<ApplicationManifest>app.manifest</ApplicationManifest>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
<ApplicationIcon>./Assets/Icon.ico</ApplicationIcon>
<Version>2.3.2-dev.1</Version>
<Version>2.3.3-dev.1</Version>
<InformationalVersion>$(Version)</InformationalVersion>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
</PropertyGroup>
@ -77,6 +77,8 @@
<AvaloniaResource Include="Assets\win-x64\**" Condition="'$(RuntimeIdentifier)' == 'win-x64'" />
<!-- Only for linux-64 -->
<AvaloniaResource Include="Assets\linux-x64\**" Condition="'$(RuntimeIdentifier)' == 'linux-x64'" />
<!-- Only for osx-arm64 -->
<AvaloniaResource Include="Assets\macos-arm64\**" Condition="'$(RuntimeIdentifier)' == 'osx-arm64'" />
</ItemGroup>
<ItemGroup>

15
StabilityMatrix.Avalonia/ViewModels/CheckpointManager/CheckpointFile.cs

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
@ -49,11 +48,11 @@ public partial class CheckpointFile : ViewModelBase
[ObservableProperty] private bool isLoading;
[ObservableProperty] private CivitModelType modelType;
public string FileName => Path.GetFileName((string?) FilePath);
public string FileName => Path.GetFileName(FilePath);
public ObservableCollection<string> Badges { get; set; } = new();
private static readonly string[] SupportedCheckpointExtensions = { ".safetensors", ".pt", ".ckpt", ".pth", "bin" };
private static readonly string[] SupportedCheckpointExtensions = { ".safetensors", ".pt", ".ckpt", ".pth", ".bin" };
private static readonly string[] SupportedImageExtensions = { ".png", ".jpg", ".jpeg" };
private static readonly string[] SupportedMetadataExtensions = { ".json" };
@ -200,7 +199,8 @@ public partial class CheckpointFile : ViewModelBase
{
foreach (var file in Directory.EnumerateFiles(directory, "*.*", searchOption))
{
if (!SupportedCheckpointExtensions.Any(ext => file.Contains(ext)))
if (!SupportedCheckpointExtensions.Any(ext =>
Path.GetExtension(file).Equals(ext, StringComparison.InvariantCultureIgnoreCase)))
continue;
var checkpointFile = new CheckpointFile
@ -230,7 +230,8 @@ public partial class CheckpointFile : ViewModelBase
{
foreach (var file in Directory.EnumerateFiles(modelsDirectory, "*.*", SearchOption.AllDirectories))
{
if (!SupportedCheckpointExtensions.Any(ext => file.Contains(ext)))
if (!SupportedCheckpointExtensions.Any(ext =>
Path.GetExtension(file).Equals(ext, StringComparison.InvariantCultureIgnoreCase)))
continue;
var checkpointFile = new CheckpointFile
@ -239,7 +240,7 @@ public partial class CheckpointFile : ViewModelBase
FilePath = file,
};
var jsonPath = Path.Combine(Path.GetDirectoryName(file),
var jsonPath = Path.Combine(Path.GetDirectoryName(file) ?? "",
Path.GetFileNameWithoutExtension(file) + ".cm-info.json");
if (File.Exists(jsonPath))
@ -251,7 +252,7 @@ public partial class CheckpointFile : ViewModelBase
}
checkpointFile.PreviewImagePath = SupportedImageExtensions
.Select(ext => Path.Combine(Path.GetDirectoryName(file),
.Select(ext => Path.Combine(Path.GetDirectoryName(file) ?? "",
$"{Path.GetFileNameWithoutExtension(file)}.preview{ext}")).Where(File.Exists)
.FirstOrDefault();

37
StabilityMatrix.Avalonia/Views/PackageManagerPage.axaml

@ -32,18 +32,23 @@
<DataTemplate DataType="{x:Type packageManager:PackageCardViewModel}">
<controls:Card Padding="8">
<Grid RowDefinitions="Auto, Auto, Auto, Auto"
ColumnDefinitions="Auto">
ColumnDefinitions="*,Auto">
<TextBlock Grid.Row="0"
Grid.Column="0"
ToolTip.Tip="{Binding Package.DisplayName, FallbackValue=''}"
Text="{Binding Package.DisplayName, FallbackValue=''}"
TextTrimming="WordEllipsis"
TextAlignment="Left" />
<Button
Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="1"
HorizontalContentAlignment="Right"
HorizontalAlignment="Right"
Margin="8,-8,0,4"
VerticalContentAlignment="Top"
VerticalAlignment="Top"
Padding="4,1"
Margin="4,0,0,0"
Classes="transparent"
Width="24"
BorderThickness="0">
@ -76,6 +81,7 @@
<TextBlock Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="2,0,0,0"
VerticalAlignment="Center"
Text="{Binding InstalledVersion}" />
@ -84,6 +90,7 @@
<controls:BetterAdvancedImage
Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="0,8,0,8"
Height="160"
Width="200"
@ -99,6 +106,7 @@
<Border
Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="0,8,0,8"
Height="160"
Width="200"
@ -115,9 +123,12 @@
</Border>
<Grid Grid.Row="3" Grid.Column="0"
IsVisible="{Binding IsUpdateAvailable}"
ColumnDefinitions="*, *">
<Grid
Grid.Row="3"
Grid.Column="0"
Grid.ColumnSpan="2"
IsVisible="{Binding IsUpdateAvailable}"
ColumnDefinitions="*, *">
<!-- Launch and update buttons -->
<Button Grid.Column="0" Classes="accent"
VerticalAlignment="Bottom"
@ -144,10 +155,14 @@
</Grid>
<!-- Big launch button -->
<Button Grid.Row="3" Grid.Column="0" Classes="accent"
VerticalAlignment="Bottom"
Command="{Binding Launch}"
HorizontalAlignment="Stretch">
<Button
Grid.Row="3"
Grid.Column="0"
Grid.ColumnSpan="2"
Classes="accent"
VerticalAlignment="Bottom"
Command="{Binding Launch}"
HorizontalAlignment="Stretch">
<Button.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="!IsUpdateAvailable" />
@ -164,6 +179,7 @@
<!-- Import button (for unknown) -->
<Button Grid.Row="3" Grid.Column="0" Classes="transparent-info"
Grid.ColumnSpan="2"
VerticalAlignment="Bottom"
HorizontalAlignment="Stretch"
Command="{Binding Import}"
@ -180,6 +196,7 @@
<Border
Grid.Row="0" Grid.RowSpan="4"
Grid.Column="0"
Grid.ColumnSpan="2"
Background="#DD000000"
CornerRadius="4"
HorizontalAlignment="Stretch"

6
StabilityMatrix.Core/Helper/ArchiveHelper.cs

@ -31,10 +31,14 @@ public static partial class ArchiveHelper
{
return "7za.exe";
}
if (Compat.Platform.HasFlag(PlatformKind.Linux))
if (Compat.IsLinux)
{
return "7zzs";
}
if (Compat.IsMacOS)
{
return "7zz";
}
throw new PlatformNotSupportedException("7z is not supported on this platform.");
}
}

2
StabilityMatrix.Core/Helper/Compat.cs

@ -114,7 +114,7 @@ public static class Compat
throw new PlatformNotSupportedException();
}
if (RuntimeInformation.ProcessArchitecture == Architecture.Arm)
if (RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
{
Platform |= PlatformKind.Arm;
}

14
StabilityMatrix.Core/Helper/HardwareHelper.cs

@ -155,6 +155,18 @@ public record GpuInfo
_ => Level.High
};
public bool IsNvidia => Name?.ToLowerInvariant().Contains("nvidia") ?? false;
public bool IsNvidia
{
get
{
var name = Name?.ToLowerInvariant();
if (string.IsNullOrEmpty(name)) return false;
return name.Contains("nvidia")
|| name.Contains("tesla");
}
}
public bool IsAmd => Name?.ToLowerInvariant().Contains("amd") ?? false;
}

15
StabilityMatrix.Core/Models/Packages/A3WebUI.cs

@ -4,7 +4,6 @@ using System.Text.RegularExpressions;
using NLog;
using StabilityMatrix.Core.Helper;
using StabilityMatrix.Core.Helper.Cache;
using StabilityMatrix.Core.Models.FileInterfaces;
using StabilityMatrix.Core.Models.Progress;
using StabilityMatrix.Core.Processes;
using StabilityMatrix.Core.Python;
@ -136,10 +135,7 @@ public class A3WebUI : BaseGitPackage
// Setup venv
await using var venvRunner = new PyVenvRunner(Path.Combine(InstallLocation, "venv"));
venvRunner.WorkingDirectory = InstallLocation;
if (!venvRunner.Exists())
{
await venvRunner.Setup().ConfigureAwait(false);
}
await venvRunner.Setup(true).ConfigureAwait(false);
// Install torch / xformers based on gpu info
var gpus = HardwareHelper.IterGpuInfo().ToList();
@ -179,10 +175,15 @@ public class A3WebUI : BaseGitPackage
progress?.Report(new ProgressReport(1f, "Installing Package Requirements", isIndeterminate: false));
progress?.Report(new ProgressReport(-1f, "Updating configuration", isIndeterminate: true));
// Create and add {"show_progress_type": "TAESD"} to config.json
// Only add if the file doesn't exist
var configPath = Path.Combine(InstallLocation, "config.json");
var config = new JsonObject {{"show_progress_type", "TAESD"}};
await File.WriteAllTextAsync(configPath, config.ToString()).ConfigureAwait(false);
if (!File.Exists(configPath))
{
var config = new JsonObject {{"show_progress_type", "TAESD"}};
await File.WriteAllTextAsync(configPath, config.ToString()).ConfigureAwait(false);
}
progress?.Report(new ProgressReport(1f, "Install complete", isIndeterminate: false));
}

5
StabilityMatrix.Core/Models/Packages/ComfyUI.cs

@ -108,10 +108,7 @@ public class ComfyUI : BaseGitPackage
// Setup venv
await using var venvRunner = new PyVenvRunner(Path.Combine(InstallLocation, "venv"));
venvRunner.WorkingDirectory = InstallLocation;
if (!venvRunner.Exists())
{
await venvRunner.Setup().ConfigureAwait(false);
}
await venvRunner.Setup(true).ConfigureAwait(false);
// Install torch / xformers based on gpu info
var gpus = HardwareHelper.IterGpuInfo().ToList();

2
StabilityMatrix.Core/Models/Packages/Fooocus.cs

@ -59,7 +59,7 @@ public class Fooocus : BaseGitPackage
public override async Task InstallPackage(IProgress<ProgressReport>? progress = null)
{
await base.InstallPackage(progress).ConfigureAwait(false);
var venvRunner = await SetupVenv(InstallLocation).ConfigureAwait(false);
var venvRunner = await SetupVenv(InstallLocation, forceRecreate: true).ConfigureAwait(false);
progress?.Report(new ProgressReport(-1f, "Installing torch...", isIndeterminate: true));

6
StabilityMatrix.Core/Models/Packages/InvokeAI.cs

@ -1,10 +1,8 @@
using System.Text.Json;
using System.Text.RegularExpressions;
using System.Text.RegularExpressions;
using NLog;
using StabilityMatrix.Core.Extensions;
using StabilityMatrix.Core.Helper;
using StabilityMatrix.Core.Helper.Cache;
using StabilityMatrix.Core.Models.Api;
using StabilityMatrix.Core.Models.FileInterfaces;
using StabilityMatrix.Core.Models.Progress;
using StabilityMatrix.Core.Processes;
@ -129,7 +127,7 @@ public class InvokeAI : BaseGitPackage
await using var venvRunner = new PyVenvRunner(Path.Combine(InstallLocation, "venv"));
venvRunner.WorkingDirectory = InstallLocation;
await venvRunner.Setup().ConfigureAwait(false);
await venvRunner.Setup(true).ConfigureAwait(false);
venvRunner.EnvironmentVariables = GetEnvVars(InstallLocation);

4
StabilityMatrix.Core/Models/Packages/VladAutomatic.cs

@ -1,7 +1,5 @@
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.RegularExpressions;
using NLog;
using StabilityMatrix.Core.Helper;
@ -158,7 +156,7 @@ public class VladAutomatic : BaseGitPackage
venvRunner.WorkingDirectory = InstallLocation;
venvRunner.EnvironmentVariables = SettingsManager.Settings.EnvironmentVariables;
await venvRunner.Setup().ConfigureAwait(false);
await venvRunner.Setup(true).ConfigureAwait(false);
// Run initial install
if (HardwareHelper.HasNvidiaGpu())

3
StabilityMatrix.Core/Models/Packages/VoltaML.cs

@ -1,7 +1,6 @@
using System.Text.RegularExpressions;
using StabilityMatrix.Core.Helper;
using StabilityMatrix.Core.Helper.Cache;
using StabilityMatrix.Core.Models.FileInterfaces;
using StabilityMatrix.Core.Models.Progress;
using StabilityMatrix.Core.Processes;
using StabilityMatrix.Core.Python;
@ -133,7 +132,7 @@ public class VoltaML : BaseGitPackage
await using var venvRunner = new PyVenvRunner(Path.Combine(InstallLocation, "venv"));
venvRunner.WorkingDirectory = InstallLocation;
await venvRunner.Setup().ConfigureAwait(false);
await venvRunner.Setup(true).ConfigureAwait(false);
// Install requirements
progress?.Report(new ProgressReport(-1, "Installing Package Requirements", isIndeterminate: true));

15
StabilityMatrix.Core/Python/PyRunner.cs

@ -31,17 +31,18 @@ public class PyRunner : IPyRunner
/// </summary>
public static string RelativePythonDllPath => Compat.Switch(
(PlatformKind.Windows, "python310.dll"),
(PlatformKind.Linux, Path.Combine("lib", "libpython3.10.so")));
public static string PythonDllPath => Compat.Switch(
(PlatformKind.Windows, Path.Combine(PythonDir, "python310.dll")),
(PlatformKind.Linux, Path.Combine(PythonDir, "lib", "libpython3.10.so")));
(PlatformKind.Linux, Path.Combine("lib", "libpython3.10.so")),
(PlatformKind.MacOS, Path.Combine("lib", "libpython3.10.dylib")));
public static string PythonDllPath => Path.Combine(PythonDir, RelativePythonDllPath);
public static string PythonExePath => Compat.Switch(
(PlatformKind.Windows, Path.Combine(PythonDir, "python.exe")),
(PlatformKind.Linux, Path.Combine(PythonDir, "bin", "python3")));
(PlatformKind.Linux, Path.Combine(PythonDir, "bin", "python3")),
(PlatformKind.MacOS, Path.Combine(PythonDir, "bin", "python3")));
public static string PipExePath => Compat.Switch(
(PlatformKind.Windows, Path.Combine(PythonDir, "Scripts", "pip.exe")),
(PlatformKind.Linux, Path.Combine(PythonDir, "bin", "pip3")));
(PlatformKind.Linux, Path.Combine(PythonDir, "bin", "pip3")),
(PlatformKind.MacOS, Path.Combine(PythonDir, "bin", "pip3")));
public static string GetPipPath => Path.Combine(PythonDir, "get-pip.pyc");

4
StabilityMatrix.Core/Services/SettingsManager.cs

@ -218,7 +218,9 @@ public class SettingsManager : ISettingsManager
{
var libraryJson = libraryJsonFile.ReadAllText();
var librarySettings = JsonSerializer.Deserialize<LibrarySettings>(libraryJson);
if (!string.IsNullOrWhiteSpace(librarySettings?.LibraryPath))
if (!string.IsNullOrWhiteSpace(librarySettings?.LibraryPath)
&& Directory.Exists(librarySettings?.LibraryPath))
{
LibraryDir = librarySettings.LibraryPath;
SetStaticLibraryPaths();

Loading…
Cancel
Save