10
10
import contextlib
11
11
import shutil
12
12
import stat
13
+ import errno
13
14
from itertools import chain , izip , repeat
14
15
15
16
@@ -135,7 +136,7 @@ def popen(command, stdin=None, **kwargs):
135
136
try :
136
137
proc = subprocess .Popen (command , ** kwargs )
137
138
except OSError as e :
138
- if e [0 ] == 2 :
139
+ if e [0 ] == errno . EPERM :
139
140
error (
140
141
"Could not execute \" %s\" .\n "
141
142
"Please verify that it's installed and accessible from your current path by executing \" %s\" .\n " % (command [0 ], command [0 ]), e [0 ])
@@ -150,7 +151,7 @@ def pquery(command, stdin=None, **kwargs):
150
151
try :
151
152
proc = subprocess .Popen (command , stdout = subprocess .PIPE , stderr = subprocess .PIPE , ** kwargs )
152
153
except OSError as e :
153
- if e [0 ] == 2 :
154
+ if e [0 ] == errno . EPERM :
154
155
error (
155
156
"Could not execute \" %s\" .\n "
156
157
"Please verify that it's installed and accessible from your current path by executing \" %s\" .\n " % (command [0 ], command [0 ]), e [0 ])
@@ -1439,7 +1440,7 @@ def toolchain(name=None):
1439
1440
except ProcessException as e :
1440
1441
error ('Subrocess exit with error code %d' % e [0 ], e [0 ])
1441
1442
except OSError as e :
1442
- if e [0 ] == 2 :
1443
+ if e [0 ] == errno . EPERM :
1443
1444
error (
1444
1445
"Could not detect one of the command-line tools.\n "
1445
1446
"You could retry the last command with \" -v\" flag for verbose output\n " , e [0 ])
0 commit comments