mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 02:32:33 +01:00
[version] add __variant__
Specifies origin and OS of executable files. For example 'stable/windows'.
This commit is contained in:
parent
020050ea8b
commit
601f5becc8
10
.github/workflows/executables.yml
vendored
10
.github/workflows/executables.yml
vendored
@ -42,7 +42,9 @@ jobs:
|
||||
architecture: ${{ matrix.architecture }}
|
||||
|
||||
- name: Date
|
||||
run: echo "DATE=$(date '+${{ env.DATE_FORMAT }}')" >> "$GITHUB_ENV"
|
||||
run: |
|
||||
echo "DATE=$(date '+${{ env.DATE_FORMAT }}')" >> "$GITHUB_ENV"
|
||||
echo "LABEL=$(python ./scripts/pyinstaller.py --print --os '${{ matrix.os }}' --arch '${{ matrix.architecture }}')" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Update Version
|
||||
# use Python since its behavior is consistent across operating systems
|
||||
@ -56,13 +58,17 @@ jobs:
|
||||
r'\b(__version__ = "[^"]+)',
|
||||
r"\1:${{ env.DATE }}",
|
||||
content)
|
||||
content = re.sub(
|
||||
r'\b(__variant__ =).+',
|
||||
r'\1 "dev/${{ env.LABEL }}"',
|
||||
content)
|
||||
with open(path, "w") as fp:
|
||||
fp.write(content)
|
||||
|
||||
- name: Build executable
|
||||
run: |
|
||||
pip install requests requests[socks] yt-dlp pyyaml ${{ matrix.python-packages }} pyinstaller
|
||||
python ./scripts/pyinstaller.py --os '${{ matrix.os }}' --arch '${{ matrix.architecture }}'
|
||||
python ./scripts/pyinstaller.py --label '${{ env.LABEL }}'
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
|
@ -127,7 +127,7 @@ def main():
|
||||
|
||||
extra = ""
|
||||
if util.EXECUTABLE:
|
||||
extra = " - Executable"
|
||||
extra = " - Executable ({})".format(version.__variant__)
|
||||
else:
|
||||
git_head = util.git_head()
|
||||
if git_head:
|
||||
|
@ -7,3 +7,4 @@
|
||||
# published by the Free Software Foundation.
|
||||
|
||||
__version__ = "1.27.0-dev"
|
||||
__variant__ = None
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
"""Build a standalone executable using PyInstaller"""
|
||||
|
||||
import PyInstaller.__main__
|
||||
import argparse
|
||||
import util
|
||||
import sys
|
||||
@ -13,18 +12,34 @@ def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-o", "--os")
|
||||
parser.add_argument("-a", "--arch")
|
||||
parser.add_argument("-l", "--label")
|
||||
parser.add_argument("-e", "--extension")
|
||||
parser.add_argument("-p", "--print", action="store_true")
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.label:
|
||||
label = args.label
|
||||
else:
|
||||
label = ""
|
||||
if args.os:
|
||||
os = args.os.partition("-")[0].lower()
|
||||
if os == "ubuntu":
|
||||
os = "linux"
|
||||
label += os
|
||||
if args.arch == "x86":
|
||||
label += "_x86"
|
||||
|
||||
if args.print:
|
||||
return print(label)
|
||||
|
||||
name = "gallery-dl"
|
||||
if args.os:
|
||||
name = "{}_{}".format(name, args.os.partition("-")[0].lower())
|
||||
if args.arch == "x86":
|
||||
name += "_x86"
|
||||
if label:
|
||||
name = "{}_{}".format(name, label)
|
||||
if args.extension:
|
||||
name = "{}.{}".format(name, args.extension.lower())
|
||||
|
||||
PyInstaller.__main__.run([
|
||||
import PyInstaller.__main__
|
||||
return PyInstaller.__main__.run([
|
||||
"--onefile",
|
||||
"--console",
|
||||
"--name", name,
|
||||
|
@ -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"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user