2019-04-16 18:23:46 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
"""Build a standalone executable using PyInstaller"""
|
|
|
|
|
|
|
|
import PyInstaller.__main__
|
2024-03-08 23:13:53 +01:00
|
|
|
import argparse
|
2019-04-16 18:23:46 +02:00
|
|
|
import util
|
2024-03-08 23:13:53 +01:00
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
parser.add_argument("-o", "--os")
|
|
|
|
parser.add_argument("-a", "--arch")
|
2024-03-11 21:35:50 +01:00
|
|
|
parser.add_argument("-e", "--extension")
|
2024-03-08 23:13:53 +01:00
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
name = "gallery-dl"
|
|
|
|
if args.os:
|
|
|
|
name = "{}_{}".format(name, args.os.partition("-")[0].lower())
|
|
|
|
if args.arch == "x86":
|
|
|
|
name += "_x86"
|
2024-03-11 21:35:50 +01:00
|
|
|
if args.extension:
|
|
|
|
name = "{}.{}".format(name, args.extension.lower())
|
2024-03-08 23:13:53 +01:00
|
|
|
|
|
|
|
PyInstaller.__main__.run([
|
|
|
|
"--onefile",
|
|
|
|
"--console",
|
|
|
|
"--name", name,
|
|
|
|
"--additional-hooks-dir", util.path("scripts"),
|
|
|
|
"--distpath", util.path("dist"),
|
|
|
|
"--workpath", util.path("build"),
|
|
|
|
"--specpath", util.path("build"),
|
|
|
|
util.path("gallery_dl", "__main__.py"),
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
sys.exit(main())
|