Skip to content

Commit 69b68b1

Browse files
authored
Merge pull request LykosAI#389 from ionite34/merge-main-to-dev-0aaa095
2 parents 0fc9139 + 064710e commit 69b68b1

File tree

5 files changed

+68
-55
lines changed

5 files changed

+68
-55
lines changed

.github/workflows/release.yml

-2
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,6 @@ jobs:
209209
files: |
210210
StabilityMatrix-win-x64.zip
211211
StabilityMatrix-linux-x64.zip
212-
StabilityMatrix-win-x64/StabilityMatrix.exe
213-
StabilityMatrix-linux-x64/StabilityMatrix.AppImage
214212
fail_on_unmatched_files: true
215213
tag_name: v${{ github.event.inputs.version }}
216214
body: ${{ steps.release_notes.outputs.release_notes }}

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2
7676
## Changed
7777
- Model Browser page has been redesigned, featuring more information like rating and download counts
7878

79+
## v2.6.7
80+
### Fixed
81+
- Fixed prerequisite install not unpacking due to improperly formatted 7z argument (Caused the "python310._pth FileNotFoundException")
82+
- Fixed [#301](https://github.com/LykosAI/StabilityMatrix/issues/301) - Package updates failing silently because of a PortableGit error
83+
7984
## v2.6.6
8085
### Fixed
8186
- Fixed [#297](https://github.com/LykosAI/StabilityMatrix/issues/297) - Model browser LiteAsyncException occuring when fetching entries with unrecognized values from enum name changes

StabilityMatrix.Avalonia/ViewModels/Dialogs/UpdateViewModel.cs

+25-16
Original file line numberDiff line numberDiff line change
@@ -189,32 +189,41 @@ await updateHelper.DownloadUpdate(
189189

190190
App.Shutdown();
191191
}
192-
192+
193193
internal async Task<string> GetReleaseNotes(string changelogUrl)
194194
{
195195
using var client = httpClientFactory.CreateClient();
196-
var response = await client.GetAsync(changelogUrl);
197-
if (response.IsSuccessStatusCode)
198-
{
199-
var changelog = await response.Content.ReadAsStringAsync();
200196

201-
// Formatting for new changelog format
202-
// https://keepachangelog.com/en/1.1.0/
203-
if (changelogUrl.EndsWith(".md", StringComparison.OrdinalIgnoreCase))
197+
try
198+
{
199+
var response = await client.GetAsync(changelogUrl);
200+
if (response.IsSuccessStatusCode)
204201
{
205-
return FormatChangelog(
206-
changelog,
207-
Compat.AppVersion,
208-
settingsManager.Settings.PreferredUpdateChannel
209-
) ?? "## Unable to format release notes";
202+
var changelog = await response.Content.ReadAsStringAsync();
203+
204+
// Formatting for new changelog format
205+
// https://keepachangelog.com/en/1.1.0/
206+
if (changelogUrl.EndsWith(".md", StringComparison.OrdinalIgnoreCase))
207+
{
208+
return FormatChangelog(
209+
changelog,
210+
Compat.AppVersion,
211+
settingsManager.Settings.PreferredUpdateChannel
212+
) ?? "## Unable to format release notes";
213+
}
214+
215+
return changelog;
210216
}
211217

212-
return changelog;
218+
return "## Unable to load release notes";
213219
}
214-
else
220+
catch (HttpRequestException e)
215221
{
216-
return "## Unable to load release notes";
222+
return $"## Unable to fetch release notes ({e.StatusCode})\n\n[{changelogUrl}]({changelogUrl})";
217223
}
224+
catch (TaskCanceledException) { }
225+
226+
return $"## Unable to fetch release notes\n\n[{changelogUrl}]({changelogUrl})";
218227
}
219228

220229
/// <summary>

StabilityMatrix.Core/Helper/ArchiveHelper.cs

+37-36
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System.Diagnostics;
2-
using System.Diagnostics.CodeAnalysis;
1+
using System.Diagnostics.CodeAnalysis;
32
using System.Text;
43
using System.Text.RegularExpressions;
54
using NLog;
@@ -59,8 +58,8 @@ public static string SevenZipFileName
5958
public static async Task<ArchiveInfo> TestArchive(string archivePath)
6059
{
6160
var process = ProcessRunner.StartAnsiProcess(SevenZipPath, new[] { "t", archivePath });
62-
await process.WaitForExitAsync();
63-
var output = await process.StandardOutput.ReadToEndAsync();
61+
await process.WaitForExitAsync().ConfigureAwait(false);
62+
var output = await process.StandardOutput.ReadToEndAsync().ConfigureAwait(false);
6463
var matches = Regex7ZOutput().Matches(output);
6564
var size = ulong.Parse(matches[0].Value);
6665
var compressed = ulong.Parse(matches[1].Value);
@@ -86,11 +85,11 @@ public static async Task AddToArchive7Z(string archivePath, string sourceDirecto
8685

8786
public static async Task<ArchiveInfo> Extract7Z(string archivePath, string extractDirectory)
8887
{
88+
var args =
89+
$"x {ProcessRunner.Quote(archivePath)} -o{ProcessRunner.Quote(extractDirectory)} -y";
90+
8991
var result = await ProcessRunner
90-
.GetProcessResultAsync(
91-
SevenZipPath,
92-
new[] { "x", archivePath, "-o" + ProcessRunner.Quote(extractDirectory), "-y" }
93-
)
92+
.GetProcessResultAsync(SevenZipPath, args)
9493
.ConfigureAwait(false);
9594

9695
result.EnsureSuccessExitCode();
@@ -185,7 +184,7 @@ public static async Task<ArchiveInfo> Extract7ZTar(string archivePath, string ex
185184
throw new ArgumentException("Archive must be a zipped tar.");
186185
}
187186
// Extract the tar.gz to tar
188-
await Extract7Z(archivePath, extractDirectory);
187+
await Extract7Z(archivePath, extractDirectory).ConfigureAwait(false);
189188

190189
// Extract the tar
191190
var tarPath = Path.Combine(extractDirectory, Path.GetFileNameWithoutExtension(archivePath));
@@ -196,7 +195,7 @@ public static async Task<ArchiveInfo> Extract7ZTar(string archivePath, string ex
196195

197196
try
198197
{
199-
return await Extract7Z(tarPath, extractDirectory);
198+
return await Extract7Z(tarPath, extractDirectory).ConfigureAwait(false);
200199
}
201200
finally
202201
{
@@ -215,11 +214,11 @@ public static async Task<ArchiveInfo> Extract7ZAuto(string archivePath, string e
215214
{
216215
if (archivePath.EndsWith(".tar.gz"))
217216
{
218-
return await Extract7ZTar(archivePath, extractDirectory);
217+
return await Extract7ZTar(archivePath, extractDirectory).ConfigureAwait(false);
219218
}
220219
else
221220
{
222-
return await Extract7Z(archivePath, extractDirectory);
221+
return await Extract7Z(archivePath, extractDirectory).ConfigureAwait(false);
223222
}
224223
}
225224

@@ -241,7 +240,7 @@ public static async Task Extract(
241240
var count = 0ul;
242241

243242
// Get true size
244-
var (total, _) = await TestArchive(archivePath);
243+
var (total, _) = await TestArchive(archivePath).ConfigureAwait(false);
245244

246245
// If not available, use the size of the archive file
247246
if (total == 0)
@@ -266,32 +265,34 @@ public static async Task Extract(
266265
};
267266
}
268267

269-
await Task.Factory.StartNew(
270-
() =>
271-
{
272-
var extractOptions = new ExtractionOptions
268+
await Task.Factory
269+
.StartNew(
270+
() =>
273271
{
274-
Overwrite = true,
275-
ExtractFullPath = true,
276-
};
277-
using var stream = File.OpenRead(archivePath);
278-
using var archive = ReaderFactory.Open(stream);
272+
var extractOptions = new ExtractionOptions
273+
{
274+
Overwrite = true,
275+
ExtractFullPath = true,
276+
};
277+
using var stream = File.OpenRead(archivePath);
278+
using var archive = ReaderFactory.Open(stream);
279279

280-
// Start the progress reporting timer
281-
progressMonitor?.Start();
280+
// Start the progress reporting timer
281+
progressMonitor?.Start();
282282

283-
while (archive.MoveToNextEntry())
284-
{
285-
var entry = archive.Entry;
286-
if (!entry.IsDirectory)
283+
while (archive.MoveToNextEntry())
287284
{
288-
count += (ulong)entry.CompressedSize;
285+
var entry = archive.Entry;
286+
if (!entry.IsDirectory)
287+
{
288+
count += (ulong)entry.CompressedSize;
289+
}
290+
archive.WriteEntryToDirectory(outputDirectory, extractOptions);
289291
}
290-
archive.WriteEntryToDirectory(outputDirectory, extractOptions);
291-
}
292-
},
293-
TaskCreationOptions.LongRunning
294-
);
292+
},
293+
TaskCreationOptions.LongRunning
294+
)
295+
.ConfigureAwait(false);
295296

296297
progress?.Report(new ProgressReport(progress: 1, message: "Done extracting"));
297298
progressMonitor?.Stop();
@@ -305,7 +306,7 @@ await Task.Factory.StartNew(
305306
public static async Task ExtractManaged(string archivePath, string outputDirectory)
306307
{
307308
await using var stream = File.OpenRead(archivePath);
308-
await ExtractManaged(stream, outputDirectory);
309+
await ExtractManaged(stream, outputDirectory).ConfigureAwait(false);
309310
}
310311

311312
/// <summary>
@@ -381,7 +382,7 @@ public static async Task ExtractManaged(Stream stream, string outputDirectory)
381382
// Write file
382383
await using var entryStream = reader.OpenEntryStream();
383384
await using var fileStream = File.Create(outputPath);
384-
await entryStream.CopyToAsync(fileStream);
385+
await entryStream.CopyToAsync(fileStream).ConfigureAwait(false);
385386
}
386387
}
387388
}

StabilityMatrix.Core/Models/Packages/BaseGitPackage.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ public override async Task<InstalledPackageVersion> Update(
309309
new ProgressReport(-1f, "Initializing git repo", isIndeterminate: true)
310310
);
311311
await PrerequisiteHelper
312-
.RunGit(installedPackage.FullPath!, onConsoleOutput, "init")
312+
.RunGit("init", onConsoleOutput, installedPackage.FullPath)
313313
.ConfigureAwait(false);
314314
await PrerequisiteHelper
315315
.RunGit(

0 commit comments

Comments
 (0)