* [gentoo-commits] proj/portage:master commit in: lib/portage/util/futures/_asyncio/, lib/portage/tests/process/, lib/_emerge/, ...
@ 2023-06-14 1:44 Sam James
0 siblings, 0 replies; only message in thread
From: Sam James @ 2023-06-14 1:44 UTC (permalink / raw
To: gentoo-commits
commit: efbc9c8d38b742a37968fc3b33d3dffdaf3be9f2
Author: Berin Aniesh <berinaniesh <AT> gmail <DOT> com>
AuthorDate: Fri Jun 9 02:00:45 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jun 14 01:44:02 2023 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=efbc9c8d
Remove dummy_threading
Portage's MSV is python 3.7 and dummy threading is deprecated
since python 3.7. So everything dummy_threading is removed.
Signed-off-by: Berin Aniesh <berinaniesh <AT> gmail.com>
Closes: https://github.com/gentoo/portage/pull/1052
Signed-off-by: Sam James <sam <AT> gentoo.org>
lib/_emerge/AsynchronousLock.py | 29 ++++----------------
lib/_emerge/PollScheduler.py | 7 ++---
lib/portage/_emirrordist/MirrorDistTask.py | 6 +----
lib/portage/debug.py | 8 ++----
lib/portage/locks.py | 7 +++--
lib/portage/proxy/lazyimport.py | 8 ++----
lib/portage/tests/locks/test_asynchronous_lock.py | 31 ++++++++--------------
.../tests/process/test_PopenProcessBlockingIO.py | 14 +---------
lib/portage/tests/util/futures/test_retry.py | 7 ++---
lib/portage/util/_async/PipeReaderBlockingIO.py | 8 ++----
lib/portage/util/futures/_asyncio/__init__.py | 5 +---
11 files changed, 34 insertions(+), 96 deletions(-)
diff --git a/lib/_emerge/AsynchronousLock.py b/lib/_emerge/AsynchronousLock.py
index 1a69d0847..c9c8e7f3c 100644
--- a/lib/_emerge/AsynchronousLock.py
+++ b/lib/_emerge/AsynchronousLock.py
@@ -1,19 +1,10 @@
-# Copyright 2010-2020 Gentoo Authors
+# Copyright 2010-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
import fcntl
import logging
import sys
-
-try:
- import dummy_threading
-except ImportError:
- dummy_threading = None
-
-try:
- import threading
-except ImportError:
- threading = dummy_threading
+import threading
import portage
from portage import os
@@ -39,7 +30,6 @@ class AsynchronousLock(AsynchronousTask):
__slots__ = ("path",) + (
"_imp",
"_force_async",
- "_force_dummy",
"_force_process",
"_force_thread",
"_unlock_future",
@@ -61,14 +51,11 @@ class AsynchronousLock(AsynchronousTask):
return
if self._force_process or (
- not self._force_thread
- and (self._use_process_by_default or threading is dummy_threading)
+ not self._force_thread and self._use_process_by_default
):
self._imp = _LockProcess(path=self.path, scheduler=self.scheduler)
else:
- self._imp = _LockThread(
- path=self.path, scheduler=self.scheduler, _force_dummy=self._force_dummy
- )
+ self._imp = _LockThread(path=self.path, scheduler=self.scheduler)
self._imp.addExitListener(self._imp_exit)
self._imp.start()
@@ -115,19 +102,13 @@ class _LockThread(AbstractPollTask):
using a background thread. After the lock is acquired, the thread
writes to a pipe in order to notify a poll loop running in the main
thread.
-
- If the threading module is unavailable then the dummy_threading
- module will be used, and the lock will be acquired synchronously
- (before the start() method returns).
"""
- __slots__ = ("path",) + ("_force_dummy", "_lock_obj", "_thread", "_unlock_future")
+ __slots__ = ("path",) + ("_lock_obj", "_thread", "_unlock_future")
def _start(self):
self._registered = True
threading_mod = threading
- if self._force_dummy:
- threading_mod = dummy_threading
self._thread = threading_mod.Thread(target=self._run_lock)
self._thread.daemon = True
self._thread.start()
diff --git a/lib/_emerge/PollScheduler.py b/lib/_emerge/PollScheduler.py
index 73f2affde..e5dffd8af 100644
--- a/lib/_emerge/PollScheduler.py
+++ b/lib/_emerge/PollScheduler.py
@@ -1,10 +1,7 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-try:
- import threading
-except ImportError:
- import dummy_threading as threading
+import threading
from portage.util.futures import asyncio
from portage.util._async.SchedulerInterface import SchedulerInterface
diff --git a/lib/portage/_emirrordist/MirrorDistTask.py b/lib/portage/_emirrordist/MirrorDistTask.py
index 5b2543c13..2925394a8 100644
--- a/lib/portage/_emirrordist/MirrorDistTask.py
+++ b/lib/portage/_emirrordist/MirrorDistTask.py
@@ -4,11 +4,7 @@
import errno
import logging
import time
-
-try:
- import threading
-except ImportError:
- import dummy_threading as threading
+import threading
import portage
from portage import os
diff --git a/lib/portage/debug.py b/lib/portage/debug.py
index b7106b799..ee2dc13e7 100644
--- a/lib/portage/debug.py
+++ b/lib/portage/debug.py
@@ -1,13 +1,9 @@
-# Copyright 1999-2014 Gentoo Foundation
+# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
import os
import sys
-
-try:
- import threading
-except ImportError:
- import dummy_threading as threading
+import threading
import portage.const
from portage.util import writemsg
diff --git a/lib/portage/locks.py b/lib/portage/locks.py
index 539e81294..9c77398bb 100644
--- a/lib/portage/locks.py
+++ b/lib/portage/locks.py
@@ -1,7 +1,10 @@
-# portage: Lock management code
-# Copyright 2004-2021 Gentoo Authors
+# Copyright 2004-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
+"""
+Portage: Lock management code
+"""
+
__all__ = [
"lockdir",
"unlockdir",
diff --git a/lib/portage/proxy/lazyimport.py b/lib/portage/proxy/lazyimport.py
index 95716338a..c6a934ae9 100644
--- a/lib/portage/proxy/lazyimport.py
+++ b/lib/portage/proxy/lazyimport.py
@@ -1,15 +1,11 @@
-# Copyright 2009-2020 Gentoo Authors
+# Copyright 2009-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
__all__ = ["lazyimport"]
import sys
import types
-
-try:
- import threading
-except ImportError:
- import dummy_threading as threading
+import threading
from portage.proxy.objectproxy import ObjectProxy
diff --git a/lib/portage/tests/locks/test_asynchronous_lock.py b/lib/portage/tests/locks/test_asynchronous_lock.py
index f853e82d7..da371e7c2 100644
--- a/lib/portage/tests/locks/test_asynchronous_lock.py
+++ b/lib/portage/tests/locks/test_asynchronous_lock.py
@@ -1,14 +1,9 @@
-# Copyright 2010-2011 Gentoo Foundation
+# Copyright 2010-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
import signal
import tempfile
-try:
- import dummy_threading
-except ImportError:
- dummy_threading = None
-
from portage import os
from portage import shutil
from portage.tests import TestCase
@@ -23,20 +18,16 @@ class AsynchronousLockTestCase(TestCase):
try:
path = os.path.join(tempdir, "lock_me")
for force_async in (True, False):
- for force_dummy in (
- (False,) if dummy_threading is None else (True, False)
- ):
- async_lock = AsynchronousLock(
- path=path,
- scheduler=scheduler,
- _force_async=force_async,
- _force_thread=True,
- _force_dummy=force_dummy,
- )
- async_lock.start()
- self.assertEqual(async_lock.wait(), os.EX_OK)
- self.assertEqual(async_lock.returncode, os.EX_OK)
- scheduler.run_until_complete(async_lock.async_unlock())
+ async_lock = AsynchronousLock(
+ path=path,
+ scheduler=scheduler,
+ _force_async=force_async,
+ _force_thread=True,
+ )
+ async_lock.start()
+ self.assertEqual(async_lock.wait(), os.EX_OK)
+ self.assertEqual(async_lock.returncode, os.EX_OK)
+ scheduler.run_until_complete(async_lock.async_unlock())
async_lock = AsynchronousLock(
path=path,
diff --git a/lib/portage/tests/process/test_PopenProcessBlockingIO.py b/lib/portage/tests/process/test_PopenProcessBlockingIO.py
index 4409feae6..893692288 100644
--- a/lib/portage/tests/process/test_PopenProcessBlockingIO.py
+++ b/lib/portage/tests/process/test_PopenProcessBlockingIO.py
@@ -1,14 +1,8 @@
-# Copyright 2012-2022 Gentoo Authors
+# Copyright 2012-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
import subprocess
-try:
- import threading
-except ImportError:
- # dummy_threading will not suffice
- threading = None
-
from portage import os
from portage.tests import TestCase
from portage.util._async.PopenProcess import PopenProcess
@@ -58,12 +52,6 @@ class PopenPipeBlockingIOTestCase(TestCase):
return consumer.getvalue().decode("ascii", "replace")
def testPopenPipeBlockingIO(self):
- if threading is None:
- skip_reason = "threading disabled"
- self.portage_skip = "threading disabled"
- self.assertFalse(True, skip_reason)
- return
-
for x in (1, 2, 5, 6, 7, 8, 2**5, 2**10, 2**12, 2**13, 2**14):
test_string = x * "a"
output = self._testPipeReader(test_string)
diff --git a/lib/portage/tests/util/futures/test_retry.py b/lib/portage/tests/util/futures/test_retry.py
index 20249a3a2..a5b56bdc7 100644
--- a/lib/portage/tests/util/futures/test_retry.py
+++ b/lib/portage/tests/util/futures/test_retry.py
@@ -1,13 +1,10 @@
-# Copyright 2018-2021 Gentoo Authors
+# Copyright 2018-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
from concurrent.futures import Future, ThreadPoolExecutor
import contextlib
-try:
- import threading
-except ImportError:
- import dummy_threading as threading
+import threading
import weakref
import time
diff --git a/lib/portage/util/_async/PipeReaderBlockingIO.py b/lib/portage/util/_async/PipeReaderBlockingIO.py
index 090aaf2cc..9b454ba4d 100644
--- a/lib/portage/util/_async/PipeReaderBlockingIO.py
+++ b/lib/portage/util/_async/PipeReaderBlockingIO.py
@@ -1,11 +1,7 @@
-# Copyright 2012-2022 Gentoo Authors
+# Copyright 2012-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-try:
- import threading
-except ImportError:
- # dummy_threading will not suffice
- threading = None
+import threading
from portage import os
from _emerge.AbstractPollTask import AbstractPollTask
diff --git a/lib/portage/util/futures/_asyncio/__init__.py b/lib/portage/util/futures/_asyncio/__init__.py
index ee858c390..a5a6cb3a5 100644
--- a/lib/portage/util/futures/_asyncio/__init__.py
+++ b/lib/portage/util/futures/_asyncio/__init__.py
@@ -36,10 +36,7 @@ from asyncio import (
TimeoutError,
)
-try:
- import threading
-except ImportError:
- import dummy_threading as threading
+import threading
import portage
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-06-14 1:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-14 1:44 [gentoo-commits] proj/portage:master commit in: lib/portage/util/futures/_asyncio/, lib/portage/tests/process/, lib/_emerge/, Sam James
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox