Merge pull request #358 from arabcoders/dev
Some checks failed
Build WebView wrappers / build (amd64, ubuntu-latest) (push) Has been cancelled
Build WebView wrappers / build (amd64, windows-latest) (push) Has been cancelled
Build WebView wrappers / build (arm64, macos-latest) (push) Has been cancelled
Build WebView wrappers / build (arm64, ubuntu-latest) (push) Has been cancelled
Build WebView wrappers / build (arm64, windows-latest) (push) Has been cancelled

Update the pyinstaller build to include version number.
This commit is contained in:
Abdulmohsen 2025-08-01 18:11:58 +03:00 committed by GitHub
commit cc3057f432
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 30 additions and 7 deletions

1
.gitignore vendored
View file

@ -36,3 +36,4 @@ __pycache__
.idea
dist
build
version.txt

View file

@ -1,8 +1,24 @@
import importlib.util
import os
import platform
import sys
import tomllib
spec = importlib.util.spec_from_file_location("version", "./app/library/version.py")
ver = importlib.util.module_from_spec(spec)
spec.loader.exec_module(ver)
with open("version.txt", "w") as f:
f.write(f"""# UTF-8
# FileVersion: "{ver.APP_VERSION}"
# ProductVersion: "{ver.APP_VERSION}"
# FileDescription: "YTPTube build {ver.APP_COMMIT_SHA}"
# ProductName: "YTPTube"
# OriginalFilename: "ytptube.exe"
# InternalName: "YTPTube"
# Comments: "Built from {ver.APP_BRANCH} at {ver.APP_BUILD_DATE}"
""")
block_cipher = None
machine = platform.machine().lower()
@ -31,7 +47,7 @@ hidden = [
"engineio",
"engineio.async_drivers.aiohttp",
"socketio.async_drivers.aiohttp",
"app"
"app",
]
hidden = [f.replace("-", "_") for f in hidden]
@ -63,7 +79,8 @@ exe = EXE( # type: ignore # noqa: F821
debug=False,
strip=False,
upx=True,
console=False, # Turn on to True if you want a console window for debugging.
version="version.txt",
console=False, # Turn on to True if you want a console window for debugging.
icon="ui/public/favicon.ico",
onefile=True,
)

View file

@ -280,12 +280,14 @@ class Download:
self.started_time = int(time.time())
def mark_cancelled(*_):
cls._interrupted = True
cls.to_screen("[info] Interrupt received, exiting cleanly...")
raise SystemExit(130) # noqa: TRY301
if "posix" == os.name:
signal.signal(signal.SIGUSR1, mark_cancelled)
def mark_cancelled(*_) -> None:
cls._interrupted = True
cls.to_screen("[info] Interrupt received, exiting cleanly...")
raise SystemExit(130) # noqa: TRY301
signal.signal(signal.SIGUSR1, mark_cancelled)
if isinstance(self.info_dict, dict) and len(self.info_dict) > 1:
self.logger.debug(f"Downloading '{self.info.url}' using pre-info.")

View file

@ -963,6 +963,9 @@ class DownloadQueue(metaclass=Singleton):
if entry.info.status not in ("finished", "skip"):
entry.info.status = "error"
except Exception as e:
entry.info.status = "error"
entry.info.error = str(e)
finally:
if entry.info._id in self._active:
self._active.pop(entry.info._id, None)