diff --git a/make_windows.py b/make_windows.py index c64b79d0..27e8c112 100644 --- a/make_windows.py +++ b/make_windows.py @@ -1,5 +1,18 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +""" +This script will either build: + * A single file executable named dist/novelWriter.exe. This is a quite + slow option, and the file is fairly big. Option --onefile + * A single directory named dist/novelWriter with a novelWriter.exe, and + all dependecies included. This is the default. + * The latter can be combined with a build stage of a setup.exe file + named setup-novelwriter-.exe. Option --setup. + +In addition, providing the --pip flag will cause the script to try to +install all dependencies needed for runing the build, and for running +novelWriter itself. +""" import nw import os @@ -26,14 +39,14 @@ longOpt = [ ] helpMsg = ( "\n" - "novelWriter Install Script\n" + "novelWriter Install Script for Windows\n" "\n" "Usage:\n" " -h, --help Print this message.\n" " --pip Install dependecies first.\n" " --onefile Create a single executable file.\n" " --setup Make Inno Setup file.\n" - " --inno= Path to the Inoo Setup exec.\n" + " --inno= Path to the Inno Setup exec.\n" " -d, --debug Build novelWriter for debugging. To debug novelwriter after build,\n" " run it from command line with the debug options. Please check the\n" " novelWriter --help output for details.\n" @@ -111,8 +124,10 @@ instOpt = [ "--exclude-module=PyQt5.QtSerialPort", "--exclude-module=PyQt5.QtSql", ] + if buildWindowed: instOpt.append("--windowed") + if oneFile and not makeSetup: instOpt.append("--onefile") else: @@ -124,6 +139,7 @@ import PyInstaller.__main__ # noqa: E402 PyInstaller.__main__.run(instOpt) if not oneFile: + # These dll files are not nee3ded, and take up a fair bit of space. delIfExists = [ "Qt5DBus.dll", "Qt5Network.dll", "Qt5Qml.dll", "Qt5QmlModels.dll", "Qt5Quick.dll", "Qt5Quick3D.dll", "Qt5Quick3DAssetImport.dll", "Qt5Quick3DRender.dll", @@ -168,9 +184,7 @@ if makeSetup: outFile.write(issData) try: - subprocess.call( - [innoSetup, "setup.iss"] - ) + subprocess.call([innoSetup, "setup.iss"]) except Exception as e: print("Failed with error:") print(str(e))