From a18a72fab2a622077d5257003b09be30ab283339 Mon Sep 17 00:00:00 2001 From: Nima Talebi Date: Sat, 23 May 2009 14:37:01 +1000 Subject: More cleanup Don't write to stdout unless in debug mode (with respect to writing to memory devices. Added the xml datafile to setup (distutils). Updated test case (incorporating color and cleaning up tests). --- src/dmidecode.c | 6 ++++++ src/dmidecodemodule.c | 2 +- src/setup-dbg.py | 5 ++--- src/setup.py | 4 ++-- src/xmlpythonizer.c | 2 +- 5 files changed, 12 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/dmidecode.c b/src/dmidecode.c index 9a0baa8..de6fb2a 100644 --- a/src/dmidecode.c +++ b/src/dmidecode.c @@ -4931,7 +4931,9 @@ int dumpling(u8 * buf, const char *dumpfile, u8 mode) if((buff = mem_chunk(base, len, DEFAULT_MEM_DEV)) != NULL) { //. Part 1. +#ifdef NDEBUG printf("# Writing %d bytes to %s.\n", len, dumpfile); +#endif write_dump(32, len, buff, dumpfile, 0); free(buff); @@ -4941,14 +4943,18 @@ int dumpling(u8 * buf, const char *dumpfile, u8 mode) memcpy(crafted, buf, 32); overwrite_dmi_address(crafted + 0x10); +#ifdef NDEBUG printf("# Writing %d bytes to %s.\n", crafted[0x05], dumpfile); +#endif write_dump(0, crafted[0x05], crafted, dumpfile, 1); } else { u8 crafted[16]; memcpy(crafted, buf, 16); overwrite_dmi_address(crafted); +#ifdef NDEBUG printf("# Writing %d bytes to %s.\n", 0x0F, dumpfile); +#endif write_dump(0, 0x0F, crafted, dumpfile, 1); } } else { diff --git a/src/dmidecodemodule.c b/src/dmidecodemodule.c index 20739a1..1b56837 100644 --- a/src/dmidecodemodule.c +++ b/src/dmidecodemodule.c @@ -488,7 +488,7 @@ PyMODINIT_FUNC initdmidecode(void) module = Py_InitModule3((char *)"dmidecode", DMIDataMethods, "Python extension module for dmidecode"); - version = PyString_FromString("2.10"); + version = PyString_FromString("3.10.6"); Py_INCREF(version); PyModule_AddObject(module, "version", version); diff --git a/src/setup-dbg.py b/src/setup-dbg.py index 8b66f21..0b7a2ed 100644 --- a/src/setup-dbg.py +++ b/src/setup-dbg.py @@ -8,6 +8,7 @@ setup( author = "Nima Talebi & David Sommerseth", author_email = "nima@it.net.au, davids@redhat.com", url = "http://projects.autonomy.net.au/python-dmidecode/", + data_files = [ ('share/python-dmidecode-dbg', ['src/pythonmap.xml']) ], ext_modules = [ Extension( "dmidecode", @@ -21,9 +22,7 @@ setup( "src/xmlpythonizer.c" ], include_dirs = [ "/usr/include/libxml2" ], - libraries = [ "util", "xml2" ], - #libraries = [ "util", "xml2", "efence" ], - data_files = [ ('share/python-dmidecode', ['src/pythonmap.xml']) ] + libraries = [ "util", "xml2" ], #[ "util", "xml2", "efence" ], ) ] ) diff --git a/src/setup.py b/src/setup.py index ded7db4..f9904af 100644 --- a/src/setup.py +++ b/src/setup.py @@ -8,6 +8,7 @@ setup( author = "Nima Talebi & David Sommerseth", author_email = "nima@it.net.au, davids@redhat.com", url = "http://projects.autonomy.net.au/python-dmidecode/", + data_files = [ ('share/python-dmidecode', ['src/pythonmap.xml']) ], ext_modules = [ Extension( "dmidecode", @@ -22,8 +23,7 @@ setup( ], include_dirs = [ "/usr/include/libxml2" ], library_dirs = [ "/home/nima/dev-room/projects/dmidecode" ], - libraries = [ "util", "xml2" ], - data_files = [ ('share/python-dmidecode', ['src/pythonmap.xml']) ] + libraries = [ "util", "xml2" ] ) ] ) diff --git a/src/xmlpythonizer.c b/src/xmlpythonizer.c index d987802..dceeaa2 100644 --- a/src/xmlpythonizer.c +++ b/src/xmlpythonizer.c @@ -880,7 +880,7 @@ PyMODINIT_FUNC initxmlpythonizer(void) { Py_InitModule3((char *)"xmlpythonizer", DemoMethods, "XML to Python Proof-of-Concept Python Module"); - PyObject *version = PyString_FromString("2.10"); + PyObject *version = PyString_FromString("3.10.6"); Py_INCREF(version); PyModule_AddObject(module, "version", version); } -- cgit