Skip to content

Commit

Permalink
Fix about using deprecated pkg_resources, fixes #30
Browse files Browse the repository at this point in the history
  • Loading branch information
C0rn3j committed Oct 4, 2024
1 parent 71340af commit 045de59
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions scc/gui/aboutdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,22 @@ def setup_widgets(self) -> None:
Editor.setup_widgets(self)

app_ver = "(unknown version)"
import pkg_resources
import importlib.metadata
import importlib.resources

import scc
sccontroller_module = pkg_resources.require("sccontroller")[0]
if sccontroller_module.location is not None:
if scc.__file__.startswith(sccontroller_module.location):
app_ver = "v" + sccontroller_module.version
sccontroller_version = importlib.metadata.version("sccontroller")
sccontroller_module = importlib.resources.files("scc")
if sccontroller_module is not None:
if scc.__file__.startswith(str(sccontroller_module)):
app_ver = "v" + sccontroller_version

else:
print(
"Could not get version, locations possibly could not match.",
f"scc.__file__:{scc.__file__}",
f"sccontroller_module.location: {sccontroller_module.location}",
f"sccontroller_module.version: {sccontroller_module.version}",
f"sccontroller_module: {sccontroller_module}")
f"sccontroller_module: {sccontroller_module}",
f"sccontroller_version: {sccontroller_version}")
# Display version in UI
self.builder.get_object("lblVersion").set_label(app_ver)

Expand Down

0 comments on commit 045de59

Please sign in to comment.