2022-11-21 22:20:27 +00:00
|
|
|
|
using Droplex;
|
2022-11-30 10:06:54 +00:00
|
|
|
|
using Flow.Launcher.Core.Plugin;
|
2022-11-21 22:20:27 +00:00
|
|
|
|
using Flow.Launcher.Infrastructure.UserSettings;
|
|
|
|
|
|
using Flow.Launcher.Plugin;
|
|
|
|
|
|
using Flow.Launcher.Plugin.SharedCommands;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Flow.Launcher.Core.ExternalPlugins.Environments
|
|
|
|
|
|
{
|
|
|
|
|
|
internal class PythonEnvironment : AbstractPluginEnvironment
|
|
|
|
|
|
{
|
|
|
|
|
|
internal override string Language => AllowedLanguage.Python;
|
|
|
|
|
|
|
2022-12-01 03:40:24 +00:00
|
|
|
|
internal override string EnvName => DataLocation.PythonEnvironmentName;
|
2022-11-21 22:20:27 +00:00
|
|
|
|
|
2022-12-01 03:40:24 +00:00
|
|
|
|
internal override string EnvPath => Path.Combine(DataLocation.PluginEnvironmentsPath, EnvName);
|
2022-11-21 22:20:27 +00:00
|
|
|
|
|
2023-08-03 11:41:35 +00:00
|
|
|
|
internal override string InstallPath => Path.Combine(EnvPath, "PythonEmbeddable-v3.11.4");
|
2022-11-21 22:20:27 +00:00
|
|
|
|
|
|
|
|
|
|
internal override string ExecutablePath => Path.Combine(InstallPath, "pythonw.exe");
|
|
|
|
|
|
|
|
|
|
|
|
internal override string FileDialogFilter => "Python|pythonw.exe";
|
|
|
|
|
|
|
|
|
|
|
|
internal override string PluginsSettingsFilePath { get => PluginSettings.PythonExecutablePath; set => PluginSettings.PythonExecutablePath = value; }
|
|
|
|
|
|
|
|
|
|
|
|
internal PythonEnvironment(List<PluginMetadata> pluginMetadataList, PluginsSettings pluginSettings) : base(pluginMetadataList, pluginSettings) { }
|
|
|
|
|
|
|
|
|
|
|
|
internal override void InstallEnvironment()
|
|
|
|
|
|
{
|
2024-11-25 02:38:43 +00:00
|
|
|
|
FilesFolders.RemoveFolderIfExists(InstallPath, MessageBoxEx.Show);
|
2022-11-21 22:20:27 +00:00
|
|
|
|
|
2023-08-03 11:41:35 +00:00
|
|
|
|
// Python 3.11.4 is no longer Windows 7 compatible. If user is on Win 7 and
|
|
|
|
|
|
// uses Python plugin they need to custom install and use v3.8.9
|
2023-08-03 11:16:58 +00:00
|
|
|
|
DroplexPackage.Drop(App.python_3_11_4_embeddable, InstallPath).Wait();
|
2022-11-21 22:20:27 +00:00
|
|
|
|
|
|
|
|
|
|
PluginsSettingsFilePath = ExecutablePath;
|
|
|
|
|
|
}
|
2022-11-30 10:06:54 +00:00
|
|
|
|
|
|
|
|
|
|
internal override PluginPair CreatePluginPair(string filePath, PluginMetadata metadata)
|
|
|
|
|
|
{
|
|
|
|
|
|
return new PluginPair
|
|
|
|
|
|
{
|
|
|
|
|
|
Plugin = new PythonPlugin(filePath),
|
|
|
|
|
|
Metadata = metadata
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
2022-11-21 22:20:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|