summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Exported ptzmap_Free()David Sommerseth2009-04-292-2/+3
|
* Added pythonmap.xml - default XML -> Python mapping setupDavid Sommerseth2009-04-291-7/+28
| | | | Only added mapping for the 'bios' section.
* Added filter and filtervalue attributes to xmlpythonizer's <Map> tagsDavid Sommerseth2009-04-292-12/+78
| | | | | | Using these attributes, only XML data (from the given XPath in 'filter') which matches the value in 'filtervalue' will be added to the Python data.
* Updated xmlpythonizer to support boolean type and dynamic XPath keysDavid Sommerseth2009-04-292-37/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Added support boolean and list:boolean value types * Traversing child nodes and having dynamic keys Now it is possible to do the following: ** test.xml ** <?xml version="1.0" encoding="UTF-8"?> <testdata> <list> <value enabled="1">Option 1</value> <value enabled="0">Option 2</value> <value enabled="1">Option 3</value> </list> </testdata> ** mapping.xml ** <?xml version="1.0" encoding="UTF-8"?> <dmidecode_fieldmap version="1"> <Mapping name="example"> <Map keytype="string" key="/testdata/list/value" valuetype="boolean" value="/testdata/list/value/@enabled"/> </Mapping> </dmidecode_fieldmap> Which should result in: {'Option 1': True, 'Option 2': False, 'Option 3': True'}
* Added generic XML -> Python parserDavid Sommerseth2009-04-294-1/+590
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The xmlpythonizer module will convert any XML data (xmlNode or xmlDoc) and format it as a Python object. The formatting is defined in it's own XML file. Basic format: <dmidecode_fieldmap version="1"> <Mapping name="{name of mapping table}"> <Map keytype="{key type}" key="{key value}" valuetype="{value type} value="{value}"/> </Mapping> </dmidecode_fieldmap> The keytype and key attributes defines the key in the Python Dict. The root element will always be a Python Dict structure. The valid key types are: * constant Uses the value in {key} as the key value * string, integer, float Uses a string value from the data XML to be converted to Python. The value set in the key attribute defines an XPath value which points to the data to be used as a Python dict key. Since Python only supports C strings in the C interface for Python dict keys, integer and float will be treated as strings. The valuetype and value attributes are similar to the keys, but with some more features. Valid valuetypes are: * constant The value given in the value attribute will be used in the value in the Python result. * string, integer, float The value given in the value attribute defines the XPath to the data XML, of where to retrieve the value for the given key. The valuetype defines if the data should be understood as a string, integer or float in the Python result. * list:string, list:integer, list:float This does the same as the string, integer or float type, with a tweak. The data will be put into a list. If the XPath given returns multiple nodes, all of them will be added to this list. * dict The dict valuetype is more special. It should not contain any value attribute. On the other hand, it should contain a sub-level of <Map> tags. In this way, you can build up a multi dimensional Python dict. Example: ** pythonmap.xml ** <?xml version="1.0" encoding="UTF-8"?> <dmidecode_fieldmap version="1"> <Mapping name="example_map"> <Map keytype="constant" key="DemoCase" valuetype="constant" value="XML Pythonizing"/> <Map keytype="constant" key="String1" valuetype="string" value="/example/string1"/> <Map keytype="constant" key="AttribString1" valuetype="integer" value="/example/string1/@int_value"/> <Map keytype="string" key="/example/keyset/@value" valuetype="dict"> <Map keytype="constant" key="Value1" valuetype="string" value="/example/keyset/value1"/> <Map keytype="constant" key="ValueList" valuetype="list:string" value="/example/keyset/valuelist"/> </Map> </Mapping> </dmidecode_fieldmap> ** exampledata.xml ** <?xml version="1.0" encoding="UTF-8"?> <example> <string1 int_value="1234">String value #1</string1> <keyset value="TestData"> <value1>More test data</value1> <valuelist>Value1 in list</valuelist> <valuelist>Value2 in list</valuelist> <valuelist>Value3 in list</valuelist> </keyset> </example> ** C code snippet ** void xmlpythonizer() { xmlDoc *xmlmap = NULL; xmlDoc *xmldata = NULL; ptzMAP *mapping = NULL; PyObject *pythondata = NULL; // Read XML files xmlmap = xmlReadFile("pythonmap.xml", NULL, 0); xmldata = xmlReadFile("exampledata.xml", NULL, 0); // Parse the mapping XML mapping = dmiMAP_ParseMappingXML(xmlmap, "example_map"); // Parse the xmldata into a Python object pythondata = pythonizeXMLdoc(mapping, xmldata); // ..... the program continues to do something useful } The result stored inside the pythondata object should now be something similar to: {'DemoCase': 'XML Pythonizing', 'String1': 'String value #1', 'AttribString1: 1234, 'TestData': {'Value1': 'More test data', 'ValueList': ['Value1 in list','Value2 in list','Value3 in list']} }
* Only consider XML nodes which is of XML_ELEMENT_NODE when finding a specific ↵David Sommerseth2009-04-291-1/+2
| | | | node
* Don't return NULL in dmixml_GetContent(...)David Sommerseth2009-04-291-1/+1
|
* Fixed compiler error due to API changesDavid Sommerseth2009-04-291-1/+1
| | | | This fixes a regression from commit 7f0fa9b2e1afd6aecea0b34b62cf9ebdf075164d
* More XML cleanupDavid Sommerseth2009-04-291-11/+9
|
* Cleaned up the XML dataDavid Sommerseth2009-04-293-374/+79
|
* Do not add XML values if input is "(null)"David Sommerseth2009-04-291-3/+10
|
* Added right trim of xml dataDavid Sommerseth2009-04-291-0/+7
|
* Fixed wrong string handling of DMI data, which caused SEGVDavid Sommerseth2009-04-291-4/+4
|
* Added more XML functionsDavid Sommerseth2009-04-292-0/+58
|
* Added missing copyright detailsDavid Sommerseth2009-04-292-2/+8
|
* Removed all Python dependencies in dmidecode.[ch]David Sommerseth2009-04-294-35/+34
|
* Made it compileDavid Sommerseth2009-04-292-18/+18
|
* Ported most functions to XML interfaceDavid Sommerseth2009-04-293-1282/+1321
| | | | Still do not compile
* Checked in a work in progress - Python dict -> XMLDavid Sommerseth2009-04-292-1124/+1248
| | | | Does not compile yet
* Fixed wrong xmlAttrNode type to xmlAttrDavid Sommerseth2009-04-291-1/+2
|
* Modified setup.py to compile in dmixml.c and link against libxml2David Sommerseth2009-04-291-2/+4
|
* Added dmixml.[ch] - helper function for generating XML nodesDavid Sommerseth2009-04-292-0/+172
|
* Added indenting tool for C code and reindented *.[ch] filesDavid Sommerseth2009-04-2912-4776/+5433
|
* Reverting recent (pointless) change.nima2009-03-3115-0/+5952
| | | | git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@180 abc39116-655e-4be6-ad55-d661dc543056
* Preparing to migrate to GIT.nima2009-03-3115-5952/+0
| | | | git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@179 abc39116-655e-4be6-ad55-d661dc543056
* Fixed bug reported by Ralf Treinen.nima2009-02-222-2/+27
| | | | git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@174 abc39116-655e-4be6-ad55-d661dc543056
* Upped sub-version.nima2009-02-131-1/+1
| | | | git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@172 abc39116-655e-4be6-ad55-d661dc543056
* Versioning now chagned to reflect the version of the upstream (dmidecode)nima2009-02-131-1/+1
| | | | | | | version with which python-dmidecode is in sync with. git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@170 abc39116-655e-4be6-ad55-d661dc543056
* Cleaned up the fix for type(127).nima2008-12-223-25/+57
| | | | | | | | | Added the second type of stuffed bios (upstream). Integrated dmidecode the binary into the test case for a more objective result. git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@163 abc39116-655e-4be6-ad55-d661dc543056
* Fixed the type(127) problem (at least on this machine) - again.nima2008-12-221-9/+2
| | | | git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@162 abc39116-655e-4be6-ad55-d661dc543056
* Handle cases where user does not have appropriate permission to access thenima2008-12-211-6/+15
| | | | | | | memory file or device. git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@155 abc39116-655e-4be6-ad55-d661dc543056
* Cleanup.nima2008-12-202-6/+6
| | | | git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@137 abc39116-655e-4be6-ad55-d661dc543056
* Handle cases where user asks for invalid types.nima2008-12-201-3/+6
| | | | | | | Updated test cases to test for this too. git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@136 abc39116-655e-4be6-ad55-d661dc543056
* Version information now set once during init().nima2008-12-204-180/+150
| | | | | | | | | Bettered test cases. Case 127 magically fixed. git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@135 abc39116-655e-4be6-ad55-d661dc543056
* Removed "detected" from appearing in every single function call. TODO: An ivarnima2008-12-205-27/+48
| | | | | | | | | | | | should be implemented to return this string, so further cleanup is still required; as it stands, there is no access to this information anymore! Updated test case. Further general cleanup. git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@133 abc39116-655e-4be6-ad55-d661dc543056
* Oops - fixed.nima2008-12-191-1/+1
| | | | git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@131 abc39116-655e-4be6-ad55-d661dc543056
* More work on test case.nima2008-12-191-3/+3
| | | | | | | Updated setup.py to reflect new version. git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@128 abc39116-655e-4be6-ad55-d661dc543056
* More testing and fixes.nima2008-12-191-3/+7
| | | | git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@127 abc39116-655e-4be6-ad55-d661dc543056
* Removed a printf() comment.nima2008-12-191-1/+1
| | | | git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@125 abc39116-655e-4be6-ad55-d661dc543056
* Check that the path given with set_dev() is writeable.nima2008-12-192-9/+25
| | | | | | | | | Don't crash when writing to a read-only file, return False instead. Missing an INCREF in get_dev() fixed. git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@124 abc39116-655e-4be6-ad55-d661dc543056
* Test for write permission prior to write attempts.nima2008-12-191-8/+7
| | | | git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@123 abc39116-655e-4be6-ad55-d661dc543056
* The dmidecode.type() call not takes ints, not strings.nima2008-12-181-2/+5
| | | | | | | Adding an example directory. git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@115 abc39116-655e-4be6-ad55-d661dc543056
* More upstream changes implemented, see CHANGELOG by Jean Delvare from thenima2008-12-181-24/+187
| | | | | | | | | period 2008-02-16 to 2008-11-23. These changes have been made, but not yet fully tested. git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@114 abc39116-655e-4be6-ad55-d661dc543056
* Claim to support revision 32 of Intel AP-485 (CPUID). No relevant change sincenima2008-12-171-20/+48
| | | | | | | | | revision 31. Update reference to AMD CPUID document. git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@113 abc39116-655e-4be6-ad55-d661dc543056
* Handle chassis information records of size 19 (DMI type 3).nima2008-12-171-1/+2
| | | | git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@112 abc39116-655e-4be6-ad55-d661dc543056
* Cleaning up source area, ready for debianizing, and rpm after that.nima2008-12-1714-0/+5685
git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@108 abc39116-655e-4be6-ad55-d661dc543056