aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/paxmodule.c47
-rwxr-xr-xscripts/revdep-pax3
-rwxr-xr-xscripts/setup.py19
3 files changed, 69 insertions, 0 deletions
diff --git a/scripts/paxmodule.c b/scripts/paxmodule.c
new file mode 100644
index 0000000..03ba794
--- /dev/null
+++ b/scripts/paxmodule.c
@@ -0,0 +1,47 @@
+#include <Python.h>
+
+static PyObject * pax_getflags(PyObject *, PyObject *);
+
+static PyMethodDef PaxMethods[] = {
+ {"getflags", pax_getflags, METH_VARARGS, "Get the pax flags."},
+ {NULL, NULL, 0, NULL}
+};
+
+static PyObject *PaxError;
+
+PyMODINIT_FUNC
+initpax(void)
+{
+ PyObject *m;
+
+ m = Py_InitModule("pax", PaxMethods);
+ if (m == NULL)
+ return;
+
+ PaxError = PyErr_NewException("pax.error", NULL, NULL);
+ Py_INCREF(PaxError);
+ PyModule_AddObject(m, "error", PaxError);
+}
+
+
+static PyObject *
+pax_getflags(PyObject *self, PyObject *args)
+{
+ const char *value;
+ int sts;
+
+ if (!PyArg_ParseTuple(args, "s", &value))
+ return NULL;
+
+ printf("%s\n", value);
+
+ sts = 1;
+
+ if (sts < 0)
+ {
+ PyErr_SetString(PaxError, "pax_getflags failed");
+ return NULL;
+ }
+
+ return Py_BuildValue("i", sts);
+}
diff --git a/scripts/revdep-pax b/scripts/revdep-pax
index 75e833a..ac21bae 100755
--- a/scripts/revdep-pax
+++ b/scripts/revdep-pax
@@ -4,6 +4,8 @@ from os import listdir
#from os import path
import re
+import pax
+
var_db_pkg = '/var/db/pkg'
binaries = {}
@@ -21,6 +23,7 @@ for cat in listdir(var_db_pkg):
binary = linking[0]
print binary
library_list = re.split(',', linking[1])
+ print "\t%s" % library_list
binaries[binary] = library_list
except:
break
diff --git a/scripts/setup.py b/scripts/setup.py
new file mode 100755
index 0000000..317efbd
--- /dev/null
+++ b/scripts/setup.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+
+from distutils.core import setup, Extension
+
+module1 = Extension(
+ name='pax',
+ sources = ['paxmodule.c']
+)
+
+setup(
+ name = 'PaxPython',
+ version = '1.0',
+ author = 'Anthony G. Basile',
+ author_email = 'blueness@gentoo.org',
+ url = 'http://dev.gentoo.org/~blueness/elfix',
+ description = 'This is bindings between paxctl and python',
+ license = 'GPL-2',
+ ext_modules = [module1]
+)