This commit is contained in:
2025-01-09 15:15:18 +01:00
parent 6316fc72ab
commit e915b47dda
7 changed files with 123 additions and 80 deletions

View File

@@ -9,3 +9,6 @@ replace = __version__ = "{new_version}"
[bumpversion:file:pyproject.toml] [bumpversion:file:pyproject.toml]
search = version = "{current_version}" search = version = "{current_version}"
replace = version = "{new_version}" replace = version = "{new_version}"
[bumpversion:file:.version]
search = {current_version}
replace = {new_version}

0
.version Normal file
View File

121
.vscode/tasks.json vendored
View File

@@ -2,26 +2,13 @@
"version": "2.0.0", "version": "2.0.0",
"tasks": [ "tasks": [
{ {
"label": "Build LibrarySystem (Debug)", "label": "Build New Release",
"type": "shell", "type": "shell",
"command": "pyinstaller", "dependsOn": [
"args": [ "Build LibrarySystem (Release)",
"--noconfirm", "Build LibrarySystem (Debug)"
"--onedir",
"--console",
"--icon",
"'${config:ApplicationIconPath}'",
"--name",
"LibrarySystem-debug",
"--contents-directory",
".",
"--clean",
"--add-data",
"'${config:configPath};config/'",
"--add-data",
"'${config:iconsPath};icons/'",
"'${workspaceFolder}/main_dev.py'"
], ],
"command": "cmd",
"group": { "group": {
"kind": "build", "kind": "build",
"isDefault": true "isDefault": true
@@ -32,28 +19,27 @@
"focus": false "focus": false
}, },
// "dependsOn": "Compress dist Folder Debug", // "dependsOn": "Compress dist Folder Debug",
"problemMatcher": "$pyinstaller" "problemMatcher": "$python"
}, },
{ {
"label": "Build LibrarySystem (Release)", "label": "Build LibrarySystem (Debug)",
"type": "shell", "type": "shell",
"command": "pyinstaller", "command": "uv",
"args": [ "args": [
"--noconfirm", "run",
"--onedir", "python",
"--windowed", "-m",
"--name", "nuitka",
"LibrarySystem", "--standalone",
"--contents-directory", "--output-dir=dist",
".", "--include-package=PyQt6",
"--clean", "--include-package=pygments",
"--add-data", "--include-data-dir=./config=config",
"'${config:configPath};config/'", "--include-data-dir=./docs=docs",
"--add-data", "--include-data-dir=./icons=icons",
"'${config:iconsPath};icons/'", "--include-data-dir=./.venv/Lib/site-packages/PyQt6/Qt6/plugins=PyQt6/Qt/plugins",
"--icon", "--windows-icon-from-ico=icons/icon.ico",
"'${config:ApplicationIconPath}'", "main_dev.py"
"'${workspaceFolder}/main.py'"
], ],
"group": { "group": {
"kind": "build", "kind": "build",
@@ -64,8 +50,39 @@
"panel": "new", "panel": "new",
"focus": false "focus": false
}, },
"dependsOn": "Compress dist Folder Release", // "dependsOn": "Compress dist Folder Debug",
"problemMatcher": "$pyinstaller" "problemMatcher": "$python"
},
{
"label": "Build LibrarySystem (Release)",
"type": "shell",
"command": "uv",
"args": [
"run",
"python",
"-m",
"nuitka",
"--standalone",
"--output-dir=dist",
"--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/Qt6/plugins=PyQt6/Qt/plugins",
"--windows-icon-from-ico=icons/icon.ico",
"main.py"
],
"group": {
"kind": "build",
"isDefault": false
},
"presentation": {
"reveal": "always",
"panel": "new",
"focus": false
},
"problemMatcher": "$python"
}, },
{ {
"label": "Run LibrarySystem (live)", "label": "Run LibrarySystem (live)",
@@ -73,39 +90,13 @@
"command": "c:/Users/aky547/GitHub/LibrarySystem/.venv/Scripts/python.exe", "command": "c:/Users/aky547/GitHub/LibrarySystem/.venv/Scripts/python.exe",
"args": [ "args": [
"'c:/Users/aky547/GitHub/LibrarySystem/main_dev.py'", "'c:/Users/aky547/GitHub/LibrarySystem/main_dev.py'",
"--ic-logging"
], ],
"group": { "group": {
"kind": "test", "kind": "test",
"isDefault": true "isDefault": true
}, },
"problemMatcher": "$python" "problemMatcher": "$python"
},
{
"label": "Compress dist Folder Debug",
"type": "shell",
"command": "Compress-Archive",
"args": [
"-Path",
"${workspaceFolder}/dist/LibrarySystem-debug/",
"-DestinationPath",
"${workspaceFolder}/output/LibrarySystem-debug.zip",
],
"group": "build",
"presentation": "panel"
},
{
"label": "Compress dist Folder Release",
"type": "shell",
"command": "Compress-Archive",
"args": [
"-Path",
"${workspaceFolder}/dist/LibrarySystem/",
"-DestinationPath",
"${workspaceFolder}/output/LibrarySystem.zip",
],
"group": "build",
"presentation": "panel"
} }
] ]
} }

View File

@@ -1,15 +1,4 @@
# from src.ui.main_ui import launch from src.ui.main_ui import launch
from src.updater import Update
import os
if __name__ == "__main__": if __name__ == "__main__":
Update() launch("--debug")
with open("config/.updater", "r") as f:
contents = f.read().splitlines()
command = [line for line in contents if "command" in line][0].split(":")[1]
if "~" in command:
command = command.replace("~", str(os.getcwd()))
os.system(command)
# launch("--debug")

View File

@@ -4,7 +4,9 @@ version = "0.2.0"
description = "Add your description here" description = "Add your description here"
readme = "README.md" readme = "README.md"
requires-python = ">=3.12" requires-python = ">=3.12"
dependencies = [] dependencies = [
"loguru>=0.7.3",
]
[dependency-groups] [dependency-groups]
dev = [ dev = [

23
setup.py Normal file
View File

@@ -0,0 +1,23 @@
import os
with open("pyproject.toml", "r") as file:
lines = file.readlines()
for line in lines:
if "name" in line:
name = line.split("=")[1].strip().replace('"', "")
break
with open(".version", "r") as file:
version = file.read().strip()
def rename_folders():
for folder in os.listdir("dist"):
if folder.endswith(".dist"):
if "-dev" in folder:
os.rename(f"dist/{folder}", f"dist/{name}-dev")
else:
os.rename(f"dist/{folder}", f"dist/{name}-{version}")
if __name__ == "__main__":
rename_folders()

37
uv.lock generated
View File

@@ -34,10 +34,22 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/7c/fc/6a8cb64e5f0324877d503c854da15d76c1e50eb722e320b15345c4d0c6de/cffi-1.17.1-cp313-cp313-win_amd64.whl", hash = "sha256:f6a16c31041f09ead72d69f583767292f750d24913dadacf5756b966aacb3f1a", size = 182009 }, { url = "https://files.pythonhosted.org/packages/7c/fc/6a8cb64e5f0324877d503c854da15d76c1e50eb722e320b15345c4d0c6de/cffi-1.17.1-cp313-cp313-win_amd64.whl", hash = "sha256:f6a16c31041f09ead72d69f583767292f750d24913dadacf5756b966aacb3f1a", size = 182009 },
] ]
[[package]]
name = "colorama"
version = "0.4.6"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697 }
wheels = [
{ url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335 },
]
[[package]] [[package]]
name = "librarysystem" name = "librarysystem"
version = "0.1.0" version = "0.2.0"
source = { virtual = "." } source = { virtual = "." }
dependencies = [
{ name = "loguru" },
]
[package.dev-dependencies] [package.dev-dependencies]
dev = [ dev = [
@@ -45,10 +57,24 @@ dev = [
] ]
[package.metadata] [package.metadata]
requires-dist = [{ name = "loguru", specifier = ">=0.7.3" }]
[package.metadata.requires-dev] [package.metadata.requires-dev]
dev = [{ name = "nuitka", specifier = ">=2.5.9" }] dev = [{ name = "nuitka", specifier = ">=2.5.9" }]
[[package]]
name = "loguru"
version = "0.7.3"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "colorama", marker = "sys_platform == 'win32'" },
{ name = "win32-setctime", marker = "sys_platform == 'win32'" },
]
sdist = { url = "https://files.pythonhosted.org/packages/3a/05/a1dae3dffd1116099471c643b8924f5aa6524411dc6c63fdae648c4f1aca/loguru-0.7.3.tar.gz", hash = "sha256:19480589e77d47b8d85b2c827ad95d49bf31b0dcde16593892eb51dd18706eb6", size = 63559 }
wheels = [
{ url = "https://files.pythonhosted.org/packages/0c/29/0348de65b8cc732daa3e33e67806420b2ae89bdce2b04af740289c5c6c8c/loguru-0.7.3-py3-none-any.whl", hash = "sha256:31a33c10c8e1e10422bfd431aeb5d351c7cf7fa671e3c4df004162264b28220c", size = 61595 },
]
[[package]] [[package]]
name = "nuitka" name = "nuitka"
version = "2.5.9" version = "2.5.9"
@@ -77,6 +103,15 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/13/a3/a812df4e2dd5696d1f351d58b8fe16a405b234ad2886a0dab9183fb78109/pycparser-2.22-py3-none-any.whl", hash = "sha256:c3702b6d3dd8c7abc1afa565d7e63d53a1d0bd86cdc24edd75470f4de499cfcc", size = 117552 }, { url = "https://files.pythonhosted.org/packages/13/a3/a812df4e2dd5696d1f351d58b8fe16a405b234ad2886a0dab9183fb78109/pycparser-2.22-py3-none-any.whl", hash = "sha256:c3702b6d3dd8c7abc1afa565d7e63d53a1d0bd86cdc24edd75470f4de499cfcc", size = 117552 },
] ]
[[package]]
name = "win32-setctime"
version = "1.2.0"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/b3/8f/705086c9d734d3b663af0e9bb3d4de6578d08f46b1b101c2442fd9aecaa2/win32_setctime-1.2.0.tar.gz", hash = "sha256:ae1fdf948f5640aae05c511ade119313fb6a30d7eabe25fef9764dca5873c4c0", size = 4867 }
wheels = [
{ url = "https://files.pythonhosted.org/packages/e1/07/c6fe3ad3e685340704d314d765b7912993bcb8dc198f0e7a89382d37974b/win32_setctime-1.2.0-py3-none-any.whl", hash = "sha256:95d644c4e708aba81dc3704a116d8cbc974d70b3bdb8be1d150e36be6e9d1390", size = 4083 },
]
[[package]] [[package]]
name = "zstandard" name = "zstandard"
version = "0.23.0" version = "0.23.0"