From 18be111dc17ca5e6abc21721feb942386c54b302 Mon Sep 17 00:00:00 2001 From: WorldTeacher Date: Wed, 5 Feb 2025 08:18:37 +0100 Subject: [PATCH] adding build file, updating gititgnore, adding check in backup to create archive if source is present --- .gitignore | 7 +++++-- build.py | 17 +++++++++++++++++ src/logic/backup.py | 2 +- 3 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 build.py diff --git a/.gitignore b/.gitignore index 5f11f53..2c3dce1 100644 --- a/.gitignore +++ b/.gitignore @@ -220,8 +220,11 @@ compile_commands.json **/tempCodeRunnerFile.py output/** - - +archive/** +.vscode +backup +database +report/** # Rust target/ uv.lock diff --git a/build.py b/build.py new file mode 100644 index 0000000..3270d8b --- /dev/null +++ b/build.py @@ -0,0 +1,17 @@ +import os +import shutil + + +def build_release(): + print(f"Building Application") + os.system( + f"uv run python -m nuitka --standalone --output-dir=build --include-package=PyQt6 --include-package=pygments --include-data-dir=./config=config --include-data-dir=./docs=docs --include-data-dir=./icons=icons --include-data-dir=./.venv/Lib/site-packages/PyQt6/=PyQt6 --windows-icon-from-ico=icons/icon.ico main.py" + ) + shutil.copytree( + ".venv/Lib/site-packages/PyQt6/", "build/main.dist/PyQt6/", dirs_exist_ok=True + ) + shutil.move("build/main.dist", "build/LibrarySystem") + + +if __name__ == "__main__": + build_release() diff --git a/src/logic/backup.py b/src/logic/backup.py index e782e5a..6fda0d7 100644 --- a/src/logic/backup.py +++ b/src/logic/backup.py @@ -29,7 +29,7 @@ class Backup: self.backup = True def createBackup(self): - if os.path.exists(self.archivePath): + if os.path.exists(self.archivePath) and os.path.exists(self.source_path): # copy the active database to the archive path, add _[date] day = datetime.datetime.now().strftime("%Y%m%d%H%M%S") # copy the active database to the archive path, add _[date]