Build binary on linux

This commit is contained in:
Veronica Berglyd Olsen
2025-01-16 19:55:50 +01:00
parent b9602da177
commit 931863d4ee
5 changed files with 79 additions and 4 deletions
+1
View File
@@ -1,6 +1,7 @@
# Setup/Install
/MANIFEST
/build/
/build_*/
/deploy/
/dist/
/dist_*/
+4 -4
View File
@@ -109,10 +109,10 @@ class Config:
self._appPath = Path(__file__).parent.absolute()
self._appRoot = self._appPath.parent
if self._appRoot.is_file():
# novelWriter is packaged as a single file
self._appRoot = self._appRoot.parent
self._appPath = self._appRoot
if getattr(sys, "frozen", False):
# novelWriter is packaged as an exe
self._appPath = Path(__file__).parent.parent.absolute()
self._appRoot = self._appPath
# Runtime Settings and Variables
self._hasError = False # True if the config class encountered an error
+6
View File
@@ -1509,6 +1509,12 @@ if __name__ == "__main__":
)
cmdBuildSetupExe.set_defaults(func=makeWindowsEmbedded)
# Build Binary
cmdBuildBinary = parsers.add_parser(
"build-bin", help="Build a standalone binary package."
)
cmdBuildBinary.set_defaults(func=utils.binary_dist.main)
# Build Clean
cmdBuildClean = parsers.add_parser(
"build-clean", help="Recursively delete all build folders."
+43
View File
@@ -0,0 +1,43 @@
"""
novelWriter Binary Dist Tools
===============================
This file is a part of novelWriter
Copyright (C) 2025 Veronica Berglyd Olsen and novelWriter contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
from __future__ import annotations
import argparse
import PyInstaller.__main__
def runPyinstaller() -> None:
"""Run the pyinstaller."""
build = ["novelWriter.py", "--clean", "--windowed", "--onedir", "--noconfirm"]
build += ["--name", "novelwriter"]
build += ["--workpath", "build_bin"]
build += ["--distpath", "dist_bin"]
build += ["--hidden-import", "pyenchant"]
build += ["--add-data", "novelwriter/assets:assets"]
PyInstaller.__main__.run(build)
return
def main(args: argparse.Namespace) -> None:
"""Entry point function."""
runPyinstaller()
return
+25
View File
@@ -0,0 +1,25 @@
"""
novelWriter Common Utils
==========================
This file is a part of novelWriter
Copyright (C) 2025 Veronica Berglyd Olsen and novelWriter contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
from __future__ import annotations
from pathlib import Path
ROOT_DIR = Path(__file__).parent.parent