mirror of
https://github.com/XaverKlemenschits/jupyter-c-kernel.git
synced 2025-04-16 19:36:08 +00:00
Dockerized project :)
This commit is contained in:
parent
8ad18c3d91
commit
177229a39d
8
Dockerfile
Normal file
8
Dockerfile
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
FROM jupyter/minimal-notebook
|
||||||
|
MAINTAINER Brendan Rius <ping@brendan-rius.com>
|
||||||
|
|
||||||
|
USER root
|
||||||
|
|
||||||
|
COPY ./ /home/$NB_USER/.jupyter/jupyter_c_kernel/
|
||||||
|
RUN pip install /home/$NB_USER/.jupyter/jupyter_c_kernel/
|
||||||
|
RUN jupyter-kernelspec install /home/$NB_USER/.jupyter/jupyter_c_kernel/
|
@ -28,6 +28,7 @@ class CKernel(Kernel):
|
|||||||
"""Create a new temp file to be deleted when the kernel shuts down"""
|
"""Create a new temp file to be deleted when the kernel shuts down"""
|
||||||
# We don't want the file to be deleted when closed, but only when the kernel stops
|
# We don't want the file to be deleted when closed, but only when the kernel stops
|
||||||
kwargs['delete'] = False
|
kwargs['delete'] = False
|
||||||
|
kwargs['mode'] = 'w'
|
||||||
file = tempfile.NamedTemporaryFile(**kwargs)
|
file = tempfile.NamedTemporaryFile(**kwargs)
|
||||||
self.files.append(file.name)
|
self.files.append(file.name)
|
||||||
return file
|
return file
|
||||||
@ -37,7 +38,7 @@ class CKernel(Kernel):
|
|||||||
"""Execute a command and returns the return code, stdout and stderr"""
|
"""Execute a command and returns the return code, stdout and stderr"""
|
||||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
stdout, stderr = p.communicate()
|
stdout, stderr = p.communicate()
|
||||||
return p.returncode, stdout, stderr
|
return p.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def compile_with_gcc(source_filename, binary_filename):
|
def compile_with_gcc(source_filename, binary_filename):
|
||||||
|
@ -7,5 +7,5 @@
|
|||||||
"{connection_file}"
|
"{connection_file}"
|
||||||
],
|
],
|
||||||
"display_name": "C",
|
"display_name": "C",
|
||||||
"language":"c"
|
"language": "c"
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user