Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cbddb99

Browse files
committed
Catch the right error
1 parent ebee64b commit cbddb99

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

setupext.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import warnings
1414
from textwrap import fill
1515

16-
1716
PY3 = (sys.version_info[0] >= 3)
1817

1918

@@ -1789,12 +1788,12 @@ def check_requirements(self):
17891788
return "unknown (can not use multiprocessing to determine)"
17901789
try:
17911790
res = p.map_async(backend_gtk3agg_internal_check, [0])
1792-
success, msg = res.get(timeout=5)[0]
1793-
except Queue.Empty:
1791+
success, msg = res.get(timeout=10)[0]
1792+
except multiprocessing.TimeoutError:
17941793
p.terminate()
17951794
# No result returned. Probaly hanging, terminate the process.
17961795
success = False
1797-
raise
1796+
raise CheckFailed("Check timed out")
17981797
except:
17991798
p.close()
18001799
# Some other error.
@@ -1864,12 +1863,12 @@ def check_requirements(self):
18641863
return "unknown (can not use multiprocessing to determine)"
18651864
try:
18661865
res = p.map_async(backend_gtk3cairo_internal_check, [0])
1867-
success, msg = res.get(timeout=5)[0]
1868-
except Queue.Empty:
1866+
success, msg = res.get(timeout=10)[0]
1867+
except multiprocessing.TimeoutError:
18691868
p.terminate()
18701869
# No result returned. Probaly hanging, terminate the process.
18711870
success = False
1872-
raise
1871+
raise CheckFailed("Check timed out")
18731872
except:
18741873
p.close()
18751874
success = False
@@ -2012,11 +2011,11 @@ def check_requirements(self):
20122011
# Multiprocessing OK
20132012
try:
20142013
res = p.map_async(self.callback, [self])
2015-
msg = res.get(timeout=5)[0]
2016-
except Queue.Empty:
2014+
msg = res.get(timeout=10)[0]
2015+
except multiprocessing.TimeoutError:
20172016
p.terminate()
20182017
# No result returned. Probaly hanging, terminate the process.
2019-
raise
2018+
raise CheckFailed("Check timed out")
20202019
except:
20212020
# Some other error.
20222021
p.close()

0 commit comments

Comments
 (0)