commit:     504f66b0e25281e4465ebeceb799c3e54ff2b884
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 11 21:01:39 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Sep 11 21:07:30 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=504f66b0

AsynchronousLock: allow missing dummy_threading for Python 3.7

Python 3.7 does not support thread-less builds.

Reported-by: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache.Org>
See: https://bugs.python.org/issue31370
X-Gentoo-bug: 630730
X-Gentoo-bug-url: https://bugs.gentoo.org/630730

 pym/_emerge/AsynchronousLock.py                   | 6 +++++-
 pym/portage/tests/locks/test_asynchronous_lock.py | 8 +++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/pym/_emerge/AsynchronousLock.py b/pym/_emerge/AsynchronousLock.py
index 6a32d2d40..fb0c2b30d 100644
--- a/pym/_emerge/AsynchronousLock.py
+++ b/pym/_emerge/AsynchronousLock.py
@@ -1,13 +1,17 @@
 # Copyright 2010-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-import dummy_threading
 import fcntl
 import errno
 import logging
 import sys
 
 try:
+       import dummy_threading
+except ImportError:
+       dummy_threading = None
+
+try:
        import threading
 except ImportError:
        threading = dummy_threading

diff --git a/pym/portage/tests/locks/test_asynchronous_lock.py 
b/pym/portage/tests/locks/test_asynchronous_lock.py
index ab67242d5..6493b6da6 100644
--- a/pym/portage/tests/locks/test_asynchronous_lock.py
+++ b/pym/portage/tests/locks/test_asynchronous_lock.py
@@ -5,6 +5,11 @@ import itertools
 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
@@ -20,7 +25,8 @@ class AsynchronousLockTestCase(TestCase):
                        path = os.path.join(tempdir, 'lock_me')
                        for force_async, async_unlock in itertools.product(
                                (True, False), repeat=2):
-                               for force_dummy 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,

Reply via email to