INNER CODE UNIT · Python
compile_single
nloyfer/wgbs_tools · setup.py:18
def compile_single(cmd, name, verbose):
""" Compile a single c++ module """
eprint(f'Compiling {name}...')
# subprocess g++ command
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, error = p.communicate()
# If failed:
if p.returncode:
eprint('\033[01;31mFAIL\033[00m')
eprint("Failed compilation.\nCommand: {}\nreturn code: {}\nstderr:\n{}\nstdout:\n{}".
format(cmd, p.returncode, output.decode(), error.decode()))
eprint(f'Failed compiling {name}')
# raise RuntimeError('Failed compiling {}'.format(name))
# If succeeded:
elif verbose: