]> git.sesse.net Git - itkacl/commitdiff
Add a Python module.
authorSteinar H. Gunderson <sesse@samfundet.no>
Tue, 14 May 2013 00:32:52 +0000 (02:32 +0200)
committerSteinar H. Gunderson <sesse@samfundet.no>
Tue, 14 May 2013 00:32:52 +0000 (02:32 +0200)
python-itkacl-2.0/debian/changelog [new file with mode: 0644]
python-itkacl-2.0/debian/compat [new file with mode: 0644]
python-itkacl-2.0/debian/control [new file with mode: 0644]
python-itkacl-2.0/debian/python-itkacl.preinst [new file with mode: 0644]
python-itkacl-2.0/debian/rules [new file with mode: 0755]
python-itkacl-2.0/debian/source/format [new file with mode: 0644]
python-itkacl-2.0/itkacl.i [new file with mode: 0644]
python-itkacl-2.0/setup.py [new file with mode: 0644]

diff --git a/python-itkacl-2.0/debian/changelog b/python-itkacl-2.0/debian/changelog
new file mode 100644 (file)
index 0000000..c00e052
--- /dev/null
@@ -0,0 +1,5 @@
+python-itkacl (2.0) unstable; urgency=low
+
+  * Initial release.
+
+ -- Steinar H. Gunderson <sesse@samfundet.no>  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 (file)
index 0000000..7f8f011
--- /dev/null
@@ -0,0 +1 @@
+7
diff --git a/python-itkacl-2.0/debian/control b/python-itkacl-2.0/debian/control
new file mode 100644 (file)
index 0000000..f111d8b
--- /dev/null
@@ -0,0 +1,15 @@
+Source: python-itkacl
+Maintainer: Steinar H. Gunderson <sesse@samfundet.no>
+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 (file)
index 0000000..2141916
--- /dev/null
@@ -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 (executable)
index 0000000..90fa9ea
--- /dev/null
@@ -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 (file)
index 0000000..d3827e7
--- /dev/null
@@ -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 (file)
index 0000000..8c5c63b
--- /dev/null
@@ -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 (file)
index 0000000..ad302dc
--- /dev/null
@@ -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"],
+       )