Skip to content

Commit 575b459

Browse files
committed
Switched to shutil for Python versions 3.3 and higher in the build script, as distutils is getting deprecated.
1 parent c0ec408 commit 575b459

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

build.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,16 @@
1313
# Populate a list of supported tools and figure out which one to use. #
1414
#######################################################################
1515

16+
import sys
17+
py_version = sys.version_info
18+
1619
def cmd_exists(cmd): # see if a given command is available on the system PATH
17-
from distutils.spawn import find_executable
18-
return find_executable(cmd) is not None
20+
if py_version.major > 3 or py_version.major == 3 and py_version.minor >= 3:
21+
import shutil
22+
return shutil.which(cmd) is not None
23+
else:
24+
from distutils.spawn import find_executable
25+
return find_executable(cmd) is not None
1926

2027
# First, we'll find out what OS we're on.
2128

@@ -67,7 +74,6 @@ def cmd_exists(cmd): # see if a given command is available on the system PATH
6774

6875
PRODUCTS = ["basil-release", "basil-debug", "librt-static", "librt-dynamic", "jasmine-release", "jasmine-debug", "test"]
6976

70-
import sys
7177
import argparse
7278
parser = argparse.ArgumentParser(description="Build an artifact from the Basil or Jasmine projects.")
7379
parser.add_argument("-v", "--verbose", action='store_true', help="Enable additional output from the build script.")

0 commit comments

Comments
 (0)