comparison jupyter_CbC_kernel/kernel.py @ 85:4d7d24e87c88

fix gcc option rm -std=c11
author musou_aka <>
date Mon, 25 Jun 2018 23:26:36 +0900
parents 371a7388a93a
children
comparison
equal deleted inserted replaced
84:371a7388a93a 85:4d7d24e87c88
82 self.files = [] 82 self.files = []
83 mastertemp = tempfile.mkstemp(suffix='.out') 83 mastertemp = tempfile.mkstemp(suffix='.out')
84 os.close(mastertemp[0]) 84 os.close(mastertemp[0])
85 self.master_path = mastertemp[1] 85 self.master_path = mastertemp[1]
86 filepath = path.join(path.dirname(path.realpath(__file__)), 'resources', 'master.c') 86 filepath = path.join(path.dirname(path.realpath(__file__)), 'resources', 'master.c')
87 subprocess.call(['gcc', filepath, '-std=c11', '-rdynamic', '-ldl', '-o', self.master_path]) 87 subprocess.call(['gcc', filepath, '-rdynamic', '-ldl', '-o', self.master_path])
88 88
89 def cleanup_files(self): 89 def cleanup_files(self):
90 """Remove all the temporary files created by the kernel""" 90 """Remove all the temporary files created by the kernel"""
91 for file in self.files: 91 for file in self.files:
92 os.remove(file) 92 os.remove(file)
111 return RealTimeSubprocess(cmd, 111 return RealTimeSubprocess(cmd,
112 lambda contents: self._write_to_stdout(contents.decode()), 112 lambda contents: self._write_to_stdout(contents.decode()),
113 lambda contents: self._write_to_stderr(contents.decode())) 113 lambda contents: self._write_to_stderr(contents.decode()))
114 114
115 def compile_with_gcc(self, source_filename, binary_filename, cflags=None, ldflags=None): 115 def compile_with_gcc(self, source_filename, binary_filename, cflags=None, ldflags=None):
116 cflags = ['-std=c11', '-fPIC', '-shared', '-rdynamic'] + cflags 116 cflags = ['-fPIC', '-shared', '-rdynamic'] + cflags
117 args = ['gcc', source_filename] + cflags + ['-o', binary_filename] + ldflags 117 args = ['gcc', source_filename] + cflags + ['-o', binary_filename] + ldflags
118 return self.create_jupyter_subprocess(args) 118 return self.create_jupyter_subprocess(args)
119 119
120 def _filter_magics(self, code): 120 def _filter_magics(self, code):
121 121