diff options
author | Zac Medico <zmedico@gentoo.org> | 2017-09-11 14:01:39 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2017-09-11 14:07:30 -0700 |
commit | 504f66b0e25281e4465ebeceb799c3e54ff2b884 (patch) | |
tree | ce67e11c596493162cb2593a79c89ffb4491be2b | |
parent | ebuild.sh: Completely ban external commands in global scope (diff) | |
download | portage-504f66b0e25281e4465ebeceb799c3e54ff2b884.tar.gz portage-504f66b0e25281e4465ebeceb799c3e54ff2b884.tar.bz2 portage-504f66b0e25281e4465ebeceb799c3e54ff2b884.zip |
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@Apache.Org>
See: https://bugs.python.org/issue31370
X-Gentoo-bug: 630730
X-Gentoo-bug-url: https://bugs.gentoo.org/630730
-rw-r--r-- | pym/_emerge/AsynchronousLock.py | 6 | ||||
-rw-r--r-- | 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, |