File tree Expand file tree Collapse file tree 2 files changed +22
-15
lines changed Expand file tree Collapse file tree 2 files changed +22
-15
lines changed Original file line number Diff line number Diff line change 1
1
sudo : false
2
2
language : python
3
- cache : pip
3
+ cache :
4
+ pip : true
5
+ directories :
6
+ - .mypy_cache
4
7
python :
5
8
- 2.7
6
9
- 3.4
Original file line number Diff line number Diff line change 3
3
import os
4
4
import sys
5
5
import typing
6
+ import threading
6
7
7
8
import six
8
9
13
14
_logger .addHandler (logging .StreamHandler ())
14
15
_logger .setLevel (logging .INFO )
15
16
17
+ __TMPDIR_LOCK = threading .Lock ()
18
+
16
19
if six .PY3 :
17
20
18
- if onWindows :
21
+ if onWindows () :
19
22
# create '/tmp' folder if not present
20
23
# required by autotranslate module
21
24
# TODO: remove when https://github.com/PythonCharmers/python-future/issues/295
22
25
# is fixed
23
26
if not os .path .exists ("/tmp" ):
24
- try :
25
- os .makedirs ("/tmp" )
26
- except OSError as exception :
27
- _logger .error (u"Cannot create '\\ tmp' folder in root needed for" ,
28
- "'cwltool' Python 3 installation." )
29
- exit (1 )
30
-
31
- from past import autotranslate # type: ignore
32
- autotranslate (['avro' , 'avro.schema' ])
33
- import avro
34
- import avro .schema
35
- from past .translation import remove_hooks # type: ignore
36
- remove_hooks ()
27
+ with __TMPDIR_LOCK :
28
+ try :
29
+ os .makedirs ("/tmp" )
30
+ except OSError as exception :
31
+ _logger .error (u"Cannot create '\\ tmp' folder in root needed for"
32
+ "'cwltool' Python 3 installation." )
33
+ exit (1 )
34
+ with __TMPDIR_LOCK :
35
+ from past import autotranslate # type: ignore
36
+ from past .translation import remove_hooks # type: ignore
37
+ autotranslate (['avro' , 'avro.schema' ])
38
+ import avro
39
+ import avro .schema # pylint: disable=no-name-in-module,import-error
40
+ remove_hooks ()
You can’t perform that action at this time.
0 commit comments