From 541ee10989640f028d777c9341c63573aac4a55f Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Wed, 10 Jun 2009 19:30:28 +0200 Subject: Discovered another issue with Python and imports The shard library got renamed to dmidecodemodule.so, and this was not clever. When you do 'import dmidecode' in Python, it will look for files in this order: dmidecode dmidecode.so dmidecodemodule.so dmidecode.py dmidecode.pyc This is of course a problem when the wrapper introduced in commit 65c9384ec9b6e265aba11227ffa37ae7a6a787d1 is called dmidecode.py, and Python attempts to load dmidecodemodule.so before dmidecode.py. To solve this, dmidecodemodule.so is now renamed to dmidecodemod.so. --- src/dmidecodemodule.c | 4 ++-- src/setup.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/dmidecodemodule.c b/src/dmidecodemodule.c index 032a189..d0c7043 100644 --- a/src/dmidecodemodule.c +++ b/src/dmidecodemodule.c @@ -676,7 +676,7 @@ void destruct_options(void *ptr) } -PyMODINIT_FUNC initdmidecodemodule(void) +PyMODINIT_FUNC initdmidecodemod(void) { char *dmiver = NULL; PyObject *module = NULL; @@ -689,7 +689,7 @@ PyMODINIT_FUNC initdmidecodemodule(void) opt = (options *) malloc(sizeof(options)+2); memset(opt, 0, sizeof(options)+2); init(opt); - module = Py_InitModule3((char *)"dmidecodemodule", DMIDataMethods, + module = Py_InitModule3((char *)"dmidecodemod", DMIDataMethods, "Python extension module for dmidecode"); version = PyString_FromString("3.10.6"); diff --git a/src/setup.py b/src/setup.py index b45775a..d29cf96 100644 --- a/src/setup.py +++ b/src/setup.py @@ -11,7 +11,7 @@ setup( data_files = [ ('share/python-dmidecode', ['src/pymap.xml']) ], ext_modules = [ Extension( - "dmidecodemodule", + "dmidecodemod", sources = [ "src/dmidecodemodule.c", "src/util.c", -- cgit