From 50edf34f6dc857c63a6e60748154abed835174ce Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sun, 16 Jul 2017 11:44:07 +0100 Subject: [PATCH] Initial version: obviously trivial module with no functionality. --- .gitignore | 5 +++++ .links | 3 +++ Makefile | 2 ++ kalyna-python.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 16 ++++++++++++++++ 5 files changed, 73 insertions(+) create mode 100644 .gitignore create mode 100644 .links create mode 100644 Makefile create mode 100644 kalyna-python.c create mode 100755 setup.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1523603 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/RELEASE +/auto-version +/mdwsetup.py +/mdwsetup.pyc +/pysetup.mk diff --git a/.links b/.links new file mode 100644 index 0000000..b11dcde --- /dev/null +++ b/.links @@ -0,0 +1,3 @@ +auto-version +mdwsetup.py +pysetup.mk diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b9f9347 --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +### -*-makefile-*- +include pysetup.mk diff --git a/kalyna-python.c b/kalyna-python.c new file mode 100644 index 0000000..3de4bfe --- /dev/null +++ b/kalyna-python.c @@ -0,0 +1,47 @@ +/* -*-c-*- + * + * Python binding to Kalyna reference implementation + * + * (c) 2017 Mark Wooding + */ + +/*----- Licensing notice --------------------------------------------------* + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/*----- Header files ------------------------------------------------------*/ + +#define PY_SSIZE_T_CLEAN + +#include "Python.h" + +/*----- Utilities ---------------------------------------------------------*/ + +#define INSERT(name, ob) do { \ + PyObject *_o = (PyObject *)(ob); \ + Py_INCREF(_o); \ + PyModule_AddObject(mod, name, _o); \ +} while (0) + +/*----- Main code ---------------------------------------------------------*/ + +void initkalyna(void) +{ + PyObject *mod = Py_InitModule("kalyna", 0); + INSERT("version", PyString_FromString(VERSION)); +} + +/*----- That's all, folks -------------------------------------------------*/ diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..a315063 --- /dev/null +++ b/setup.py @@ -0,0 +1,16 @@ +#! /usr/bin/python + +import distutils.core as DC +import mdwsetup as MS + +cat = DC.Extension('kalyna', ['kalyna-python.c'], + extra_compile_args = ['-DVERSION="%s"' % + MS.auto_version()]) + +MS.setup(name = 'kalyna-python', + description = 'Python binding to Kalyna reference implementation', + url = 'https://git.distorted.org.uk/~mdw/kalyna-python/', + author = 'Mark Wooding', + author_email = 'mdw@distorted.org.uk', + license = 'Alas unclear', + ext_modules = [cat]) -- 2.11.0