mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-13 13:07:21 +00:00
Fixed the Pdfium install on a fresh clone without runtime/target (#1195)
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
1 parent
c9a376f742
commit
12f26445ba
5 files changed
+21
-9
No files matched your search
@@ -9,7 +9,7 @@ namespace Build.Commands;
|
|||||||
|
|
||||||
public static class Pdfium
|
public static class Pdfium
|
||||||
{
|
{
|
||||||
private const int MAX_DOWNLOAD_ATTEMPTS = 3;
|
private const int MAX_INSTALL_ATTEMPTS = 3;
|
||||||
|
|
||||||
private static readonly TimeSpan CONNECT_TIMEOUT = TimeSpan.FromSeconds(30);
|
private static readonly TimeSpan CONNECT_TIMEOUT = TimeSpan.FromSeconds(30);
|
||||||
private static readonly TimeSpan RESPONSE_TIMEOUT = TimeSpan.FromSeconds(60);
|
private static readonly TimeSpan RESPONSE_TIMEOUT = TimeSpan.FromSeconds(60);
|
||||||
@@ -77,7 +77,7 @@ public static class Pdfium
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var attempt = 1; attempt <= MAX_DOWNLOAD_ATTEMPTS; attempt++)
|
for (var attempt = 1; attempt <= MAX_INSTALL_ATTEMPTS; attempt++)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -88,7 +88,7 @@ public static class Pdfium
|
|||||||
catch (Exception exception) when (IsTransientFailure(exception))
|
catch (Exception exception) when (IsTransientFailure(exception))
|
||||||
{
|
{
|
||||||
Console.Write($" failed: {DescribeFailure(exception)}");
|
Console.Write($" failed: {DescribeFailure(exception)}");
|
||||||
if (attempt < MAX_DOWNLOAD_ATTEMPTS)
|
if (attempt < MAX_INSTALL_ATTEMPTS)
|
||||||
{
|
{
|
||||||
Console.Write($" Retrying in {RETRY_DELAY.TotalSeconds:0} seconds ...");
|
Console.Write($" Retrying in {RETRY_DELAY.TotalSeconds:0} seconds ...");
|
||||||
await Task.Delay(RETRY_DELAY);
|
await Task.Delay(RETRY_DELAY);
|
||||||
@@ -97,7 +97,7 @@ public static class Pdfium
|
|||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
Console.WriteLine($"- Error: Could not download Pdfium {version} for {rid.UserFriendlyName} from {pdfiumUrl} in {MAX_DOWNLOAD_ATTEMPTS} attempts.");
|
Console.WriteLine($"- Error: Could not install Pdfium {version} for {rid.UserFriendlyName} from {pdfiumUrl} in {MAX_INSTALL_ATTEMPTS} attempts.");
|
||||||
if (File.Exists(pdfiumLibTargetPath))
|
if (File.Exists(pdfiumLibTargetPath))
|
||||||
Console.WriteLine(" To build with the library which is already present, use --offline.");
|
Console.WriteLine(" To build with the library which is already present, use --offline.");
|
||||||
|
|
||||||
@@ -172,12 +172,14 @@ public static class Pdfium
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Deploy the library. The marker goes first, so that it never describes a library
|
// Deploy the library. The marker goes first, so that it never describes a library
|
||||||
// which was only half replaced:
|
// which was only half replaced. The directory of the marker does not exist before the
|
||||||
|
// first Rust build, which comes after this step on a fresh clone, and File.Delete
|
||||||
|
// throws when a directory is missing:
|
||||||
//
|
//
|
||||||
Console.Write(" deploying ...");
|
Console.Write(" deploying ...");
|
||||||
|
Directory.CreateDirectory(Path.GetDirectoryName(versionMarkerPath)!);
|
||||||
File.Delete(versionMarkerPath);
|
File.Delete(versionMarkerPath);
|
||||||
File.Move(pdfiumLibTmpTargetPath, pdfiumLibTargetPath, true);
|
File.Move(pdfiumLibTmpTargetPath, pdfiumLibTargetPath, true);
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(versionMarkerPath)!);
|
|
||||||
await File.WriteAllTextAsync(versionMarkerPath, versionMarker, Environment.UTF8_NO_BOM);
|
await File.WriteAllTextAsync(versionMarkerPath, versionMarker, Environment.UTF8_NO_BOM);
|
||||||
}
|
}
|
||||||
catch (OperationCanceledException) when (attemptTimeout.IsCancellationRequested)
|
catch (OperationCanceledException) when (attemptTimeout.IsCancellationRequested)
|
||||||
@@ -199,14 +201,14 @@ public static class Pdfium
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether another attempt may succeed where a download attempt failed with the given exception.
|
/// Whether another attempt may succeed where an attempt to install the library failed with the given exception.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="exception">The exception the attempt failed with.</param>
|
/// <param name="exception">The exception the attempt failed with.</param>
|
||||||
/// <returns>True, when the download is worth another attempt.</returns>
|
/// <returns>True, when the installation is worth another attempt.</returns>
|
||||||
private static bool IsTransientFailure(Exception exception) => exception is HttpRequestException or OperationCanceledException or TimeoutException or IOException or InvalidDataException;
|
private static bool IsTransientFailure(Exception exception) => exception is HttpRequestException or OperationCanceledException or TimeoutException or IOException or InvalidDataException;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Describes why a download attempt failed, in one line.
|
/// Describes why an attempt to install the library failed, in one line.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// The innermost exception names the actual cause, such as the socket error behind an HttpRequestException
|
/// The innermost exception names the actual cause, such as the socket error behind an HttpRequestException
|
||||||
|
|||||||
@@ -17410,6 +17410,9 @@ UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2640760894"] = "Become one of our
|
|||||||
-- Become one of our titans
|
-- Become one of our titans
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2640760894::INFORMAL"] = "Become one of our titans"
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2640760894::INFORMAL"] = "Become one of our titans"
|
||||||
|
|
||||||
|
-- Thank you, Carsten, for fixing the first build after a fresh clone of AI Studio.
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2698568606"] = "Thank you, Carsten, for fixing the first build after a fresh clone of AI Studio."
|
||||||
|
|
||||||
-- Supporters
|
-- Supporters
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2929332068"] = "Supporters"
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2929332068"] = "Supporters"
|
||||||
|
|
||||||
|
|||||||
@@ -101,6 +101,7 @@
|
|||||||
<Supporter Name="prodmanpd" Type="SupporterType.INDIVIDUAL" URL="https://github.com/prodmanpd" Acknowledgment="@T("Thank you, Prodman, for bringing LiteLLM to AI Studio as a new provider.")"/>
|
<Supporter Name="prodmanpd" Type="SupporterType.INDIVIDUAL" URL="https://github.com/prodmanpd" Acknowledgment="@T("Thank you, Prodman, for bringing LiteLLM to AI Studio as a new provider.")"/>
|
||||||
<Supporter Name="Thibaultjaigu" Type="SupporterType.INDIVIDUAL" URL="https://github.com/Thibaultjaigu" Acknowledgment="@T("Thanks, Thibault, for bringing Requesty to AI Studio as a new provider.")"/>
|
<Supporter Name="Thibaultjaigu" Type="SupporterType.INDIVIDUAL" URL="https://github.com/Thibaultjaigu" Acknowledgment="@T("Thanks, Thibault, for bringing Requesty to AI Studio as a new provider.")"/>
|
||||||
<Supporter Name="ericcurtin" Type="SupporterType.INDIVIDUAL" URL="https://github.com/ericcurtin" Acknowledgment="@T("Thanks, Eric, for bringing llmman to AI Studio as a new option for self-hosted models.")"/>
|
<Supporter Name="ericcurtin" Type="SupporterType.INDIVIDUAL" URL="https://github.com/ericcurtin" Acknowledgment="@T("Thanks, Eric, for bringing llmman to AI Studio as a new option for self-hosted models.")"/>
|
||||||
|
<Supporter Name="carstenbauer" Type="SupporterType.INDIVIDUAL" URL="https://github.com/carstenbauer" Acknowledgment="@T("Thank you, Carsten, for fixing the first build after a fresh clone of AI Studio.")"/>
|
||||||
</MudList>
|
</MudList>
|
||||||
</MudPaper>
|
</MudPaper>
|
||||||
</MudItem>
|
</MudItem>
|
||||||
|
|||||||
+3
@@ -17412,6 +17412,9 @@ UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2640760894"] = "Werden Sie einer
|
|||||||
-- Become one of our titans
|
-- Become one of our titans
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2640760894::INFORMAL"] = "Werde einer unserer Titanen"
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2640760894::INFORMAL"] = "Werde einer unserer Titanen"
|
||||||
|
|
||||||
|
-- Thank you, Carsten, for fixing the first build after a fresh clone of AI Studio.
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2698568606"] = "Vielen Dank, Carsten, dass du den ersten Build nach einem frischen Klon von AI Studio repariert hast."
|
||||||
|
|
||||||
-- Supporters
|
-- Supporters
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2929332068"] = "Unterstützer"
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2929332068"] = "Unterstützer"
|
||||||
|
|
||||||
|
|||||||
+3
@@ -17412,6 +17412,9 @@ UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2640760894"] = "Become one of our
|
|||||||
-- Become one of our titans
|
-- Become one of our titans
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2640760894::INFORMAL"] = "Become one of our titans"
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2640760894::INFORMAL"] = "Become one of our titans"
|
||||||
|
|
||||||
|
-- Thank you, Carsten, for fixing the first build after a fresh clone of AI Studio.
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2698568606"] = "Thank you, Carsten, for fixing the first build after a fresh clone of AI Studio."
|
||||||
|
|
||||||
-- Supporters
|
-- Supporters
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2929332068"] = "Supporters"
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2929332068"] = "Supporters"
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user