From b9a714de65707c9ca0874e82f340b48909a12179 Mon Sep 17 00:00:00 2001 From: Joris Vink Date: Thu, 21 Mar 2019 21:35:24 +0100 Subject: [PATCH] remove pyko --- pyko/.gitignore | 6 ---- pyko/Makefile | 19 ------------ pyko/README.md | 51 -------------------------------- pyko/conf/build.conf | 17 ----------- pyko/conf/pyko.conf | 1 - pyko/src/pyko.c | 70 -------------------------------------------- 6 files changed, 164 deletions(-) delete mode 100644 pyko/.gitignore delete mode 100644 pyko/Makefile delete mode 100644 pyko/README.md delete mode 100644 pyko/conf/build.conf delete mode 100644 pyko/conf/pyko.conf delete mode 100644 pyko/src/pyko.c diff --git a/pyko/.gitignore b/pyko/.gitignore deleted file mode 100644 index 4bcd7d0..0000000 --- a/pyko/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -.flavor -.objs -pyko.so -assets.h -cert diff --git a/pyko/Makefile b/pyko/Makefile deleted file mode 100644 index d094532..0000000 --- a/pyko/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# pyko Makefile - -BIN=pyko -PREFIX?=/usr/local -INSTALL_DIR=$(PREFIX)/bin - -KODEV?=../kodev/kodev - -build: - $(KODEV) build - -clean: - $(KODEV) clean - -install: - install -m 555 $(BIN) $(INSTALL_DIR)/$(BIN) - -uninstall: - rm -f $(INSTALL_DIR)/$(BIN) diff --git a/pyko/README.md b/pyko/README.md deleted file mode 100644 index f3b66bc..0000000 --- a/pyko/README.md +++ /dev/null @@ -1,51 +0,0 @@ -About ------ -Pyko is a single binary kore build aimed at starting kore python applications -in a more easy and straight forward manner. - -Building --------- -This kore application builds with PYTHON=1 and PGSQL=1 automatically. -See the kore README file on what dependencies are required for this. - -From the root kore directory run: - -``` - $ make -C kodev - $ make -C pyko - $ sudo make -C pyko install -``` - -App layout ----------- -Your python application directory must have the following layout: - -``` - python_app/ - kore.conf <- actual kore configuration - __init__.py <- module initialization (binds, worker setup) - handlers.py <- handler code -``` - -You can easily use the kodev tool from kore to create an application -skeleton that gets you going: - -``` - $ kodev create -p myapp - $ cd myapp - $ pyko -frn -``` - -Usage ------ -``` - $ pyko -frn python_app -``` - -``` - -f = foreground - -n = skip chroot - -r = skip privilege drop -``` - -You can run pyko from inside the module directory directly as well. diff --git a/pyko/conf/build.conf b/pyko/conf/build.conf deleted file mode 100644 index 6653b04..0000000 --- a/pyko/conf/build.conf +++ /dev/null @@ -1,17 +0,0 @@ -# pyko build config - -single_binary=yes -kore_source=../ -kore_flavor=PYTHON=1 PGSQL=1 - -cflags=-std=c99 -pedantic -cflags=-Wall -Wmissing-declarations -Wshadow -cflags=-Wstrict-prototypes -Wmissing-prototypes -cflags=-Wpointer-arith -Wcast-qual -Wsign-compare - -dev { - cflags=-g -} - -prod { -} diff --git a/pyko/conf/pyko.conf b/pyko/conf/pyko.conf deleted file mode 100644 index 4884ee9..0000000 --- a/pyko/conf/pyko.conf +++ /dev/null @@ -1 +0,0 @@ -# pyko configuration diff --git a/pyko/src/pyko.c b/pyko/src/pyko.c deleted file mode 100644 index 493b63e..0000000 --- a/pyko/src/pyko.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2018 Joris Vink - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include - -#include -#include - -#include -#include -#include - -void -kore_parent_configure(int argc, char **argv) -{ - struct stat st; - int len; - FILE *fp; - char *module, pwd[PATH_MAX], config[PATH_MAX]; - - if (getcwd(pwd, sizeof(pwd)) == NULL) - fatal("getcwd: %s", errno_s); - - if (argc == 0) { - module = &pwd[0]; - } else if (argc == 1) { - if (!strcmp(argv[0], ".")) - module = &pwd[0]; - else - module = argv[0]; - } else { - fatal("Usage: pyko [options] [kore python app]"); - } - - if (stat(module, &st) == -1) - fatal("stat(%s): %s", module, errno_s); - - if (!S_ISDIR(st.st_mode)) - fatal("python module directory required"); - - len = snprintf(config, sizeof(config), "%s/kore.conf", module); - if (len == -1 || (size_t)len >= sizeof(config)) - fatal("failed to create configuration path"); - - if ((fp = fopen(config, "r")) == NULL) - fatal("cannot open configuration '%s': %s", config, errno_s); - - kore_python_path(module); - kore_module_load(module, NULL, KORE_MODULE_PYTHON); - - if (chdir(module) == -1) - fatal("chdir(%s): %s", module, errno_s); - - kore_parse_config_file(fp); - (void)fclose(fp); -}