From 9f122ccd16d938786350071ca238b41a8ea8996d Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 4 Jun 2023 23:46:38 +0000 Subject: [PATCH] make-sfx: option to auto-obtain webdeps --- docs/devnotes.md | 18 +--------------- scripts/make-sfx.sh | 52 ++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 50 insertions(+), 20 deletions(-) diff --git a/docs/devnotes.md b/docs/devnotes.md index ad3ad483..04ae68bd 100644 --- a/docs/devnotes.md +++ b/docs/devnotes.md @@ -238,23 +238,7 @@ pip install black==21.12b0 click==8.0.2 bandit pylint flake8 isort mypy # vscod if you just want to modify the copyparty source code (py/html/css/js) then this is the easiest approach -first grab the web-dependencies from a previous sfx (assuming you don't need to modify something in those): - -```sh -rm -rf copyparty/web/deps -curl -L https://github.com/9001/copyparty/releases/latest/download/copyparty-sfx.py >x.py -python3 x.py --version -rm x.py -cp -R /tmp/pe-copyparty.$(id -u)/copyparty/web/deps copyparty/web/ -``` - -or you could build the web-dependencies from source instead: - -```sh -make -C scripts/deps-docker -``` - -then build the sfx using any of the following examples: +build the sfx using any of the following examples: ```sh ./scripts/make-sfx.sh # regular edition diff --git a/scripts/make-sfx.sh b/scripts/make-sfx.sh index 44927c15..04fe5f7f 100755 --- a/scripts/make-sfx.sh +++ b/scripts/make-sfx.sh @@ -2,6 +2,8 @@ set -e echo +berr() { p=$(head -c 72 x.py -could not find webdeps; please see https://github.com/9001/copyparty/blob/hovudstraum/docs/devnotes.md#building -or run with argument "ign-wd" if this was intentional + echo "extracting webdeps..." + wdsrc="$("$pybin" x.py --version 2>&1 | tee /dev/stderr | awk '/sfxdir:/{sub(/.*: /,"");print;exit}')" + [ "$wdsrc" ] || { + echo failed to discover tempdir of reference copyparty-sfx.py + exit 1 + } + rm -rf copyparty/web/deps + cp -pvR "$wdsrc/copyparty/web/deps" copyparty/web/ + + # also copy it out into the source-tree for next time + rm -rf ../copyparty/web/deps + cp -pR copyparty/web/deps ../copyparty/web + + rm x.py +} + +[ -e copyparty/web/deps/mini-fa.woff ] || [ $ign_wd ] || { berr <<'EOF' +ERROR: + could not find webdeps; the front-end will not be fully functional + +please choose one of the following: + +A) add the argument "dl-wd" to fix it automatically; this will + download copyparty-sfx.py and extract the webdeps from there + +B) build the webdeps from source: make -C scripts/deps-docker + +C) add the argument "ign-wd" to continue building the sfx without webdeps + +alternative A is a good choice if you are only intending to +modify the copyparty source code (py/html/css/js) and do not +plan to make any changes to the mostly-third-party webdeps + +there may be additional hints in the devnotes: +https://github.com/9001/copyparty/blob/hovudstraum/docs/devnotes.md#building EOF exit 1 }