From 0e7c5ae3c25ad43d838260510cdb2247e6b7a57e Mon Sep 17 00:00:00 2001 From: Remy Blank Date: Sat, 7 Sep 2024 20:12:40 +0200 Subject: [PATCH] Package sqlite from the Node.js module instead of a subrepo. --- .gitmodules | 3 --- ext/sqlite-wasm | 1 - pyproject.toml | 2 -- tdoc/common/__init__.py | 9 +++++---- tdoc/common/static/tdoc-sql.js | 2 +- tools/hatch_hooks.py | 7 +++++-- 6 files changed, 11 insertions(+), 13 deletions(-) delete mode 100644 .gitmodules delete mode 160000 ext/sqlite-wasm diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 84e37f6..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "sqlite-wasm"] - path = ext/sqlite-wasm - url = https://github.com/sqlite/sqlite-wasm.git diff --git a/ext/sqlite-wasm b/ext/sqlite-wasm deleted file mode 160000 index 099eac6..0000000 --- a/ext/sqlite-wasm +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 099eac6b2b1c9eeda3e25a76b11a5faeeca805d6 diff --git a/pyproject.toml b/pyproject.toml index bc49ff7..f2c662a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -59,10 +59,8 @@ artifacts = [ [tool.hatch.build.targets.wheel] only-include = [ - "ext/sqlite-wasm/sqlite-wasm/jswasm", "tdoc", ] artifacts = [ "/tdoc/common/static.gen/", ] -sources."ext/sqlite-wasm/sqlite-wasm" = "tdoc/common/static" diff --git a/tdoc/common/__init__.py b/tdoc/common/__init__.py index 09c7e10..97cc7e4 100644 --- a/tdoc/common/__init__.py +++ b/tdoc/common/__init__.py @@ -10,7 +10,7 @@ from sphinx.util import logging __project__ = 't-doc-common' -__version__ = '0.6' +__version__ = '0.7.dev1' _common = pathlib.Path(__file__).absolute().parent _root = _common.parent.parent @@ -66,9 +66,10 @@ def on_builder_inited(app): # Add our own static paths. app.config.html_static_path.append(str(_common / 'static')) app.config.html_static_path.append(str(_common / 'static.gen')) - sw = _root / 'ext' / 'sqlite-wasm' / 'sqlite-wasm' - if (sw / 'jswasm').is_dir(): - app.config.html_static_path.append(str(sw)) + sqlite_path = (_root / 'node_modules' / '@sqlite.org' / 'sqlite-wasm' + / 'sqlite-wasm' / 'jswasm') + if sqlite_path.is_dir(): + app.config.html_static_path.append(str(sqlite_path)) def on_html_page_context(app, page, template, context, doctree): diff --git a/tdoc/common/static/tdoc-sql.js b/tdoc/common/static/tdoc-sql.js index 838cfaa..651d735 100644 --- a/tdoc/common/static/tdoc-sql.js +++ b/tdoc/common/static/tdoc-sql.js @@ -1,7 +1,7 @@ // Copyright 2024 Remy Blank // SPDX-License-Identifier: MIT -import {default as sqlite3_init} from './jswasm/sqlite3-worker1-promiser.mjs'; +import {default as sqlite3_init} from './sqlite3-worker1-promiser.mjs'; import {addEditor, findEditor} from './tdoc-editor.js'; function waitLoaded() { diff --git a/tools/hatch_hooks.py b/tools/hatch_hooks.py index f4300a9..7defbcf 100644 --- a/tools/hatch_hooks.py +++ b/tools/hatch_hooks.py @@ -27,10 +27,13 @@ def initialize(self, version, build_data): self.run(['npm', 'install']) self.app.display_info("Removing generated files") root = pathlib.Path(self.root) - shutil.rmtree(root / 'tdoc' / 'common' / 'static.gen', - ignore_errors=True) + static_gen = root / 'tdoc' / 'common' / 'static.gen' + shutil.rmtree(static_gen, ignore_errors=True) (root / LICENSES).unlink(missing_ok=True) self.app.display_info("Generating files") + shutil.copytree(root / 'node_modules' / '@sqlite.org' / 'sqlite-wasm' + / 'sqlite-wasm' / 'jswasm', + static_gen, symlinks=True) self.run(['npm', 'run', 'build']) def run(self, args):