Skip to content

Commit 2e98d49

Browse files
authored
config-build.py works with Python3 (#218)
1 parent 2b1137f commit 2e98d49

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

scripts/config-build.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
import shutil
1212

1313
def extract_cmake_location(file_path):
14-
print "Extracting cmake entry from host config file ", file_path
14+
print("Extracting cmake entry from host config file ", file_path)
1515
if os.path.exists(file_path):
1616
cmake_line_prefix = "# cmake executable path: "
1717
file_handle = open(file_path, "r")
1818
content = file_handle.readlines()
1919
for line in content:
2020
if line.startswith(cmake_line_prefix):
2121
return line.split(" ")[4].strip()
22-
print "Could not find a cmake entry in host config file."
22+
print("Could not find a cmake entry in host config file.")
2323
return None
2424

2525

@@ -67,7 +67,7 @@ def extract_cmake_location(file_path):
6767

6868
args, unknown_args = parser.parse_known_args()
6969
if unknown_args:
70-
print "[config-build]: Passing the following unknown arguments directly to cmake... %s" % unknown_args
70+
print("[config-build]: Passing the following unknown arguments directly to cmake... %s" % unknown_args)
7171

7272
########################
7373
# Find CMake Cache File
@@ -81,7 +81,7 @@ def extract_cmake_location(file_path):
8181
platform_info = platform_info[:-6]
8282

8383
assert os.path.exists( cachefile ), "Could not find cmake cache file '%s'." % cachefile
84-
print "Using host config file: '%s'." % cachefile
84+
print("Using host config file: '%s'." % cachefile)
8585

8686
#####################
8787
# Setup Build Dir
@@ -97,10 +97,10 @@ def extract_cmake_location(file_path):
9797

9898
if os.path.exists(buildpath):
9999
# sys.exit("Build directory '%s' already exists, exiting...")
100-
print "Build directory '%s' already exists. Deleting..." % buildpath
100+
print("Build directory '%s' already exists. Deleting..." % buildpath)
101101
shutil.rmtree(buildpath)
102102

103-
print "Creating build directory '%s'..." % buildpath
103+
print("Creating build directory '%s'..." % buildpath)
104104
os.makedirs(buildpath)
105105

106106
#####################
@@ -117,10 +117,10 @@ def extract_cmake_location(file_path):
117117

118118
if os.path.exists(installpath):
119119
# sys.exit("Install directory '%s' already exists, exiting...")
120-
print "Install directory '%s' already exists, deleting..." % installpath
120+
print("Install directory '%s' already exists, deleting..." % installpath)
121121
shutil.rmtree(installpath)
122122

123-
print "Creating install path '%s'..." % installpath
123+
print("Creating install path '%s'..." % installpath)
124124
os.makedirs(installpath)
125125

126126
############################
@@ -163,9 +163,8 @@ def extract_cmake_location(file_path):
163163
############################
164164
# Run CMake
165165
############################
166-
print "Changing to build directory..."
166+
print("Changing to build directory...")
167167
os.chdir(buildpath)
168-
print "Executing cmake line: '%s'" % cmakeline
169-
print
168+
print("Executing cmake line: '%s'\n" % cmakeline)
170169
subprocess.call(cmakeline,shell=True)
171170

0 commit comments

Comments
 (0)