!15 Remove initThreading method from pyanaconda.threading

Merge pull request !15 from t.feng/master
This commit is contained in:
openeuler-ci-bot 2020-02-12 19:24:46 +08:00 committed by Gitee
commit 1f62dd100a
2 changed files with 77 additions and 1 deletions

View File

@ -3,7 +3,7 @@
Name: anaconda
Version: 29.24.7
Release: 26
Release: 27
Summary: Graphical system installer
License: GPLv2+ and MIT
URL: https://fedoraproject.org/wiki/Anaconda
@ -48,6 +48,7 @@ Patch9030: anaconda-modify-openeuler-in-welcome-to-lowercase.patch
Patch9031: bugfix-setup-fail-in-decode.patch
Patch9032: anaconda-modify-default-timezone-and-zh_CN_po.patch
Patch9033: bugfix-modify-network-hostname-dot-illegal.patch
Patch9034: backport-Remove-initThreading-method-from-pyanaconda-threading.patch
BuildRequires: audit-libs-devel libtool gettext-devel >= 0.19.8 gtk3-devel >= 3.22.17
BuildRequires: gtk-doc gtk3-devel-docs >= 3.22.17 glib2-doc gobject-introspection-devel
@ -220,6 +221,12 @@ update-desktop-database &> /dev/null || :
%{_datadir}/gtk-doc
%changelog
* Wed Feb 12 2020 openEuler Buildteam <buildteam@openeuler.org> - 29.24.7-27
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:Remove initThreading method from pyanaconda.threading
* Thu Feb 06 2020 openEuler Buildteam <buildteam@openeuler.org> - 29.24.7-26
- Type:bugfix
- Id:NA

View File

@ -0,0 +1,69 @@
From 05bda4c50c9df594a6b266ac74b60478da4c532c Mon Sep 17 00:00:00 2001
From: fengtao <fengtao40@huawei.com>
Date: Wed, 12 Feb 2020 15:52:08 +0800
Subject: [PATCH] Remove initThreading method from pyanaconda threading
---
anaconda.py | 5 +----
pyanaconda/threading.py | 17 +----------------
2 files changed, 2 insertions(+), 20 deletions(-)
diff --git a/anaconda.py b/anaconda.py
index 14048e7..52c8826 100755
--- a/anaconda.py
+++ b/anaconda.py
@@ -274,10 +274,7 @@ if __name__ == "__main__":
setup_python_path()
# init threading before Gtk can do anything and before we start using threads
- # initThreading initializes the threadMgr instance, import it afterwards
- from pyanaconda.threading import initThreading, AnacondaThread, threadMgr
- initThreading()
-
+ from pyanaconda.threading import AnacondaThread, threadMgr
from pyanaconda.core.i18n import _
from pyanaconda.addons import collect_addon_paths
diff --git a/pyanaconda/threading.py b/pyanaconda/threading.py
index a86003d..e0ab802 100644
--- a/pyanaconda/threading.py
+++ b/pyanaconda/threading.py
@@ -44,10 +44,6 @@ class ThreadManager(object):
self._objs_lock = threading.RLock()
self._errors = {}
self._errors_lock = threading.RLock()
- self._main_thread = threading.main_thread()
-
- def set_current_thread_as_main(self):
- self._main_thread = threading.current_thread()
def __call__(self):
return self
@@ -176,9 +172,7 @@ class ThreadManager(object):
def in_main_thread(self):
"""Return True if it is run in the main thread."""
-
- cur_thread = threading.current_thread()
- return cur_thread is self._main_thread
+ return threading.current_thread() is threading.main_thread()
@property
def running(self):
@@ -293,13 +287,4 @@ class AnacondaThread(threading.Thread):
self._target_stopped()
-def initThreading():
- """Set up threading for anaconda's use. This method must be called before
- any GTK or threading code is called, or else threads will only run when
- an event is triggered in the GTK main loop. And IT HAS TO BE CALLED IN
- THE MAIN THREAD.
- """
- threadMgr.set_current_thread_as_main()
-
-
threadMgr = ThreadManager()
--
1.8.3.1