kore

a fork of the worlds most advanced web framework
Log | Files | Refs | README | LICENSE

commit b9a714de65707c9ca0874e82f340b48909a12179
parent 58c2739dee7d90decad190c0fb71b5c80328b67e
Author: Joris Vink <joris@coders.se>
Date:   Thu, 21 Mar 2019 21:35:24 +0100

remove pyko

Diffstat:
Dpyko/.gitignore | 6------
Dpyko/Makefile | 19-------------------
Dpyko/README.md | 51---------------------------------------------------
Dpyko/conf/build.conf | 17-----------------
Dpyko/conf/pyko.conf | 1-
Dpyko/src/pyko.c | 70----------------------------------------------------------------------
6 files changed, 0 insertions(+), 164 deletions(-)

diff --git a/pyko/.gitignore b/pyko/.gitignore @@ -1,6 +0,0 @@ -*.o -.flavor -.objs -pyko.so -assets.h -cert diff --git a/pyko/Makefile b/pyko/Makefile @@ -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 @@ -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 @@ -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 @@ -1 +0,0 @@ -# pyko configuration diff --git a/pyko/src/pyko.c b/pyko/src/pyko.c @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2018 Joris Vink <joris@coders.se> - * - * 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 <sys/types.h> -#include <sys/stat.h> - -#include <kore/kore.h> -#include <kore/python_api.h> - -#include <stdio.h> -#include <limits.h> -#include <unistd.h> - -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); -}