Write cmake_output under build_path (#222)
Write cmake_output under build_path
This commit is contained in:
parent
2e587b5b39
commit
9953b6559d
@ -18,10 +18,11 @@ def check_cmake_exists(cmake_command):
|
|||||||
"""
|
"""
|
||||||
from subprocess import Popen, PIPE
|
from subprocess import Popen, PIPE
|
||||||
|
|
||||||
p = Popen('{0} --version'.format(cmake_command),
|
p = Popen(
|
||||||
shell=True,
|
'{0} --version'.format(cmake_command),
|
||||||
stdin=PIPE,
|
shell=True,
|
||||||
stdout=PIPE)
|
stdin=PIPE,
|
||||||
|
stdout=PIPE)
|
||||||
if not ('cmake version' in p.communicate()[0].decode('UTF-8')):
|
if not ('cmake version' in p.communicate()[0].decode('UTF-8')):
|
||||||
sys.stderr.write(' This code is built using CMake\n\n')
|
sys.stderr.write(' This code is built using CMake\n\n')
|
||||||
sys.stderr.write(' CMake is not found\n')
|
sys.stderr.write(' CMake is not found\n')
|
||||||
@ -41,8 +42,11 @@ def setup_build_path(build_path):
|
|||||||
fname = os.path.join(build_path, 'CMakeCache.txt')
|
fname = os.path.join(build_path, 'CMakeCache.txt')
|
||||||
if os.path.exists(fname):
|
if os.path.exists(fname):
|
||||||
sys.stderr.write('aborting setup\n')
|
sys.stderr.write('aborting setup\n')
|
||||||
sys.stderr.write('build directory {0} which contains CMakeCache.txt already exists\n'.format(build_path))
|
sys.stderr.write(
|
||||||
sys.stderr.write('remove the build directory and then rerun setup\n')
|
'build directory {0} which contains CMakeCache.txt already exists\n'.
|
||||||
|
format(build_path))
|
||||||
|
sys.stderr.write(
|
||||||
|
'remove the build directory and then rerun setup\n')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
os.makedirs(build_path, 0o755)
|
os.makedirs(build_path, 0o755)
|
||||||
@ -56,11 +60,7 @@ def run_cmake(command, build_path, default_build_path):
|
|||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
|
|
||||||
topdir = os.getcwd()
|
topdir = os.getcwd()
|
||||||
p = Popen(command,
|
p = Popen(command, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
||||||
shell=True,
|
|
||||||
stdin=PIPE,
|
|
||||||
stdout=PIPE,
|
|
||||||
stderr=PIPE)
|
|
||||||
stdout_coded, stderr_coded = p.communicate()
|
stdout_coded, stderr_coded = p.communicate()
|
||||||
stdout = stdout_coded.decode('UTF-8')
|
stdout = stdout_coded.decode('UTF-8')
|
||||||
stderr = stderr_coded.decode('UTF-8')
|
stderr = stderr_coded.decode('UTF-8')
|
||||||
@ -75,7 +75,7 @@ def run_cmake(command, build_path, default_build_path):
|
|||||||
sys.stderr.write(stderr)
|
sys.stderr.write(stderr)
|
||||||
|
|
||||||
# write cmake output to file
|
# write cmake output to file
|
||||||
with open('cmake_output', 'w') as f:
|
with open(os.path.join(build_path, 'cmake_output'), 'w') as f:
|
||||||
f.write(stdout)
|
f.write(stdout)
|
||||||
|
|
||||||
# change directory and return
|
# change directory and return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user