Skip to content
This repository has been archived by the owner on Nov 30, 2024. It is now read-only.

Commit

Permalink
generate descriptor json for plugin management (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj authored Jan 28, 2024
1 parent b56fb6c commit 6b1ab73
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ f5m_install() {

f5m_make_tarball() {
cd $DESTDIR$INSTALL_PREFIX
python $ROOT/generate-descriptor.py
tar cjvf ../../../$name-$ARCH.tar.bz2 *
}

Expand Down
2 changes: 2 additions & 0 deletions fix-cross-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ for package in "${broken_packages[@]}"; do
cross_pkg=$package-arm64.tar.bz2
mkdir $tmp_dir
tar xjvf $native_pkg -C $tmp_dir
mv $tmp_dir/plugin/$package.json{,.bak}
tar xjvf $cross_pkg -C $tmp_dir
mv $tmp_dir/plugin/$package.json{.bak,}
cd $tmp_dir
tar cjvf $ROOT/$cross_pkg *
cd $ROOT
Expand Down
16 changes: 16 additions & 0 deletions generate-descriptor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import json
import os

cwd = os.getcwd()
plugin = cwd.split("/")[-3] # /path/to/rime/tmp/fcitx5
files: list[str] = []

for dirpath, _, filenames in os.walk(os.getcwd()):
for filename in filenames:
files.append(f"{dirpath[len(cwd) + 1:]}/{filename}")

os.makedirs("plugin", exist_ok=True)
with open(f"plugin/{plugin}.json", "w") as f:
json.dump({
"files": files
}, f)

0 comments on commit 6b1ab73

Please sign in to comment.