Commit d7c2ebba authored by Christian Hergert's avatar Christian Hergert

plugins: cleanup package use by plugins

None of our plugins are using packages, so we might as well
keep things compact and just use modules instead of packages.

This also cleans up the rustup plugin to use gresources.
parent 251f9a3f
if get_option('with_cmake')
install_data('cmake_plugin/__init__.py', install_dir: join_paths(plugindir, 'cmake_plugin'))
install_data('cmake_plugin.py', install_dir: plugindir)
configure_file(
input: 'cmake.plugin',
......
if get_option('with_eslint')
eslint_dir = join_paths(plugindir, 'eslint_plugin')
install_data('eslint_plugin/__init__.py', install_dir: eslint_dir)
install_data('eslint_plugin.py', install_dir: plugindir)
install_data('org.gnome.builder.plugins.eslint.gschema.xml',
install_dir: schema_dir)
......
if get_option('with_make')
install_data('make_plugin/__init__.py', install_dir: join_paths(plugindir, 'make_plugin'))
install_data('make_plugin.py', install_dir: plugindir)
configure_file(
input: 'make.plugin',
......
if get_option('with_meson')
install_data('meson_plugin/__init__.py', install_dir: join_paths(plugindir, 'meson_plugin'))
install_data('meson_plugin.py', install_dir: plugindir)
configure_file(
input: 'meson.plugin',
......
if get_option('with_rustup')
rustup_dir = join_paths(plugindir, 'rustup_plugin')
install_data('rustup_plugin/__init__.py', install_dir: rustup_dir)
install_subdir('rustup_plugin/resources', install_dir: rustup_dir)
rustup_resources = gnome.compile_resources(
'rustup_plugin',
'rustup.gresource.xml',
gresource_bundle: true,
install: true,
install_dir: plugindir,
)
install_data('rustup_plugin.py', install_dir: plugindir)
configure_file(
input: 'rustup.plugin',
......
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/builder/plugins/rustup_plugin">
<file>rustup.sh</file>
</gresource>
</gresources>
......@@ -40,6 +40,10 @@ from gi.repository import Peas
_ = Ide.gettext
def get_resource(path):
full_path = os.path.join('/org/gnome/builder/plugins/rustup_plugin', path)
return Gio.resources_lookup_data(full_path, 0).get_data()
def get_module_data_path(name):
engine = Peas.Engine.get_default()
plugin = engine.get_plugin_info('rustup_plugin')
......@@ -310,11 +314,7 @@ class RustupInstaller(Ide.Transfer):
launcher.push_argv('/dev/stdin')
launcher.push_argv('-y')
try:
rustup_sh_path = get_module_data_path('resources/rustup.sh')
success, stdin_data = GLib.file_get_contents(rustup_sh_path)
except:
stdin_data = ""
stdin_data = get_resource('rustup.sh')
elif self.mode == _MODE_UPDATE:
launcher.push_argv(RustupApplicationAddin.instance.rustup_executable)
launcher.push_argv('update')
......@@ -397,7 +397,7 @@ class RustupInstaller(Ide.Transfer):
try:
self.props.progress = float(percent)/100
except Exception as te:
print('_read_line_cb', self.state, line)
print('_read_line_cb', self.state, line, te)
elif self.state == _STATE_DOWN_COMP or self.state == _STATE_SYNC_UPDATE or self.state == _STATE_CHECK_UPDATE_SELF or self.state == _STATE_DOWN_UPDATE_SELF:
# the first progress can be empty, skip it
if length > 0:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment