diff mbox series

bitbake: fix deprecated threading.Thread.setDaemon

Message ID 20230121215200.2853367-1-tim.orling@konsulko.com
State Accepted, archived
Commit 323f6ce27a1bfd7159e72f29684674ff495dedee
Headers show
Series bitbake: fix deprecated threading.Thread.setDaemon | expand

Commit Message

Tim Orling Jan. 21, 2023, 9:52 p.m. UTC
Deprecated in Python 3.10:
https://docs.python.org/3/whatsnew/3.10.html#deprecated
https://github.com/python/cpython/pull/25174

Fixes warnings like:

...bitbake/lib/bb/ui/uievent.py:68: DeprecationWarning: setDaemon() is
deprecated, set the daemon attribute instead
  self.t.setDaemon(True)

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
---
 lib/bb/ui/taskexp.py                             | 2 +-
 lib/bb/ui/uievent.py                             | 2 +-
 lib/toaster/orm/management/commands/lsupdates.py | 2 +-
 lib/toaster/tests/commands/test_runbuilds.py     | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/lib/bb/ui/taskexp.py b/lib/bb/ui/taskexp.py
index c00eaf663..bedfd69b0 100644
--- a/lib/bb/ui/taskexp.py
+++ b/lib/bb/ui/taskexp.py
@@ -177,7 +177,7 @@  class gtkthread(threading.Thread):
     quit = threading.Event()
     def __init__(self, shutdown):
         threading.Thread.__init__(self)
-        self.setDaemon(True)
+        self.daemon = True
         self.shutdown = shutdown
         if not Gtk.init_check()[0]:
             sys.stderr.write("Gtk+ init failed. Make sure DISPLAY variable is set.\n")
diff --git a/lib/bb/ui/uievent.py b/lib/bb/ui/uievent.py
index adbe69893..c2f830d53 100644
--- a/lib/bb/ui/uievent.py
+++ b/lib/bb/ui/uievent.py
@@ -65,7 +65,7 @@  class BBUIEventQueue:
         self.server = server
 
         self.t = threading.Thread()
-        self.t.setDaemon(True)
+        self.t.daemon = True
         self.t.run = self.startCallbackHandler
         self.t.start()
 
diff --git a/lib/toaster/orm/management/commands/lsupdates.py b/lib/toaster/orm/management/commands/lsupdates.py
index eb097555e..6d64830eb 100644
--- a/lib/toaster/orm/management/commands/lsupdates.py
+++ b/lib/toaster/orm/management/commands/lsupdates.py
@@ -40,7 +40,7 @@  class Spinner(threading.Thread):
     """ A simple progress spinner to indicate download/parsing is happening"""
     def __init__(self, *args, **kwargs):
         super(Spinner, self).__init__(*args, **kwargs)
-        self.setDaemon(True)
+        self.daemon = True
         self.signal = True
 
     def run(self):
diff --git a/lib/toaster/tests/commands/test_runbuilds.py b/lib/toaster/tests/commands/test_runbuilds.py
index e223b95fc..c77d6cf49 100644
--- a/lib/toaster/tests/commands/test_runbuilds.py
+++ b/lib/toaster/tests/commands/test_runbuilds.py
@@ -24,7 +24,7 @@  class KillRunbuilds(threading.Thread):
     """ Kill the runbuilds process after an amount of time """
     def __init__(self, *args, **kwargs):
         super(KillRunbuilds, self).__init__(*args, **kwargs)
-        self.setDaemon(True)
+        self.daemon = True
 
     def run(self):
         time.sleep(5)