Added more comments to windows script

This commit is contained in:
Veronica K. B. Olsen
2020-10-17 01:05:49 +02:00
parent 70086f5ca6
commit 115cef3ffb
+19 -5
View File
@@ -1,5 +1,18 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- 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-<version>.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 nw
import os import os
@@ -26,14 +39,14 @@ longOpt = [
] ]
helpMsg = ( helpMsg = (
"\n" "\n"
"novelWriter Install Script\n" "novelWriter Install Script for Windows\n"
"\n" "\n"
"Usage:\n" "Usage:\n"
" -h, --help Print this message.\n" " -h, --help Print this message.\n"
" --pip Install dependecies first.\n" " --pip Install dependecies first.\n"
" --onefile Create a single executable file.\n" " --onefile Create a single executable file.\n"
" --setup Make Inno Setup 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" " -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" " run it from command line with the debug options. Please check the\n"
" novelWriter --help output for details.\n" " novelWriter --help output for details.\n"
@@ -111,8 +124,10 @@ instOpt = [
"--exclude-module=PyQt5.QtSerialPort", "--exclude-module=PyQt5.QtSerialPort",
"--exclude-module=PyQt5.QtSql", "--exclude-module=PyQt5.QtSql",
] ]
if buildWindowed: if buildWindowed:
instOpt.append("--windowed") instOpt.append("--windowed")
if oneFile and not makeSetup: if oneFile and not makeSetup:
instOpt.append("--onefile") instOpt.append("--onefile")
else: else:
@@ -124,6 +139,7 @@ import PyInstaller.__main__ # noqa: E402
PyInstaller.__main__.run(instOpt) PyInstaller.__main__.run(instOpt)
if not oneFile: if not oneFile:
# These dll files are not nee3ded, and take up a fair bit of space.
delIfExists = [ delIfExists = [
"Qt5DBus.dll", "Qt5Network.dll", "Qt5Qml.dll", "Qt5QmlModels.dll", "Qt5Quick.dll", "Qt5DBus.dll", "Qt5Network.dll", "Qt5Qml.dll", "Qt5QmlModels.dll", "Qt5Quick.dll",
"Qt5Quick3D.dll", "Qt5Quick3DAssetImport.dll", "Qt5Quick3DRender.dll", "Qt5Quick3D.dll", "Qt5Quick3DAssetImport.dll", "Qt5Quick3DRender.dll",
@@ -168,9 +184,7 @@ if makeSetup:
outFile.write(issData) outFile.write(issData)
try: try:
subprocess.call( subprocess.call([innoSetup, "setup.iss"])
[innoSetup, "setup.iss"]
)
except Exception as e: except Exception as e:
print("Failed with error:") print("Failed with error:")
print(str(e)) print(str(e))