[gnome-builder/tingping/jhbuild-runtime] jhbuild: Add JHBuild implementation of IdeRuntime
- From: Patrick Griffis <pgriffis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/tingping/jhbuild-runtime] jhbuild: Add JHBuild implementation of IdeRuntime
- Date: Wed, 17 Feb 2016 22:54:22 +0000 (UTC)
commit d9b01004b4970bd09901b740985d70243954a1eb
Author: Patrick Griffis <tingping tingping se>
Date: Wed Feb 17 17:41:27 2016 -0500
jhbuild: Add JHBuild implementation of IdeRuntime
This is the minimum required to work as it only handles
default JHBuild configurations
configure.ac | 2 +
plugins/Makefile.am | 1 +
plugins/jhbuild/Makefile.am | 14 ++++++
plugins/jhbuild/configure.ac | 16 +++++++
plugins/jhbuild/jhbuild.plugin | 8 ++++
plugins/jhbuild/jhbuild_plugin.py | 81 +++++++++++++++++++++++++++++++++++++
6 files changed, 122 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index eb220ed..e8e6d35 100644
--- a/configure.ac
+++ b/configure.ac
@@ -250,6 +250,7 @@ m4_include([plugins/gnome-code-assistance/configure.ac])
m4_include([plugins/html-completion/configure.ac])
m4_include([plugins/html-preview/configure.ac])
m4_include([plugins/jedi/configure.ac])
+m4_include([plugins/jhbuild/configure.ac])
m4_include([plugins/library-template/configure.ac])
m4_include([plugins/mingw/configure.ac])
m4_include([plugins/project-tree/configure.ac])
@@ -493,6 +494,7 @@ echo " Global File Search ................... : ${enable_file_search_plugin}"
echo " GNOME Code Assistance ................ : ${enable_gnome_code_assistance_plugin}"
echo " HTML Autocompletion .................. : ${enable_html_completion_plugin}"
echo " HTML and Markdown Preview ............ : ${enable_html_preview_plugin}"
+echo " JHBuild .............................. : ${enable_jhbuild_plugin}"
echo " MinGW ................................ : ${enable_mingw_plugin}"
echo " Project Creation ..................... : ${enable_create_project_plugin}"
echo " Project Tree ......................... : ${enable_project_tree_plugin}"
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 8bd3936..7ccd8fe 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -17,6 +17,7 @@ SUBDIRS = \
html-completion \
html-preview \
jedi \
+ jhbuild \
library-template \
project-tree \
python-gi-imports-completion \
diff --git a/plugins/jhbuild/Makefile.am b/plugins/jhbuild/Makefile.am
new file mode 100644
index 0000000..fe0f21a
--- /dev/null
+++ b/plugins/jhbuild/Makefile.am
@@ -0,0 +1,14 @@
+if ENABLE_JHBUILD_PLUGIN
+
+EXTRA_DIST = $(plugin_DATA)
+
+plugindir = $(libdir)/gnome-builder/plugins
+dist_plugin_DATA = \
+ jhbuild.plugin \
+ jhbuild_plugin.py
+
+endif
+
+GITIGNOREFILES = __pycache__
+
+-include $(top_srcdir)/git.mk
diff --git a/plugins/jhbuild/configure.ac b/plugins/jhbuild/configure.ac
new file mode 100644
index 0000000..d08fcf3
--- /dev/null
+++ b/plugins/jhbuild/configure.ac
@@ -0,0 +1,16 @@
+# --enable-jhbuild-plugin=yes/no
+AC_ARG_ENABLE([jhbuild-plugin],
+ [AS_HELP_STRING([--enable-jhbuild-plugin=@<:@yes/no@:>@],
+ [Build with support for building with JHBuild.])],
+ [enable_jhbuild_plugin=$enableval],
+ [enable_jhbuild_plugin=yes])
+
+AS_IF([test x$enable_python_scripting != xyes && test x$enable_jhbuild_plugin = xyes],[
+ enable_jhbuild_plugin=no
+])
+
+# for if ENABLE_JHBUILD_PLUGIN in Makefile.am
+AM_CONDITIONAL(ENABLE_JHBUILD_PLUGIN, test x$enable_jhbuild_plugin = xyes)
+
+# Ensure our makefile is generated by autoconf
+AC_CONFIG_FILES([plugins/jhbuild/Makefile])
diff --git a/plugins/jhbuild/jhbuild.plugin b/plugins/jhbuild/jhbuild.plugin
new file mode 100644
index 0000000..0a7068d
--- /dev/null
+++ b/plugins/jhbuild/jhbuild.plugin
@@ -0,0 +1,8 @@
+[Plugin]
+Module=jhbuild_plugin
+Name=JHBuild
+Description=Provides support for building with JHBuild
+Authors=Patrick Griffis <tingping tingping se>
+Copyright=Copyright © 2016 Patrick Griffis
+Loader=python3
+Builtin=true
diff --git a/plugins/jhbuild/jhbuild_plugin.py b/plugins/jhbuild/jhbuild_plugin.py
new file mode 100644
index 0000000..07ec2f5
--- /dev/null
+++ b/plugins/jhbuild/jhbuild_plugin.py
@@ -0,0 +1,81 @@
+#!/usr/bin/env python3
+
+# jhbuild_plugin.py
+#
+# Copyright (C) 2016 Patrick Griffis <tingping tingping se>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import os
+
+import gi
+gi.require_version('Ide', '1.0')
+
+from gi.repository import (
+ GLib,
+ GObject,
+ Gio,
+ Ide,
+)
+
+class JhbuildRuntime(Ide.Runtime):
+
+ def __init__(self, *args, **kwargs):
+ Ide.Runtime.__init__(self, *args, **kwargs)
+
+ def do_create_launcher(self):
+ try:
+ launcher = Ide.Runtime.do_create_launcher(self)
+ launcher.push_argv('jhbuild')
+ launcher.push_argv('run')
+ return launcher
+ except GLib.Error:
+ return None
+
+ def do_prepare_configuration(self, configuration):
+ # TODO: Figure out a way to extract the real prefix from jhbuild
+ # Sadly it is still Python 2 only though so we shouldn't directly import it
+ prefix = os.path.join(GLib.get_home_dir(), 'jhbuild', 'install')
+ configuration.set_prefix(prefix)
+
+ def do_contains_program_in_path(self, program, cancellable):
+ launcher = self.create_launcher()
+ launcher.push_argv('which')
+ launcher.push_argv(program)
+
+ try:
+ subprocess = launcher.spawn_sync (cancellable)
+ return subprocess.wait_check (cancellable)
+ except GLib.Error:
+ return False
+
+class JhbuildRuntimeProvider(GObject.Object, Ide.RuntimeProvider):
+
+ def __init__(self, *args, **kwargs):
+ super().__init__(self, *args, **kwargs)
+
+ @staticmethod
+ def _is_jhbuild_installed():
+ # This could be installed into another path, but their build system
+ # defaults to ~/.local
+ jhbuild_path = os.path.join(GLib.get_home_dir(), '.local', 'bin', 'jhbuild')
+ return os.path.isfile(jhbuild_path)
+
+ def do_load(self, manager):
+ if self._is_jhbuild_installed():
+ runtime = JhbuildRuntime(id="jhbuild", display_name="JHBuild")
+ manager.add(runtime)
+
+ def do_unload(self, manager):
+ pass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]