use with statement for I/O
This commit is contained in:
parent
1ab86a0d02
commit
431a329e2b
@ -101,9 +101,8 @@ def run_cmake(command, build_path, default_build_path):
|
|||||||
# print cmake output to screen
|
# print cmake output to screen
|
||||||
print(stdout)
|
print(stdout)
|
||||||
# write cmake output to file
|
# write cmake output to file
|
||||||
f = open('cmake_output', 'w')
|
with open('cmake_output', 'w') as f:
|
||||||
f.write(stdout)
|
f.write(stdout)
|
||||||
f.close()
|
|
||||||
# change directory and return
|
# change directory and return
|
||||||
os.chdir(topdir)
|
os.chdir(topdir)
|
||||||
if 'Configuring incomplete' in stdout:
|
if 'Configuring incomplete' in stdout:
|
||||||
@ -136,9 +135,8 @@ def save_setup_command(argv, build_path):
|
|||||||
Save setup command to a file.
|
Save setup command to a file.
|
||||||
"""
|
"""
|
||||||
file_name = os.path.join(build_path, 'setup_command')
|
file_name = os.path.join(build_path, 'setup_command')
|
||||||
f = open(file_name, 'w')
|
with open(file_name, 'w') as f:
|
||||||
f.write(' '.join(argv[:]) + '\n')
|
f.write(' '.join(argv[:]) + '\n')
|
||||||
f.close()
|
|
||||||
|
|
||||||
|
|
||||||
def configure(root_directory, build_path, cmake_command, only_show):
|
def configure(root_directory, build_path, cmake_command, only_show):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user