[version] add __variant__

Specifies origin and OS of executable files.
For example 'stable/windows'.
This commit is contained in:
Mike Fährmann
2024-05-27 21:37:01 +02:00
parent 020050ea8b
commit 601f5becc8
5 changed files with 39 additions and 11 deletions

View File

@@ -53,19 +53,20 @@ build-linux() {
cd "${ROOTDIR}"
echo Building Linux executable
build-vm 'ubuntu22.04' 'gallery-dl.bin'
build-vm 'ubuntu22.04' 'gallery-dl.bin' 'linux'
}
build-windows() {
cd "${ROOTDIR}"
echo Building Windows executable
build-vm 'windows7_x86_sp1' 'gallery-dl.exe'
build-vm 'windows7_x86_sp1' 'gallery-dl.exe' 'windows'
}
build-vm() {
VMNAME="$1"
BINNAME="$2"
LABEL="$3"
TMPPATH="/tmp/gallery-dl/dist/$BINNAME"
# launch VM
@@ -77,6 +78,11 @@ build-vm() {
cp -a -t /tmp/gallery-dl -- \
./gallery_dl ./scripts ./data ./setup.py ./README.rst
# update __variant__
sed -i \
-e "s#\(__variant__ *=\).*#\1 \"stable/${LABEL}\"#" \
/tmp/gallery-dl/gallery_dl/version.py
# remove old executable
rm -f "./dist/$BINNAME"