use distutils.spawn.find_executable

This commit is contained in:
j 2016-02-06 12:29:40 +05:30
parent e96847a3f4
commit 8b06842acc
1 changed files with 3 additions and 2 deletions

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3
from __future__ import division, with_statement, print_function
import distutils.spawn
from contextlib import closing
import json
import os
@ -8,7 +9,6 @@ import sys
import tarfile
from urllib.request import urlopen
from threading import Thread
import subprocess
def makedirs(dirname):
if not os.path.exists(dirname):
@ -163,7 +163,8 @@ class Install(Thread):
return self.base_url + url
def has_bin(cmd):
return subprocess.call(['which', cmd], stdout=subprocess.PIPE) == 0
path = distutils.spawn.find_executable(cmd)
return path != None
if __name__ == '__main__':
if len(sys.argv) == 1: