From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id B70D0158008 for ; Wed, 14 Jun 2023 01:44:13 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E4E30E08F5; Wed, 14 Jun 2023 01:44:12 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C8589E08F5 for ; Wed, 14 Jun 2023 01:44:12 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id EE6C83411C7 for ; Wed, 14 Jun 2023 01:44:11 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 46638A66 for ; Wed, 14 Jun 2023 01:44:10 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1686707042.efbc9c8d38b742a37968fc3b33d3dffdaf3be9f2.sam@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/util/futures/_asyncio/, lib/portage/tests/process/, lib/_emerge/, ... X-VCS-Repository: proj/portage X-VCS-Files: lib/_emerge/AsynchronousLock.py lib/_emerge/PollScheduler.py lib/portage/_emirrordist/MirrorDistTask.py lib/portage/debug.py lib/portage/locks.py lib/portage/proxy/lazyimport.py lib/portage/tests/locks/test_asynchronous_lock.py lib/portage/tests/process/test_PopenProcessBlockingIO.py lib/portage/tests/util/futures/test_retry.py lib/portage/util/_async/PipeReaderBlockingIO.py lib/portage/util/futures/_asyncio/__init__.py X-VCS-Directories: lib/portage/tests/process/ lib/portage/util/futures/_asyncio/ lib/portage/tests/util/futures/ lib/portage/proxy/ lib/_emerge/ lib/portage/_emirrordist/ lib/portage/util/_async/ lib/portage/ lib/portage/tests/locks/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: efbc9c8d38b742a37968fc3b33d3dffdaf3be9f2 X-VCS-Branch: master Date: Wed, 14 Jun 2023 01:44:10 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: fffb9b20-1336-4a92-8c1c-eb8b2f76c04a X-Archives-Hash: 713f0cd24e6c682f1ca473be633372f5 commit: efbc9c8d38b742a37968fc3b33d3dffdaf3be9f2 Author: Berin Aniesh gmail com> AuthorDate: Fri Jun 9 02:00:45 2023 +0000 Commit: Sam James gentoo 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 gmail.com> Closes: https://github.com/gentoo/portage/pull/1052 Signed-off-by: Sam James 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