Skip to content

Commit

Permalink
Merge pull request #18 from nodedge/feature/pyinstaller
Browse files Browse the repository at this point in the history
Create a script to deploy nodedge from pyinstaller.
  • Loading branch information
nodedge committed Nov 20, 2022
2 parents 6127031 + 792d5c2 commit 90ac05e
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 3 deletions.
27 changes: 27 additions & 0 deletions deploy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import os

app_name = "nodedge"
path = r".\nodedge\__main__.py"
qss_src = r".\nodedge\qss"
qss_dest = r".\nodedge\qss"
resources_src = r".\nodedge\resources"
resources_dest = r".\nodedge\resources"
examples_src = r".\examples"
version_file_path = r".\file_version_info.txt"
nodedge_logo = r".\nodedge\resources\Icon.ico"

command = (
f"pyinstaller "
f'--name="{app_name}" '
f"{path} "
f'--add-data="{qss_src}{os.pathsep}{qss_dest}" '
f'--add-data="{resources_src}{os.pathsep}{resources_dest}" '
f'--add-data="{examples_src}{os.pathsep}{examples_src}" '
f'--version-file="{version_file_path}" '
f"--onefile "
f"--windowed "
f"--noconfirm "
f"--icon {nodedge_logo}"
)

os.system(command)
43 changes: 43 additions & 0 deletions file_version_info.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# UTF-8
#
# For more details about fixed file info 'ffi' see:
# http://msdn.microsoft.com/en-us/library/ms646997.aspx
VSVersionInfo(
ffi=FixedFileInfo(
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
# Set not needed items to zero 0.
filevers=(0, 2, 4, 0),
prodvers=(0, 0, 0, 0),
# Contains a bitmask that specifies the valid bits 'flags'r
mask=0x3f,
# Contains a bitmask that specifies the Boolean attributes of the file.
flags=0x0,
# The operating system for which this file was designed.
# 0x4 - NT and there is no need to change it.
OS=0x40004,
# The general type of file.
# 0x1 - the file is an application.
fileType=0x1,
# The function of the file.
# 0x0 - the function is not defined for this fileType
subtype=0x0,
# Creation date and time stamp.
date=(0, 0)
),
kids=[
StringFileInfo(
[
StringTable(
'040904B0',
[StringStruct('CompanyName', 'Nodedge'),
StringStruct('FileDescription', 'Nodedge'),
StringStruct('FileVersion', '0.2.4'),
StringStruct('InternalName', 'nodedge'),
StringStruct('LegalCopyright', ''),
StringStruct('OriginalFilename', 'nodedge.exe'),
StringStruct('ProductName', ''),
StringStruct('ProductVersion', '')])
]),
VarFileInfo([VarStruct('Translation', [1033, 1200])])
]
)
4 changes: 1 addition & 3 deletions nodedge/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ def main():

window = MdiWindow()
window.show()
window.openFile(
f"{os.path.dirname(__file__)}/../examples/calculator/calculator.json"
)
window.openFile(f"{os.path.dirname(__file__)}/examples/calculator/calculator.json")
try:
sys.exit(app.exec())
except Exception as e:
Expand Down
1 change: 1 addition & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ bump2version
pillow
pre-commit
wheel
pyinstaller

0 comments on commit 90ac05e

Please sign in to comment.