From: Steinar H. Gunderson Date: Tue, 14 May 2013 00:32:52 +0000 (+0200) Subject: Add a Python module. X-Git-Url: https://git.sesse.net/?p=itkacl;a=commitdiff_plain;h=984e5ade2fc82719cdb7404d4babc68755040055 Add a Python module. --- diff --git a/python-itkacl-2.0/debian/changelog b/python-itkacl-2.0/debian/changelog new file mode 100644 index 0000000..c00e052 --- /dev/null +++ b/python-itkacl-2.0/debian/changelog @@ -0,0 +1,5 @@ +python-itkacl (2.0) unstable; urgency=low + + * Initial release. + + -- Steinar H. Gunderson Tue, 14 May 2013 01:51:05 +0200 diff --git a/python-itkacl-2.0/debian/compat b/python-itkacl-2.0/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/python-itkacl-2.0/debian/compat @@ -0,0 +1 @@ +7 diff --git a/python-itkacl-2.0/debian/control b/python-itkacl-2.0/debian/control new file mode 100644 index 0000000..f111d8b --- /dev/null +++ b/python-itkacl-2.0/debian/control @@ -0,0 +1,15 @@ +Source: python-itkacl +Maintainer: Steinar H. Gunderson +Section: python +Priority: optional +Build-Depends: debhelper (>= 7), python, python-support (>= 0.8.4), libitkacl-dev, swig +Standards-Version: 3.9.1 +XS-Python-Version: all + +Package: python-itkacl +Architecture: any +Depends: ${misc:Depends}, ${python:Depends}, ${shlibs:Depends} +XB-Python-Version: ${python:Versions} +Provides: ${python:Provides} +Description: Python interface to ITKACL + This package contains the Python interface to ITKACL. diff --git a/python-itkacl-2.0/debian/python-itkacl.preinst b/python-itkacl-2.0/debian/python-itkacl.preinst new file mode 100644 index 0000000..2141916 --- /dev/null +++ b/python-itkacl-2.0/debian/python-itkacl.preinst @@ -0,0 +1,14 @@ +#! /bin/sh + +set -e + +# This was added by stdeb to workaround Debian #479852. In a nutshell, +# pycentral does not remove normally remove its symlinks on an +# upgrade. Since we're using python-support, however, those symlinks +# will be broken. This tells python-central to clean up any symlinks. +if [ -e /var/lib/dpkg/info/python-itkacl.list ] && which pycentral >/dev/null 2>&1 +then + pycentral pkgremove python-itkacl +fi + +#DEBHELPER# diff --git a/python-itkacl-2.0/debian/rules b/python-itkacl-2.0/debian/rules new file mode 100755 index 0000000..90fa9ea --- /dev/null +++ b/python-itkacl-2.0/debian/rules @@ -0,0 +1,35 @@ +#!/usr/bin/make -f + +clean: + dh_testdir + dh_clean + python setup.py clean + $(RM) -r build/ + $(RM) itkacl.py itkacl.pyc itkacl_wrap.c + +build: + python setup.py build_ext + +binary-indep: + +binary-arch: + dh_testroot + dh_prep + dh_installdirs + python setup.py install --root=debian/python-itkacl --install-layout=deb + dh_installdocs + dh_installchangelogs + dh_pysupport + dh_compress + dh_fixperms + dh_strip + dh_makeshlibs + dh_shlibdeps + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-arch + +.PHONY: clean build binary-indep binary-arch binary diff --git a/python-itkacl-2.0/debian/source/format b/python-itkacl-2.0/debian/source/format new file mode 100644 index 0000000..d3827e7 --- /dev/null +++ b/python-itkacl-2.0/debian/source/format @@ -0,0 +1 @@ +1.0 diff --git a/python-itkacl-2.0/itkacl.i b/python-itkacl-2.0/itkacl.i new file mode 100644 index 0000000..8c5c63b --- /dev/null +++ b/python-itkacl-2.0/itkacl.i @@ -0,0 +1,25 @@ +/* SWIG interface for libitkacl */ +%module itkacl + +/* Same as for Perl, except that we return a boolean, not an int. */ +%inline %{ + extern int itkacl_check(char *realm, char *user, char *errmsg, size_t errmsgsize); + PyObject *check(char *realm, char *user) + { + char errmsg[1024]; + int ret = itkacl_check(realm, user, errmsg, 1024); + if (ret == -1) { + PyErr_SetString(PyExc_RuntimeError, errmsg); + return NULL; + } else { + if (ret == 0) { + Py_INCREF(Py_True); + return Py_True; + } else { + Py_INCREF(Py_False); + return Py_False; + } + } + } +%} + diff --git a/python-itkacl-2.0/setup.py b/python-itkacl-2.0/setup.py new file mode 100644 index 0000000..ad302dc --- /dev/null +++ b/python-itkacl-2.0/setup.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +""" +setup.py file for ITKACL +""" + +from distutils.core import setup, Extension + + +itkacl_module = Extension('_itkacl', + sources=['itkacl.i'], + libraries=['itkacl'], + ) + +setup (name = 'itkacl', + version = '2.0', + author = "Steinar H. Gunderson", + description = """Python interface to ITKACL""", + ext_modules = [itkacl_module], + py_modules = ["itkacl"], + )