Mercurial > hg > Members > aka > jupyter_CbC_kernel
changeset 75:a1e3b056a4bd 1.2.2
Merge pull request #40 from halfhorst/master
add resources/ as package data
committer: GitHub <noreply@github.com>
author | Brendan Rius <brendan.rius@gmail.com> |
---|---|
date | Wed, 24 Jan 2018 11:01:54 +0100 |
parents | eec68d0a113e (current diff) 8206b62b7016 (diff) |
children | 51504a45e73e a7eb412b0120 f17d7374c947 |
files | jupyter_c_kernel/resources/master.c resources/master.c |
diffstat | 6 files changed, 36 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/Dockerfile Sun Aug 13 17:03:43 2017 +0200 +++ b/Dockerfile Wed Jan 24 11:01:54 2018 +0100 @@ -7,7 +7,7 @@ COPY ./ jupyter_c_kernel/ -RUN pip install --no-cache-dir -e jupyter_c_kernel/ +RUN pip install --no-cache-dir jupyter_c_kernel/ RUN cd jupyter_c_kernel && install_c_kernel --user WORKDIR /home/$NB_USER/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MANIFEST.in Wed Jan 24 11:01:54 2018 +0100 @@ -0,0 +1,1 @@ +include jupyter_c_kernel/resources/master.c
--- a/jupyter_c_kernel/kernel.py Sun Aug 13 17:03:43 2017 +0200 +++ b/jupyter_c_kernel/kernel.py Wed Jan 24 11:01:54 2018 +0100 @@ -83,7 +83,7 @@ mastertemp = tempfile.mkstemp(suffix='.out') os.close(mastertemp[0]) self.master_path = mastertemp[1] - filepath = path.join(path.dirname(path.realpath(__file__)), '..', 'resources', 'master.c') + filepath = path.join(path.dirname(path.realpath(__file__)), 'resources', 'master.c') subprocess.call(['gcc', filepath, '-std=c11', '-rdynamic', '-ldl', '-o', self.master_path]) def cleanup_files(self):
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jupyter_c_kernel/resources/master.c Wed Jan 24 11:01:54 2018 +0100 @@ -0,0 +1,31 @@ +#include <stdlib.h> +#include <stdio.h> +#include <dlfcn.h> + +typedef int (*main_t)(int, char **, char **); + +int main(int argc, char **argv, char **envp) +{ + char *error = NULL; + + setbuf(stdout, NULL); + setbuf(stderr, NULL); + if (argc < 2) { + fprintf(stderr, "USAGE: %s PROGRAM\nWhere PROGRAM is the user's program to supervise\n", argv[0]); + return EXIT_FAILURE; + } + void *userhandle = dlopen(argv[1], RTLD_LAZY); + if (userhandle == NULL) { + fprintf(stderr, "%s: %s\n", argv[0], dlerror()); + return EXIT_FAILURE; + } + dlerror(); + main_t usermain = dlsym(userhandle, "main"); + if ((error = dlerror()) != NULL) { + fprintf(stderr, "%s: %s\n", argv[0], error); + return EXIT_FAILURE; + } + + /* Call Users main, but make master.c invisible by removing first argument */ + return usermain(argc-1, argv+1, envp); +}
--- a/resources/master.c Sun Aug 13 17:03:43 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -#include <stdlib.h> -#include <stdio.h> -#include <dlfcn.h> - -typedef int (*main_t)(int, char **, char **); - -int main(int argc, char **argv, char **envp) -{ - char *error = NULL; - - setbuf(stdout, NULL); - setbuf(stderr, NULL); - if (argc < 2) { - fprintf(stderr, "USAGE: %s PROGRAM\nWhere PROGRAM is the user's program to supervise\n", argv[0]); - return EXIT_FAILURE; - } - void *userhandle = dlopen(argv[1], RTLD_LAZY); - if (userhandle == NULL) { - fprintf(stderr, "%s: %s\n", argv[0], dlerror()); - return EXIT_FAILURE; - } - dlerror(); - main_t usermain = dlsym(userhandle, "main"); - if ((error = dlerror()) != NULL) { - fprintf(stderr, "%s: %s\n", argv[0], error); - return EXIT_FAILURE; - } - - /* Call Users main, but make master.c invisible by removing first argument */ - return usermain(argc-1, argv+1, envp); -}
--- a/setup.py Sun Aug 13 17:03:43 2017 +0200 +++ b/setup.py Wed Jan 24 11:01:54 2018 +0100 @@ -9,5 +9,6 @@ download_url='https://github.com/brendanrius/jupyter-c-kernel/tarball/1.2.1', packages=['jupyter_c_kernel'], scripts=['jupyter_c_kernel/install_c_kernel'], - keywords=['jupyter', 'notebook', 'kernel', 'c'] + keywords=['jupyter', 'notebook', 'kernel', 'c'], + include_package_data=True )