summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Sommerseth <davids@redhat.com>2009-06-10 19:30:28 +0200
committerDavid Sommerseth <davids@redhat.com>2009-06-10 19:30:28 +0200
commit541ee10989640f028d777c9341c63573aac4a55f (patch)
tree830a829d75d1f3cbcbf1aede838f4238523745fe
parenta05ca0f0e588031bde35143ba27481f2c5fdea70 (diff)
downloadpython-dmidecode-541ee10989640f028d777c9341c63573aac4a55f.tar.gz
python-dmidecode-541ee10989640f028d777c9341c63573aac4a55f.tar.xz
python-dmidecode-541ee10989640f028d777c9341c63573aac4a55f.zip
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.
-rw-r--r--dmidecode.py2
-rw-r--r--src/dmidecodemodule.c4
-rw-r--r--src/setup.py2
-rwxr-xr-xunit-tests/unit1
4 files changed, 5 insertions, 4 deletions
diff --git a/dmidecode.py b/dmidecode.py
index b97bb34..30c4d92 100644
--- a/dmidecode.py
+++ b/dmidecode.py
@@ -1,5 +1,5 @@
import libxml2
-from dmidecodemodule import *
+from dmidecodemod import *
DMIXML_NODE='n'
DMIXML_DOC='d'
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",
diff --git a/unit-tests/unit b/unit-tests/unit
index 8156945..ac3edab 100755
--- a/unit-tests/unit
+++ b/unit-tests/unit
@@ -80,6 +80,7 @@ sys.stdout.write(LINE)
try:
sys.stdout.write(" * Importing module...")
import libxml2
+# from dmidecodemod import *
import dmidecode
passed()