[gimp] app: Support using plug-ins from build dir
- From: Martin Nordholts <martinn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: Support using plug-ins from build dir
- Date: Fri, 8 Apr 2011 06:49:48 +0000 (UTC)
commit 5f48111af98f05fdab2d7c944d28ddd7fb9d2174
Author: Martin Nordholts <martinn src gnome org>
Date: Fri Apr 8 07:58:28 2011 +0200
app: Support using plug-ins from build dir
When we run our tests we want to use plug-ins from the build dir so
the tests can pass also when no make install have been made.
Use the environment variables GIMP_TESTING_PLUGINDIRS and
GIMP_TESTING_PLUGINDIRS_BASENAME_IGNORES for this.
app/plug-in/gimppluginmanager-restore.c | 57 +++++++++++++++++++++++++++++-
1 files changed, 55 insertions(+), 2 deletions(-)
---
diff --git a/app/plug-in/gimppluginmanager-restore.c b/app/plug-in/gimppluginmanager-restore.c
index 3e059f8..c82532b 100644
--- a/app/plug-in/gimppluginmanager-restore.c
+++ b/app/plug-in/gimppluginmanager-restore.c
@@ -228,8 +228,14 @@ gimp_plug_in_manager_search (GimpPlugInManager *manager,
status_callback (_("Searching Plug-Ins"), "", 0.0);
- path = gimp_config_path_expand (manager->gimp->config->plug_in_path,
- TRUE, NULL);
+ /* Give automatic tests a chance to use plug-ins from the build
+ * dir
+ */
+ path = g_strdup(g_getenv("GIMP_TESTING_PLUGINDIRS"));
+
+ if (! path)
+ path = gimp_config_path_expand (manager->gimp->config->plug_in_path,
+ TRUE, NULL);
gimp_datafiles_read_directories (path,
G_FILE_TEST_IS_EXECUTABLE,
@@ -493,6 +499,45 @@ gimp_plug_in_manager_bind_text_domains (GimpPlugInManager *manager)
g_strfreev (locale_paths);
}
+/**
+ * gimp_plug_in_manager_ignore_plugin_basename:
+ * @basename: Basename to test with
+ *
+ * Checks the environment variable
+ * GIMP_TESTING_PLUGINDIRS_BASENAME_IGNORES for file basenames.
+ *
+ * Returns: %TRUE if @basename was in GIMP_TESTING_PLUGINDIRS_BASENAME_IGNORES
+ **/
+static gboolean
+gimp_plug_in_manager_ignore_plugin_basename (const gchar *plugin_basename)
+{
+ const gchar *ignore_basenames_string;
+ GList *ignore_basenames;
+ GList *iter;
+ gboolean ignore = FALSE;
+
+ ignore_basenames_string = g_getenv("GIMP_TESTING_PLUGINDIRS_BASENAME_IGNORES");
+ ignore_basenames = gimp_path_parse (ignore_basenames_string,
+ 256 /*max_paths*/,
+ FALSE /*check*/,
+ NULL /*check_failed*/);
+
+ for (iter = ignore_basenames; iter; iter = g_list_next (iter))
+ {
+ const gchar *ignore_basename = iter->data;
+
+ if (g_ascii_strcasecmp (ignore_basename, plugin_basename) == 0)
+ {
+ ignore = TRUE;
+ break;
+ }
+ }
+
+ gimp_path_free (ignore_basenames);
+
+ return ignore;
+}
+
static void
gimp_plug_in_manager_add_from_file (const GimpDatafileData *file_data,
gpointer data)
@@ -501,6 +546,14 @@ gimp_plug_in_manager_add_from_file (const GimpDatafileData *file_data,
GimpPlugInDef *plug_in_def;
GSList *list;
+ /* When we scan build dirs for plug-ins, there will be some
+ * executable files that are not plug-ins that we want to ignore,
+ * for example plug-ins/common/mkgen.pl if
+ * GIMP_TESTING_PLUGINDIRS=plug-ins/common
+ */
+ if (gimp_plug_in_manager_ignore_plugin_basename (file_data->basename))
+ return;
+
for (list = manager->plug_in_defs; list; list = list->next)
{
gchar *plug_in_name;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]