File tree 1 file changed +12
-20
lines changed
1 file changed +12
-20
lines changed Original file line number Diff line number Diff line change @@ -103,29 +103,21 @@ def __safe_pool_map(
103
103
104
104
# first let's try to install in parallel,
105
105
# if we fail we do it by order.
106
- pool = None
107
- results = None
108
106
try :
109
107
pool = Pool ()
110
- pool_result = pool .map_async (func , iterable )
111
- # python 2.7 timeout=None will not catch KeyboardInterrupt
112
- results = pool_result .get (timeout = 999999 )
113
- except (KeyboardInterrupt , SystemExit ):
114
- if pool :
115
- pool .terminate ()
116
- raise
117
- except BaseException :
118
- # This should only happen if the pool failed to initialize
119
- # we fail silently and try serial installation
120
- if pool :
108
+ except ImportError :
109
+ return [func (i ) for i in iterable ]
110
+ else :
111
+ try :
112
+ # python 2.7 timeout=None will not catch KeyboardInterrupt
113
+ results = pool .map_async (func , iterable ).get (timeout = 999999 )
114
+ except (KeyboardInterrupt , SystemExit ):
121
115
pool .terminate ()
122
- pool = None
123
- # close pool if it was active
124
- if pool :
125
- pool .close ()
126
- pool .join ()
127
-
128
- return results
116
+ raise
117
+ else :
118
+ pool .close ()
119
+ pool .join ()
120
+ return results
129
121
130
122
131
123
def __single_install (
You can’t perform that action at this time.
0 commit comments