Fix windows installer and add uninstaller.
This commit is contained in:
parent
867e057811
commit
cac357c403
7 changed files with 117 additions and 14 deletions
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -12,3 +12,11 @@ build/build-exe-config.json
|
||||||
install/*.exe
|
install/*.exe
|
||||||
|
|
||||||
*.pyo
|
*.pyo
|
||||||
|
|
||||||
|
*.spec
|
||||||
|
|
||||||
|
build/build-exe-pyinstaller-command.bat
|
||||||
|
|
||||||
|
build/build/BAPSicle/
|
||||||
|
|
||||||
|
build/output/
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"optionDest": "filenames",
|
"optionDest": "filenames",
|
||||||
"value": "../launch_standalone.py"
|
"value": "\\launch_standalone.py"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"optionDest": "onefile",
|
"optionDest": "onefile",
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"optionDest": "icon_file",
|
"optionDest": "icon_file",
|
||||||
"value": "\\icon.ico"
|
"value": "\\build\\icon.ico"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"optionDest": "name",
|
"optionDest": "name",
|
||||||
|
|
|
@ -3,8 +3,16 @@ pip install -r requirements.txt
|
||||||
pip install -r requirements-windows.txt
|
pip install -r requirements-windows.txt
|
||||||
pip install -e ..\
|
pip install -e ..\
|
||||||
|
|
||||||
|
: Generate the json config in case you wanted to use the gui to regenerate the command below manually.
|
||||||
python generate-build-exe-config.py
|
python generate-build-exe-config.py
|
||||||
|
|
||||||
auto-py-to-exe -c build-exe-config.json -o ../install
|
: auto-py-to-exe -c build-exe-config.json -o ../install
|
||||||
|
|
||||||
|
python build-exe.py
|
||||||
|
|
||||||
|
build-exe-pyinstaller-command.bat
|
||||||
|
|
||||||
|
del *.spec /q
|
||||||
|
|
||||||
|
echo "Output file should be located in 'output/' folder."
|
||||||
TIMEOUT 5
|
TIMEOUT 5
|
43
build/build-exe.py
Normal file
43
build/build-exe.py
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
file = open('build-exe-config.json', 'r')
|
||||||
|
config = json.loads(file.read())
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
cmd_str = "pyinstaller "
|
||||||
|
json_dests = ["icon_file", "clean_build"]
|
||||||
|
pyi_dests = ["icon", "clean"]
|
||||||
|
|
||||||
|
for option in config["pyinstallerOptions"]:
|
||||||
|
|
||||||
|
option_dest = option["optionDest"]
|
||||||
|
|
||||||
|
# The json is rather inconsistent :/
|
||||||
|
if option_dest in json_dests:
|
||||||
|
print("in")
|
||||||
|
option_dest = pyi_dests[json_dests.index(option_dest)]
|
||||||
|
|
||||||
|
option_dest = option_dest.replace("_", "-")
|
||||||
|
|
||||||
|
if option_dest == "datas":
|
||||||
|
cmd_str += '--add-data "' + option["value"] + '" '
|
||||||
|
elif option_dest == "filenames":
|
||||||
|
filename = option["value"]
|
||||||
|
elif option["value"] == True:
|
||||||
|
cmd_str += "--" + str(option_dest) + " "
|
||||||
|
elif option["value"] == False:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
cmd_str += "--" + str(option_dest) + ' "' + str(option["value"]) + '" '
|
||||||
|
|
||||||
|
|
||||||
|
command = open('build-exe-pyinstaller-command.bat', 'w')
|
||||||
|
|
||||||
|
if filename == "":
|
||||||
|
print("No filename data was found in json file.")
|
||||||
|
command.write("")
|
||||||
|
else:
|
||||||
|
command.write(cmd_str + ' --distpath "output/" --workpath "build/" "' + filename + '"')
|
||||||
|
|
||||||
|
command.close()
|
|
@ -9,10 +9,8 @@ config = json.loads(in_file.read())
|
||||||
in_file.close()
|
in_file.close()
|
||||||
|
|
||||||
for option in config["pyinstallerOptions"]:
|
for option in config["pyinstallerOptions"]:
|
||||||
if option["optionDest"] == "icon_file":
|
if option["optionDest"] in ["datas", "filenames", "icon_file"]:
|
||||||
option["value"] = dir_path + option["value"]
|
option["value"] = os.path.abspath(parent_path + option["value"])
|
||||||
if option["optionDest"] == "datas":
|
|
||||||
option["value"] = parent_path + option["value"]
|
|
||||||
|
|
||||||
out_file = open('build-exe-config.json', 'w')
|
out_file = open('build-exe-config.json', 'w')
|
||||||
out_file.write(json.dumps(config, indent=2))
|
out_file.write(json.dumps(config, indent=2))
|
||||||
|
|
|
@ -1,9 +1,44 @@
|
||||||
mkdir "C:\Program Files\BAPSicle"
|
set install_path="C:\Program Files\BAPSicle"
|
||||||
cd "C:\Program Files\BAPSicle\"
|
set exe_name="BAPSicle.exe"
|
||||||
mkdir state
|
set exe_path=%install_path%\\%exe_name%
|
||||||
|
set service_name="BAPSicle"
|
||||||
|
|
||||||
copy /Y "%~dp0\BAPSicle.exe" "BAPSicle.exe"
|
mkdir %install_path%
|
||||||
|
mkdir "%install_path%\state"
|
||||||
|
|
||||||
%~dp0nssm\nssm.exe remove BAPSicle confirm
|
|
||||||
%~dp0nssm\nssm.exe install BAPSicle .\BAPSicle.exe
|
cd %~dp0\nssm
|
||||||
TIMEOUT 5
|
nssm stop %service_name%
|
||||||
|
nssm remove %service_name% confirm
|
||||||
|
sc.exe delete %service_name%
|
||||||
|
|
||||||
|
cd %install_path%
|
||||||
|
|
||||||
|
|
||||||
|
copy /Y "%~dp0\uninstall.bat" .
|
||||||
|
copy /Y "%~dp0\..\build\output\%exe_name%" %exe_name%
|
||||||
|
|
||||||
|
mkdir nssm
|
||||||
|
cd nssm
|
||||||
|
copy /Y "%~dp0\nssm\nssm.exe" .
|
||||||
|
nssm install %service_name% %exe_path%
|
||||||
|
nssm set %service_name% AppDirectory %install_path%
|
||||||
|
nssm set %service_name% AppExit Default Restart
|
||||||
|
nssm set %service_name% AppStopMethodConsole 5000
|
||||||
|
nssm set %service_name% AppStopMethodWindow 5000
|
||||||
|
nssm set %service_name% AppStopMethodThreads 5000
|
||||||
|
nssm set %service_name% DisplayName "BAPSicle Server"
|
||||||
|
nssm set %service_name% Description "The next gen Broadcast and Presenting Suite server! Access settings on port 5000."
|
||||||
|
nssm set %service_name% ObjectName LocalSystem
|
||||||
|
nssm set %service_name% Start SERVICE_AUTO_START
|
||||||
|
nssm set %service_name% Type SERVICE_INTERACTIVE_PROCESS
|
||||||
|
|
||||||
|
: usefull tools are edit and dump:
|
||||||
|
|
||||||
|
: nssm edit %service_name%
|
||||||
|
: nssm dump %service_name%
|
||||||
|
nssm start %service_name%
|
||||||
|
|
||||||
|
timeout 4 /nobreak
|
||||||
|
|
||||||
|
explorer "http://localhost:5000/"
|
||||||
|
|
11
install/uninstall.bat
Normal file
11
install/uninstall.bat
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
set service_name="BAPSicle"
|
||||||
|
|
||||||
|
cd %~dp0\nssm
|
||||||
|
nssm stop %service_name%
|
||||||
|
nssm remove %service_name% confirm
|
||||||
|
sc.exe delete %service_name%
|
||||||
|
|
||||||
|
del "C:\Program Files\BAPSicle\" /q /s /f
|
||||||
|
|
||||||
|
PAUSE
|
Loading…
Reference in a new issue