From 3755b476bce0283b80952361f24e57050210516e Mon Sep 17 00:00:00 2001 From: luddens Date: Mon, 18 May 2020 09:50:49 +0200 Subject: [PATCH] add vuejs as kiwix-desktop dependency --- kiwixbuild/dependencies/__init__.py | 1 + kiwixbuild/dependencies/kiwix_desktop.py | 2 +- kiwixbuild/dependencies/vuejs.py | 37 ++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 kiwixbuild/dependencies/vuejs.py diff --git a/kiwixbuild/dependencies/__init__.py b/kiwixbuild/dependencies/__init__.py index 81a90ff..42a3b46 100644 --- a/kiwixbuild/dependencies/__init__.py +++ b/kiwixbuild/dependencies/__init__.py @@ -5,6 +5,7 @@ from . import ( android_ndk, android_sdk, aria2, + vuejs, armhf, docoptcpp, flatpak, diff --git a/kiwixbuild/dependencies/kiwix_desktop.py b/kiwixbuild/dependencies/kiwix_desktop.py index 73d8ede..30c1a84 100644 --- a/kiwixbuild/dependencies/kiwix_desktop.py +++ b/kiwixbuild/dependencies/kiwix_desktop.py @@ -12,7 +12,7 @@ class KiwixDesktop(Dependency): git_dir = "kiwix-desktop" class Builder(QMakeBuilder): - dependencies = ["qt", "qtwebengine", "kiwix-lib", "aria2", "kiwix-tools"] + dependencies = ["qt", "qtwebengine", "kiwix-lib", "aria2", "kiwix-tools", "vuejs"] make_install_target = 'install' configure_env = None diff --git a/kiwixbuild/dependencies/vuejs.py b/kiwixbuild/dependencies/vuejs.py new file mode 100644 index 0000000..fb80fa4 --- /dev/null +++ b/kiwixbuild/dependencies/vuejs.py @@ -0,0 +1,37 @@ +import os +from .base import ( + Dependency, + Builder, + Source +) +from kiwixbuild.utils import Remotefile, run_command +from kiwixbuild._global import neutralEnv + +pj = os.path.join + +class VueJs(Dependency): + name = "vuejs" + + class Source(Source): + archive = Remotefile('vue.js', '', 'https://vuejs.org/js/vue.js') + + def _download(self, context): + context.try_skip(neutralEnv('archive_dir'), self.name) + neutralEnv('download')(self.archive) + + def prepare(self): + self.command('download', self._download) + + + class Builder(Builder): + def build(self): + self.command('configure', self._configure) + + def make_dist(self): + pass + + def _configure(self, context): + source_path = pj(neutralEnv('archive_dir'), 'vue.js') + dest_path = pj(neutralEnv('source_dir'), 'kiwix-desktop', 'resources', 'js', 'vue.js') + if os.path.exists(source_path) and os.path.exists(dest_path): + os.rename(source_path, dest_path) \ No newline at end of file