Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pr/160'
Browse files Browse the repository at this point in the history
* origin/pr/160:
  Remove deprecated pkg_resources, replace with importlib
  • Loading branch information
marmarek committed Jun 27, 2024
2 parents 3891a14 + 1a402fe commit f48ac4d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions qrexec/tools/qrexec_policy_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import argparse
import asyncio

import pkg_resources
import importlib.resources

# pylint: disable=import-error,wrong-import-position
import gi
Expand Down Expand Up @@ -322,9 +322,9 @@ def can_perform_action(self):

class RPCConfirmationWindow:
# pylint: disable=too-few-public-methods,too-many-instance-attributes
_source_file = pkg_resources.resource_filename(
"qrexec", os.path.join("glade", "RPCConfirmationWindow.glade")
)
_source_file_ref = importlib.resources.files("qrexec").joinpath(
os.path.join("glade", "RPCConfirmationWindow.glade"))

_source_id = {
"window": "RPCConfirmationWindow",
"ok": "okButton",
Expand Down Expand Up @@ -429,7 +429,8 @@ def __init__(
sanitize_service_name(source, assert_sanitized=True)

self._gtk_builder = Gtk.Builder()
self._gtk_builder.add_from_file(self._source_file)
with importlib.resources.as_file(self._source_file_ref) as path:
self._gtk_builder.add_from_file(str(path))
self._rpc_window = self._gtk_builder.get_object(
self._source_id["window"]
)
Expand Down

0 comments on commit f48ac4d

Please sign in to comment.