[education/rkward] /: Allow for plugins to depend on platform, and show AppImage download plugin on unix, only.
Thomas Friedrichsmeier
null at kde.org
Sat Sep 7 21:47:35 BST 2024
Git commit a7bb5c0d66bf7dc3e09095c6c0295b9010b11308 by Thomas Friedrichsmeier.
Committed on 07/09/2024 at 20:46.
Pushed by tfry into branch 'master'.
Allow for plugins to depend on platform, and show AppImage download plugin on unix, only.
M +2 -0 ChangeLog
M +14 -3 doc/rkwardplugins/index.docbook
M +1 -1 rkward/plugin/rkcomponentmap.cpp
M +25 -11 rkward/plugin/rkcomponentmeta.cpp
M +3 -1 rkward/plugins/import_export.pluginmap
https://invent.kde.org/education/rkward/-/commit/a7bb5c0d66bf7dc3e09095c6c0295b9010b11308
diff --git a/ChangeLog b/ChangeLog
index a655a5b8c..98d894b6e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,6 @@
--- Version 0.8.1 - UNRELEASED
+- Added: Plugin to facilitate download of latest AppImage (Linux only)
+- Added: Allow to limit plugins to certain platforms
- Fixed: antialising=FALSE was ignored in RK() device
- Added: Impoement glyph()-functionality in RK() device
- Fixed: Crash when manually adding plugin maps via "Manage R packages and pluigns"
diff --git a/doc/rkwardplugins/index.docbook b/doc/rkwardplugins/index.docbook
index 87fc3fba1..d07e9eca3 100644
--- a/doc/rkwardplugins/index.docbook
+++ b/doc/rkwardplugins/index.docbook
@@ -50,7 +50,7 @@ as Authors, publish date, the abstract, and Keywords -->
<copyright>
-<year>2006-2022</year>
+<year>2006-2024</year>
<holder>Thomas Friedrichsmeier</holder>
</copyright>
<!-- Translators: put here the copyright notice of the translation -->
@@ -58,8 +58,8 @@ as Authors, publish date, the abstract, and Keywords -->
and in the FDL itself on how to use it. -->
<legalnotice>&FDLNotice;</legalnotice>
-<date>2022-04-24</date>
-<releaseinfo>0.7.4</releaseinfo>
+<date>2024-09-07</date>
+<releaseinfo>0.8.1</releaseinfo>
<abstract>
<para>
@@ -4110,6 +4110,11 @@ different types, using modifiers may lead to errors. For <replaceable>fixed_valu
<term>R_min_version, R_max_version</term>
<listitem><para>Minimum and maximum allowed version of &R;. Version specifications may <emphasis>not</emphasis> include non-numeric suffixes, like "0.5.7z-devel1". The &R; version dependency will be shown on the plugins' help pages, but does not have any direct effect, as of &rkward; 0.6.1. <link linkend="sect_dependencies_r_version">More information</link>. Optional; if not specified, no minimum / maximum version of &R; will be required.</para></listitem>
</varlistentry>
+ <varlistentry>
+ <term>platforms</term>
+ <listitem><para>Platforms where this plugin is available. Supported values are <replaceable>"unix"</replaceable>, <replaceable>"windows"</replaceable>, <replaceable>"macos"</replaceable>, <replaceable>"any"</replaceable>, and colon separated combinations (e.g. <replaceable>"unix:macos"</replaceable>). <replaceable>"unix"</replaceable> includes any Linux and BSD variants but <emphasis>not></emphasis> MacOS.
+ If your plugin is not platform dependent, just omit this attribute.</para></listitem>
+ </varlistentry>
</variablelist>
<para>Child elements:</para>
<variablelist>
@@ -4243,6 +4248,12 @@ different types, using modifiers may lead to errors. For <replaceable>fixed_valu
<term>label</term>
<listitem><para>The label for this component, when placed in the menu hierarchy.</para></listitem>
</varlistentry>
+ <varlistentry>
+ <term>optional</term>
+ <listitem><para>Only meaningful for components with defined <link linkend="chapter_dependencies">dependencies</link>: Usually, it is considered a reportable error, if a component is not compatible with
+ this version if of RKWard. However, if the component really is not needed in the current environment, setting this attribute to <replaceable>"true"</replaceable>
+ suppresses any warning (<replaceable>"false"</replaceable> by default).</para></listitem>
+ </varlistentry>
</variablelist></para></listitem>
</varlistentry>
<varlistentry>
diff --git a/rkward/plugin/rkcomponentmap.cpp b/rkward/plugin/rkcomponentmap.cpp
index 3f826bdf6..e86169213 100644
--- a/rkward/plugin/rkcomponentmap.cpp
+++ b/rkward/plugin/rkcomponentmap.cpp
@@ -637,7 +637,7 @@ RKPluginMapParseResult RKComponentMap::addPluginMap (const QString& plugin_map_f
if (!cdependencies.isNull ()) {
if (!RKComponentDependency::isRKWardVersionCompatible (cdependencies)) {
RK_DEBUG (PLUGIN, DL_INFO, "Skipping component '%1': Not compatible with this version of RKWard", qPrintable (id));
- depfailed_local_components.insert (id);
+ if (!xml.getBoolAttribute((*it), "optional", false, DL_INFO)) depfailed_local_components.insert(id);
continue;
}
}
diff --git a/rkward/plugin/rkcomponentmeta.cpp b/rkward/plugin/rkcomponentmeta.cpp
index 85f1657d5..bfbf3dd8f 100644
--- a/rkward/plugin/rkcomponentmeta.cpp
+++ b/rkward/plugin/rkcomponentmeta.cpp
@@ -1,6 +1,6 @@
/*
rkcomponentmeta - This file is part of RKWard (https://rkward.kde.org). Created: Wed Jan 09 2013
-SPDX-FileCopyrightText: 2013-2022 by Thomas Friedrichsmeier <thomas.friedrichsmeier at kdemail.net>
+SPDX-FileCopyrightText: 2013-2024 by Thomas Friedrichsmeier <thomas.friedrichsmeier at kdemail.net>
SPDX-FileContributor: The RKWard Team <rkward-devel at kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
@@ -15,12 +15,13 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include "../debug.h"
-QLatin1String rkward_min_version_tag ("rkward_min_version");
-QLatin1String rkward_max_version_tag ("rkward_max_version");
-QLatin1String R_min_version_tag ("R_min_version");
-QLatin1String R_max_version_tag ("R_max_version");
-QLatin1String any_min_version_tag ("min_version");
-QLatin1String any_max_version_tag ("max_version");
+static QLatin1String rkward_min_version_tag("rkward_min_version");
+static QLatin1String rkward_max_version_tag("rkward_max_version");
+static QLatin1String R_min_version_tag("R_min_version");
+static QLatin1String R_max_version_tag("R_max_version");
+static QLatin1String any_min_version_tag("min_version");
+static QLatin1String any_max_version_tag("max_version");
+static QLatin1String platforms_tag("platforms");
RKComponentAboutData::RKComponentAboutData (const QDomElement& e, XMLHelper &xml) {
RK_TRACE (PLUGIN);
@@ -111,11 +112,24 @@ QString RKComponentAboutData::toHtml () const {
bool RKComponentDependency::isRKWardVersionCompatible (const QDomElement& e) {
RK_TRACE (PLUGIN);
- if (e.hasAttribute (rkward_min_version_tag)) {
- if (RKSessionVars::compareRKWardVersion (e.attribute (rkward_min_version_tag)) > 0) return false;
+ if (e.hasAttribute(rkward_min_version_tag)) {
+ if (RKSessionVars::compareRKWardVersion(e.attribute(rkward_min_version_tag)) > 0) return false;
}
- if (e.hasAttribute (rkward_max_version_tag)) {
- if (RKSessionVars::compareRKWardVersion (e.attribute (rkward_max_version_tag)) < 0) return false;
+ if (e.hasAttribute(rkward_max_version_tag)) {
+ if (RKSessionVars::compareRKWardVersion(e.attribute(rkward_max_version_tag)) < 0) return false;
+ }
+ if (e.hasAttribute(platforms_tag)) {
+ auto platforms = e.attribute(platforms_tag).split(':');
+#if defined(Q_OS_WIN)
+ if (platforms.contains(QLatin1String("windows"))) return true;
+#elif defined(Q_OS_MACOS)
+ if (platforms.contains(QLatin1String("macos"))) return true;
+#elif defined(Q_OS_UNIX) // NOTE: order matters. Q_OS_UNIX is also defined on mac, but we do not want to count that as "unix", here.
+ if (platforms.contains(QLatin1String("unix"))) return true;
+#else
+ static_assert(false, "Undefined platform");
+#endif
+ return false;
}
return true;
diff --git a/rkward/plugins/import_export.pluginmap b/rkward/plugins/import_export.pluginmap
index 22823d384..33de76ba2 100644
--- a/rkward/plugins/import_export.pluginmap
+++ b/rkward/plugins/import_export.pluginmap
@@ -51,7 +51,9 @@ SPDX-License-Identifier: GPL-2.0-or-later
<component type="standard" id="import_generic_rio" file="import/import_generic_rio.xml" label="Generic import (rio-based)" />
<component type="standard" id="setworkdir" file="setworkdir.xml" label="Set Working Directory" />
- <component id="cmp_DownloadAppImgDwnldAppImg" label="Download AppImage" type="standard" file="DownloadAppImage.xml"></component>
+ <component id="cmp_DownloadAppImgDwnldAppImg" label="Download AppImage" type="standard" file="DownloadAppImage.xml" optional="true">
+ <dependencies platforms="unix"/>
+ </component>
</components>
<hierarchy>
More information about the rkward-tracker
mailing list