✨ Version is correctly shown in PyInstaller running mode. Running the app from source code points to dev config dir (~/.config/tidal_dl_ng-dev).
This commit is contained in:
Generated
+1
-15
@@ -2053,20 +2053,6 @@ h2 = ["h2 (>=4,<5)"]
|
||||
socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"]
|
||||
zstd = ["zstandard (>=0.18.0)"]
|
||||
|
||||
[[package]]
|
||||
name = "usingversion"
|
||||
version = "0.1.2"
|
||||
description = "A package to make it easy for other packages to report their version."
|
||||
optional = false
|
||||
python-versions = ">=3.9,<4.0"
|
||||
files = [
|
||||
{file = "usingversion-0.1.2-py3-none-any.whl", hash = "sha256:9ed8256e68d0b169f00c70f64f9a74a2d668a575032c30b12b3d13a97512fbde"},
|
||||
{file = "usingversion-0.1.2.tar.gz", hash = "sha256:d254068f7080eaa6d28a7d602d27828da3bc1a8b3bc10911f5cbb9b46877e7c8"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
toml = ">=0.10.2,<0.11.0"
|
||||
|
||||
[[package]]
|
||||
name = "virtualenv"
|
||||
version = "20.25.1"
|
||||
@@ -2134,4 +2120,4 @@ gui = ["pyqtdarktheme", "pyside6"]
|
||||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = ">=3.10,<3.12"
|
||||
content-hash = "2db1405cc187edc07636904cbfcba15f7e4ae5f7c3f96fcfebc239c7f84f79cc"
|
||||
content-hash = "44c015a2d93d1698fdc1236f88ea6bd74b60bc753863439703edbe0ff1c1f057"
|
||||
|
||||
+2
-2
@@ -40,7 +40,7 @@ pyside6 = {version = "^6.6.2", optional = true}
|
||||
pyqtdarktheme = {version = "^2.1.0", optional = true}
|
||||
mpegdash = "^0.4.0"
|
||||
rich = "^13.7.1"
|
||||
usingversion = "^0.1.2"
|
||||
toml = "^0.10.2"
|
||||
|
||||
[tool.poetry.extras]
|
||||
gui = ["pyside6", "pyqtdarktheme"]
|
||||
@@ -171,7 +171,7 @@ profile = "black"
|
||||
multi_line_output = 3
|
||||
indent = 4
|
||||
color_output = true
|
||||
known_third_party = ["Crypto", "PySide6", "coloredlogs", "dataclasses_json", "ffmpeg", "m3u8", "mpegdash", "mutagen", "pathvalidate", "requests", "rich", "tidalapi", "typer", "usingversion"]
|
||||
known_third_party = ["Crypto", "PySide6", "coloredlogs", "dataclasses_json", "ffmpeg", "m3u8", "mpegdash", "mutagen", "pathvalidate", "requests", "rich", "tidalapi", "toml", "typer"]
|
||||
|
||||
[tool.mypy]
|
||||
# https://mypy.readthedocs.io/en/latest/config_file.html#using-a-pyproject-toml-file
|
||||
|
||||
+46
-3
@@ -1,5 +1,48 @@
|
||||
#!/usr/bin/env python
|
||||
from usingversion import getattr_with_version
|
||||
import importlib.metadata
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
__getattr__ = getattr_with_version("mypackage", __file__, __name__)
|
||||
__name_display__ = __package__ or __name__
|
||||
import toml
|
||||
|
||||
|
||||
def get_version_app() -> str:
|
||||
file_path: Path = Path(__file__)
|
||||
|
||||
paths: [Path] = [
|
||||
file_path.parent,
|
||||
file_path.parent.parent,
|
||||
file_path.parent.parent.parent,
|
||||
]
|
||||
version: str = "0.0.0"
|
||||
|
||||
for pyproject_toml_dir in paths:
|
||||
pyproject_toml_file: Path = pyproject_toml_dir / "pyproject.toml"
|
||||
|
||||
if pyproject_toml_file.exists() and pyproject_toml_file.is_file():
|
||||
package_version: str = toml.load(pyproject_toml_file)["tool"]["poetry"]["version"]
|
||||
|
||||
version = package_version
|
||||
|
||||
break
|
||||
|
||||
return version
|
||||
|
||||
|
||||
def get_name_app() -> str:
|
||||
name_app: str = __package__ or __name__
|
||||
|
||||
# Check if package is running from source code == dev mode
|
||||
# If package is not running in PyInstaller environment.
|
||||
if getattr(sys, "frozen", True) and not hasattr(sys, "_MEIPASS"):
|
||||
try:
|
||||
importlib.metadata.version(name_app)
|
||||
except:
|
||||
# If package is not installed
|
||||
name_app = name_app + "-dev"
|
||||
|
||||
return name_app
|
||||
|
||||
|
||||
__name_display__ = get_name_app()
|
||||
__version__ = get_version_app()
|
||||
|
||||
@@ -5,7 +5,7 @@ from pathlib import Path
|
||||
from PySide6 import QtCore, QtGui, QtWidgets
|
||||
from tidalapi import Quality as QualityAudio
|
||||
|
||||
from tidal_dl_ng import version
|
||||
from tidal_dl_ng import __version__
|
||||
from tidal_dl_ng.config import Settings
|
||||
from tidal_dl_ng.constants import CoverDimensions, QualityVideo, SkipExisting
|
||||
from tidal_dl_ng.helper.path import is_installed_ffmpeg
|
||||
@@ -30,7 +30,7 @@ class DialogVersion(QtWidgets.QDialog):
|
||||
# Run the .setupUi() method to show the GUI
|
||||
self.ui.setupUi(self)
|
||||
# Set the version.
|
||||
self.ui.l_version.setText("v" + version)
|
||||
self.ui.l_version.setText("v" + __version__)
|
||||
# Show
|
||||
self.exec()
|
||||
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ from collections.abc import Callable
|
||||
|
||||
from requests.exceptions import HTTPError
|
||||
|
||||
from tidal_dl_ng import version
|
||||
from tidal_dl_ng import __version__
|
||||
from tidal_dl_ng.dialog import DialogLogin, DialogPreferences, DialogVersion
|
||||
from tidal_dl_ng.helper.path import get_format_template
|
||||
from tidal_dl_ng.helper.tidal import (
|
||||
@@ -671,7 +671,7 @@ def gui_activate(tidal: Tidal | None = None):
|
||||
# Make sure Pyinstaller icons are still grouped
|
||||
if not sys.argv[0].endswith(".exe"):
|
||||
# Arbitrary string
|
||||
my_app_id: str = "exislow.tidal.dl-ng." + version
|
||||
my_app_id: str = "exislow.tidal.dl-ng." + __version__
|
||||
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(my_app_id)
|
||||
|
||||
window = MainWindow(tidal=tidal)
|
||||
|
||||
Reference in New Issue
Block a user