diff options
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | catsprintf.c | 4 | ||||
-rw-r--r-- | dmidecode.c | 6 | ||||
-rw-r--r-- | dmidecodemodule.c | 5 | ||||
-rw-r--r-- | setup.py | 9 |
5 files changed, 14 insertions, 14 deletions
@@ -47,9 +47,9 @@ PROGRAMS != echo dmidecode ; test `uname -m 2>/dev/null` != ia64 && echo biosdec mod: - python setup.py clean + sudo python setup.py clean python setup.py build - python setup.py install + sudo python setup.py install python -c 'import dmidecode' all : $(PROGRAMS) diff --git a/catsprintf.c b/catsprintf.c index f27ce0f..2b0abb3 100644 --- a/catsprintf.c +++ b/catsprintf.c @@ -63,8 +63,8 @@ dmi_minor* dmiAppendObject(long code, char const *key, const char *format, ...) dmi_minor *o = (dmi_minor *)malloc(sizeof(dmi_minor)); o->id = code; - o->major = &dmiCodesMajor[map_maj[code>>8]]; - o->key = key; + o->major = (dmi_codes_major*)&dmiCodesMajor[map_maj[code>>8]]; + o->key = (char *)key; vsprintf(o->value, format, arg); o->next = last; diff --git a/dmidecode.c b/dmidecode.c index 96210f6..54b0290 100644 --- a/dmidecode.c +++ b/dmidecode.c @@ -2641,11 +2641,10 @@ void dmi_decode(struct dmi_header *h, u16 ver, PyObject* pydata) { } - - + /********************************************************************************/ dmi_minor* last = dmiAppendObject(++minor, "JUNK", "NODATA"); - char *id = last->major->id; + const char *id = last->major->id; PyObject *pymajor = PyDict_New(); PyDict_SetItem(pymajor, PyString_FromString("code"), PyInt_FromLong((long)last->major->code)); PyDict_SetItem(pymajor, PyString_FromString("id"), PyString_FromString(last->major->id)); @@ -2659,6 +2658,7 @@ void dmi_decode(struct dmi_header *h, u16 ver, PyObject* pydata) { PyDict_SetItem(pymajor, PyString_FromString("data"), pyminor); PyDict_SetItem(pydata, PyString_FromString(id), pymajor); + /********************************************************************************/ break; diff --git a/dmidecodemodule.c b/dmidecodemodule.c index 10ee9fc..5b6f63a 100644 --- a/dmidecodemodule.c +++ b/dmidecodemodule.c @@ -4,9 +4,9 @@ static PyObject* dmidecode_get(PyObject *self, char* section) { //mtrace(); - Py_SetProgramName("dmidecode"); - /* + /* This is `embedding API', not applicable to this dmidecode module which is `Extending' + Py_SetProgramName("dmidecode"); int argc = 3; char *argv[4]; argv[0] = "dmidecode"; @@ -35,7 +35,6 @@ static PyObject* dmidecode_get(PyObject *self, char* section) { if(opt.type==NULL) return NULL; PyObject* pydata = PyDict_New(); - Py_INCREF(pydata); /* First try EFI (ia64, Intel-based Mac) */ char efiAddress[32]; @@ -1,7 +1,7 @@ from distutils.core import setup, Extension setup( - name = "DMIDecode", + name = "dmidecode", version = "1.0", description = "A python module rewrite of dmidecode", author = "Nima Talebi", @@ -9,9 +9,10 @@ setup( url = "http://projects.autonomy.net.au/dmidecode/", ext_modules = [ Extension( - "dmidecode", [ "dmidecodemodule.c", "util.c", "catsprintf.c", "dmioem.c", "biosdecode.c", "dmiopt.c", "dmidecode.c" ], - library_dirs=[ "/home/nima/dev-room/projects/dmidecode" ], - libraries=[ "util" ], + "dmidecode", + sources = [ "dmidecodemodule.c", "util.c", "catsprintf.c", "dmioem.c", "biosdecode.c", "dmiopt.c", "dmidecode.c" ], + library_dirs = [ "/home/nima/dev-room/projects/dmidecode" ], + libraries = [ "util" ], ) ] ) |