Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/tests/locks/, pym/_emerge/
Date: Mon, 11 Sep 2017 21:52:16
Message-Id: 1505164050.504f66b0e25281e4465ebeceb799c3e54ff2b884.zmedico@gentoo
1 commit: 504f66b0e25281e4465ebeceb799c3e54ff2b884
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Mon Sep 11 21:01:39 2017 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Mon Sep 11 21:07:30 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=504f66b0
7
8 AsynchronousLock: allow missing dummy_threading for Python 3.7
9
10 Python 3.7 does not support thread-less builds.
11
12 Reported-by: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache.Org>
13 See: https://bugs.python.org/issue31370
14 X-Gentoo-bug: 630730
15 X-Gentoo-bug-url: https://bugs.gentoo.org/630730
16
17 pym/_emerge/AsynchronousLock.py | 6 +++++-
18 pym/portage/tests/locks/test_asynchronous_lock.py | 8 +++++++-
19 2 files changed, 12 insertions(+), 2 deletions(-)
20
21 diff --git a/pym/_emerge/AsynchronousLock.py b/pym/_emerge/AsynchronousLock.py
22 index 6a32d2d40..fb0c2b30d 100644
23 --- a/pym/_emerge/AsynchronousLock.py
24 +++ b/pym/_emerge/AsynchronousLock.py
25 @@ -1,13 +1,17 @@
26 # Copyright 2010-2013 Gentoo Foundation
27 # Distributed under the terms of the GNU General Public License v2
28
29 -import dummy_threading
30 import fcntl
31 import errno
32 import logging
33 import sys
34
35 try:
36 + import dummy_threading
37 +except ImportError:
38 + dummy_threading = None
39 +
40 +try:
41 import threading
42 except ImportError:
43 threading = dummy_threading
44
45 diff --git a/pym/portage/tests/locks/test_asynchronous_lock.py b/pym/portage/tests/locks/test_asynchronous_lock.py
46 index ab67242d5..6493b6da6 100644
47 --- a/pym/portage/tests/locks/test_asynchronous_lock.py
48 +++ b/pym/portage/tests/locks/test_asynchronous_lock.py
49 @@ -5,6 +5,11 @@ import itertools
50 import signal
51 import tempfile
52
53 +try:
54 + import dummy_threading
55 +except ImportError:
56 + dummy_threading = None
57 +
58 from portage import os
59 from portage import shutil
60 from portage.tests import TestCase
61 @@ -20,7 +25,8 @@ class AsynchronousLockTestCase(TestCase):
62 path = os.path.join(tempdir, 'lock_me')
63 for force_async, async_unlock in itertools.product(
64 (True, False), repeat=2):
65 - for force_dummy in (True, False):
66 + for force_dummy in ((False,) if dummy_threading is None
67 + else (True, False)):
68 async_lock = AsynchronousLock(path=path,
69 scheduler=scheduler, _force_async=force_async,
70 _force_thread=True,