diff --git a/Makefile b/Makefile index 17e4d82b..5a98fcd3 100644 --- a/Makefile +++ b/Makefile @@ -23,11 +23,14 @@ release: man completion docs/supportedsites.rst test: scripts/run_tests.sh +executable: + scripts/pyinstaller.py + completion: gallery-dl.bash_completion man: gallery-dl.1 gallery-dl.conf.5 -.PHONY: all clean install release test completion man +.PHONY: all clean install release test executable completion man docs/supportedsites.rst: gallery_dl/*/*.py scripts/supportedsites.py $(PYTHON) scripts/supportedsites.py diff --git a/scripts/hook-gallery_dl.py b/scripts/hook-gallery_dl.py new file mode 100644 index 00000000..d5490198 --- /dev/null +++ b/scripts/hook-gallery_dl.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- + +from gallery_dl import extractor, downloader, postprocessor + +hiddenimports = [ + package.__name__ + "." + module + for package in (extractor, downloader, postprocessor) + for module in package.modules +] diff --git a/scripts/pyinstaller.py b/scripts/pyinstaller.py new file mode 100755 index 00000000..879ae509 --- /dev/null +++ b/scripts/pyinstaller.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +"""Build a standalone executable using PyInstaller""" + +import PyInstaller.__main__ +import util + +PyInstaller.__main__.run([ + "--onefile", + "--console", + "--name", "gallery-dl." + ("exe" if PyInstaller.is_win else "bin"), + "--additional-hooks-dir", util.path("scripts"), + "--distpath", util.path("dist"), + "--workpath", util.path("build"), + "--specpath", util.path("build"), + util.path("gallery_dl", "__main__.py"), +])