diff --git a/.pywbem.metadata b/.pywbem.metadata new file mode 100644 index 0000000..c1350c6 --- /dev/null +++ b/.pywbem.metadata @@ -0,0 +1 @@ +12344c2915e42cc6abf78d9e81669856e0e528e6 SOURCES/pywbem-20130827.tar.xz diff --git a/README.md b/README.md deleted file mode 100644 index 0e7897f..0000000 --- a/README.md +++ /dev/null @@ -1,5 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 - -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SOURCES/pywbem-20130411-mof_compiler-import.patch b/SOURCES/pywbem-20130411-mof_compiler-import.patch new file mode 100644 index 0000000..845deb6 --- /dev/null +++ b/SOURCES/pywbem-20130411-mof_compiler-import.patch @@ -0,0 +1,22 @@ +diff -up pywbem-20130411/mof_compiler.py.bak pywbem-20130411/mof_compiler.py +--- pywbem-20130411/mof_compiler.py.bak 2009-07-30 00:55:26.000000000 +0200 ++++ pywbem-20130411/mof_compiler.py 2013-05-24 17:40:16.684813502 +0200 +@@ -20,12 +20,12 @@ + + import sys + import os +-import lex +-import yacc +-from lex import TOKEN +-from cim_operations import CIMError, WBEMConnection +-from cim_obj import * +-from cim_constants import * ++from pywbem import lex ++from pywbem import yacc ++from pywbem.lex import TOKEN ++from pywbem.cim_operations import CIMError, WBEMConnection ++from pywbem.cim_obj import * ++from pywbem.cim_constants import * + from getpass import getpass + + _optimize = 1 diff --git a/SOURCES/pywbem-20130723-shebang.patch b/SOURCES/pywbem-20130723-shebang.patch new file mode 100644 index 0000000..acb3453 --- /dev/null +++ b/SOURCES/pywbem-20130723-shebang.patch @@ -0,0 +1,9 @@ +diff -up pywbem-20130723/mof_compiler.py.orig pywbem-20130723/mof_compiler.py +--- pywbem-20130723/mof_compiler.py.orig 2013-08-15 09:35:10.961057738 +0200 ++++ pywbem-20130723/mof_compiler.py 2013-08-15 09:35:16.255079334 +0200 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/python + # + # (C) Copyright 2006-2007 Novell, Inc. + # diff --git a/SOURCES/pywbem-remove-twisted.patch b/SOURCES/pywbem-remove-twisted.patch new file mode 100644 index 0000000..db36a63 --- /dev/null +++ b/SOURCES/pywbem-remove-twisted.patch @@ -0,0 +1,742 @@ +Common subdirectories: old/irecv and pywbem-20130702/irecv +Common subdirectories: old/testsuite and pywbem-20130702/testsuite +diff -u -N old/twisted_client.py pywbem-20130702/twisted_client.py +--- old/twisted_client.py 2010-08-05 02:03:34.000000000 +0200 ++++ pywbem-20130702/twisted_client.py 1970-01-01 01:00:00.000000000 +0100 +@@ -1,736 +0,0 @@ +-# +-# (C) Copyright 2005,2007 Hewlett-Packard Development Company, L.P. +-# +-# This program is free software; you can redistribute it and/or modify +-# it under the terms of the GNU Lesser General Public License as +-# published by the Free Software Foundation; version 2 of the License. +-# +-# This program is distributed in the hope that it will be useful, +-# but WITHOUT ANY WARRANTY; without even the implied warranty of +-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-# GNU Lesser General Public License for more details. +-# +-# You should have received a copy of the GNU Lesser General Public +-# License along with this program; if not, write to the Free Software +-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +-# +- +-# Author: Tim Potter +- +-"""pywbem.twisted - WBEM client bindings for Twisted Python. +- +-This module contains factory classes that produce WBEMClient instances +-that perform WBEM requests over HTTP using the +-twisted.protocols.http.HTTPClient base class. +-""" +- +-from twisted.internet import reactor, protocol, defer +-from twisted.web import http, client, error +- +-from pywbem import CIMClass, CIMClassName, CIMInstance, CIMInstanceName, CIMError, CIMDateTime, cim_types, cim_xml, cim_obj +- +-try: +- from elementtree.ElementTree import fromstring, tostring +-except ImportError, arg: +- from xml.etree.ElementTree import fromstring, tostring +- +-import string, base64 +- +-from types import StringTypes +-from datetime import datetime, timedelta +- +-class WBEMClient(http.HTTPClient): +- """A HTTPClient subclass that handles WBEM requests.""" +- +- status = None +- +- def connectionMade(self): +- """Send a HTTP POST command with the appropriate CIM over HTTP +- headers and payload.""" +- +- self.factory.request_xml = str(self.factory.payload) +- +- self.sendCommand('POST', '/cimom') +- +- self.sendHeader('Host', '%s:%d' % +- (self.transport.addr[0], self.transport.addr[1])) +- self.sendHeader('User-Agent', 'pywbem/twisted') +- self.sendHeader('Content-length', len(self.factory.payload)) +- self.sendHeader('Content-type', 'application/xml') +- +- if self.factory.creds: +- auth = base64.b64encode('%s:%s' % (self.factory.creds[0], +- self.factory.creds[1])) +- +- self.sendHeader('Authorization', 'Basic %s' % auth) +- +- self.sendHeader('CIMOperation', str(self.factory.operation)) +- self.sendHeader('CIMMethod', str(self.factory.method)) +- self.sendHeader('CIMObject', str(self.factory.object)) +- +- self.endHeaders() +- +- # TODO: Figure out why twisted doesn't support unicode. An +- # exception should be thrown by the str() call if the payload +- # can't be converted to the current codepage. +- +- self.transport.write(str(self.factory.payload)) +- +- def handleResponse(self, data): +- """Called when all response data has been received.""" +- +- self.factory.response_xml = data +- +- if self.status == '200': +- self.factory.parseErrorAndResponse(data) +- +- self.factory.deferred = None +- self.transport.loseConnection() +- +- def handleStatus(self, version, status, message): +- """Save the status code for processing when we get to the end +- of the headers.""" +- +- self.status = status +- self.message = message +- +- def handleHeader(self, key, value): +- """Handle header values.""" +- +- import urllib +- if key == 'CIMError': +- self.CIMError = urllib.unquote(value) +- if key == 'PGErrorDetail': +- self.PGErrorDetail = urllib.unquote(value) +- +- def handleEndHeaders(self): +- """Check whether the status was OK and raise an error if not +- using previously saved header information.""" +- +- if self.status != '200': +- +- if not hasattr(self, 'cimerror') or \ +- not hasattr(self, 'errordetail'): +- +- self.factory.deferred.errback( +- CIMError(0, 'HTTP error %s: %s' % +- (self.status, self.message))) +- +- else: +- +- self.factory.deferred.errback( +- CIMError(0, '%s: %s' % (cimerror, errordetail))) +- +-class WBEMClientFactory(protocol.ClientFactory): +- """Create instances of the WBEMClient class.""" +- +- request_xml = None +- response_xml = None +- xml_header = '' +- +- def __init__(self, creds, operation, method, object, payload): +- self.creds = creds +- self.operation = operation +- self.method = method +- self.object = object +- self.payload = payload +- self.protocol = lambda: WBEMClient() +- self.deferred = defer.Deferred() +- +- def clientConnectionFailed(self, connector, reason): +- if self.deferred is not None: +- reactor.callLater(0, self.deferred.errback, reason) +- +- def clientConnectionLost(self, connector, reason): +- if self.deferred is not None: +- reactor.callLater(0, self.deferred.errback, reason) +- +- def imethodcallPayload(self, methodname, localnsp, **kwargs): +- """Generate the XML payload for an intrinsic methodcall.""" +- +- param_list = [pywbem.IPARAMVALUE(x[0], pywbem.tocimxml(x[1])) +- for x in kwargs.items()] +- +- payload = pywbem.CIM( +- pywbem.MESSAGE( +- pywbem.SIMPLEREQ( +- pywbem.IMETHODCALL( +- methodname, +- pywbem.LOCALNAMESPACEPATH( +- [pywbem.NAMESPACE(ns) +- for ns in string.split(localnsp, '/')]), +- param_list)), +- '1001', '1.0'), +- '2.0', '2.0') +- +- return self.xml_header + payload.toxml() +- +- def methodcallPayload(self, methodname, obj, namespace, **kwargs): +- """Generate the XML payload for an extrinsic methodcall.""" +- +- if isinstance(obj, CIMInstanceName): +- +- path = obj.copy() +- +- path.host = None +- path.namespace = None +- +- localpath = pywbem.LOCALINSTANCEPATH( +- pywbem.LOCALNAMESPACEPATH( +- [pywbem.NAMESPACE(ns) +- for ns in string.split(namespace, '/')]), +- path.tocimxml()) +- else: +- localpath = pywbem.LOCALCLASSPATH( +- pywbem.LOCALNAMESPACEPATH( +- [pywbem.NAMESPACE(ns) +- for ns in string.split(namespace, '/')]), +- obj) +- +- def paramtype(obj): +- """Return a string to be used as the CIMTYPE for a parameter.""" +- if isinstance(obj, cim_types.CIMType): +- return obj.cimtype +- elif type(obj) == bool: +- return 'boolean' +- elif isinstance(obj, StringTypes): +- return 'string' +- elif isinstance(obj, (datetime, timedelta)): +- return 'datetime' +- elif isinstance(obj, (CIMClassName, CIMInstanceName)): +- return 'reference' +- elif isinstance(obj, (CIMClass, CIMInstance)): +- return 'string' +- elif isinstance(obj, list): +- return paramtype(obj[0]) +- raise TypeError('Unsupported parameter type "%s"' % type(obj)) +- +- def paramvalue(obj): +- """Return a cim_xml node to be used as the value for a +- parameter.""" +- if isinstance(obj, (datetime, timedelta)): +- obj = CIMDateTime(obj) +- if isinstance(obj, (cim_types.CIMType, bool, StringTypes)): +- return cim_xml.VALUE(cim_types.atomic_to_cim_xml(obj)) +- if isinstance(obj, (CIMClassName, CIMInstanceName)): +- return cim_xml.VALUE_REFERENCE(obj.tocimxml()) +- if isinstance(obj, (CIMClass, CIMInstance)): +- return cim_xml.VALUE(obj.tocimxml().toxml()) +- if isinstance(obj, list): +- if isinstance(obj[0], (CIMClassName, CIMInstanceName)): +- return cim_xml.VALUE_REFARRAY([paramvalue(x) for x in obj]) +- return cim_xml.VALUE_ARRAY([paramvalue(x) for x in obj]) +- raise TypeError('Unsupported parameter type "%s"' % type(obj)) +- +- param_list = [pywbem.PARAMVALUE(x[0], +- paramvalue(x[1]), +- paramtype(x[1])) +- for x in kwargs.items()] +- +- payload = pywbem.CIM( +- pywbem.MESSAGE( +- pywbem.SIMPLEREQ( +- pywbem.METHODCALL(methodname, +- localpath, +- param_list)), +- '1001', '1.0'), +- '2.0', '2.0') +- +- return self.xml_header + payload.toxml() +- +- def parseErrorAndResponse(self, data): +- """Parse returned XML for errors, then convert into +- appropriate Python objects.""" +- +- xml = fromstring(data) +- error = xml.find('.//ERROR') +- +- if error is None: +- self.deferred.callback(self.parseResponse(xml)) +- return +- +- try: +- code = int(error.attrib['CODE']) +- except ValueError: +- code = 0 +- +- self.deferred.errback(CIMError(code, error.attrib['DESCRIPTION'])) +- +- def parseResponse(self, xml): +- """Parse returned XML and convert into appropriate Python +- objects. Override in subclass""" +- +- pass +- +-# TODO: Eww - we should get rid of the tupletree, tupleparse modules +-# and replace with elementtree based code. +- +-import pywbem.tupletree +- +-class EnumerateInstances(WBEMClientFactory): +- """Factory to produce EnumerateInstances WBEM clients.""" +- +- def __init__(self, creds, classname, namespace = 'root/cimv2', **kwargs): +- +- self.classname = classname +- self.namespace = namespace +- +- payload = self.imethodcallPayload( +- 'EnumerateInstances', +- namespace, +- ClassName = CIMClassName(classname), +- **kwargs) +- +- WBEMClientFactory.__init__( +- self, +- creds, +- operation = 'MethodCall', +- method = 'EnumerateInstances', +- object = namespace, +- payload = payload) +- +- def __repr__(self): +- return '<%s(/%s:%s) at 0x%x>' % \ +- (self.__class__, self.namespace, self.classname, id(self)) +- +- def parseResponse(self, xml): +- +- tt = [pywbem.tupletree.xml_to_tupletree(tostring(x)) +- for x in xml.findall('.//VALUE.NAMEDINSTANCE')] +- +- return [pywbem.tupleparse.parse_value_namedinstance(x) for x in tt] +- +-class EnumerateInstanceNames(WBEMClientFactory): +- """Factory to produce EnumerateInstanceNames WBEM clients.""" +- +- def __init__(self, creds, classname, namespace = 'root/cimv2', **kwargs): +- +- self.classname = classname +- self.namespace = namespace +- +- payload = self.imethodcallPayload( +- 'EnumerateInstanceNames', +- namespace, +- ClassName = CIMClassName(classname), +- **kwargs) +- +- WBEMClientFactory.__init__( +- self, +- creds, +- operation = 'MethodCall', +- method = 'EnumerateInstanceNames', +- object = namespace, +- payload = payload) +- +- def __repr__(self): +- return '<%s(/%s:%s) at 0x%x>' % \ +- (self.__class__, self.namespace, self.classname, id(self)) +- +- def parseResponse(self, xml): +- +- tt = [pywbem.tupletree.xml_to_tupletree(tostring(x)) +- for x in xml.findall('.//INSTANCENAME')] +- +- names = [pywbem.tupleparse.parse_instancename(x) for x in tt] +- +- [setattr(n, 'namespace', self.namespace) for n in names] +- +- return names +- +-class GetInstance(WBEMClientFactory): +- """Factory to produce GetInstance WBEM clients.""" +- +- def __init__(self, creds, instancename, namespace = 'root/cimv2', **kwargs): +- +- self.instancename = instancename +- self.namespace = namespace +- +- payload = self.imethodcallPayload( +- 'GetInstance', +- namespace, +- InstanceName = instancename, +- **kwargs) +- +- WBEMClientFactory.__init__( +- self, +- creds, +- operation = 'MethodCall', +- method = 'GetInstance', +- object = namespace, +- payload = payload) +- +- def __repr__(self): +- return '<%s(/%s:%s) at 0x%x>' % \ +- (self.__class__, self.namespace, self.instancename, id(self)) +- +- def parseResponse(self, xml): +- +- tt = pywbem.tupletree.xml_to_tupletree( +- tostring(xml.find('.//INSTANCE'))) +- +- return pywbem.tupleparse.parse_instance(tt) +- +-class DeleteInstance(WBEMClientFactory): +- """Factory to produce DeleteInstance WBEM clients.""" +- +- def __init__(self, creds, instancename, namespace = 'root/cimv2', **kwargs): +- +- self.instancename = instancename +- self.namespace = namespace +- +- payload = self.imethodcallPayload( +- 'DeleteInstance', +- namespace, +- InstanceName = instancename, +- **kwargs) +- +- WBEMClientFactory.__init__( +- self, +- creds, +- operation = 'MethodCall', +- method = 'DeleteInstance', +- object = namespace, +- payload = payload) +- +- def __repr__(self): +- return '<%s(/%s:%s) at 0x%x>' % \ +- (self.__class__, self.namespace, self.instancename, id(self)) +- +-class CreateInstance(WBEMClientFactory): +- """Factory to produce CreateInstance WBEM clients.""" +- +- # TODO: Implement __repr__ method +- +- def __init__(self, creds, instance, namespace = 'root/cimv2', **kwargs): +- +- payload = self.imethodcallPayload( +- 'CreateInstance', +- namespace, +- NewInstance = instance, +- **kwargs) +- +- WBEMClientFactory.__init__( +- self, +- creds, +- operation = 'MethodCall', +- method = 'CreateInstance', +- object = namespace, +- payload = payload) +- +- def parseResponse(self, xml): +- +- tt = pywbem.tupletree.xml_to_tupletree( +- tostring(xml.find('.//INSTANCENAME'))) +- +- return pywbem.tupleparse.parse_instancename(tt) +- +-class ModifyInstance(WBEMClientFactory): +- """Factory to produce ModifyInstance WBEM clients.""" +- +- # TODO: Implement __repr__ method +- +- def __init__(self, creds, instancename, instance, namespace = 'root/cimv2', +- **kwargs): +- +- wrapped_instance = CIMNamedInstance(instancename, instance) +- +- payload = self.imethodcallPayload( +- 'ModifyInstance', +- namespace, +- ModifiedInstance = wrapped_instance, +- **kwargs) +- +- WBEMClientFactory.__init__( +- self, +- creds, +- operation = 'MethodCall', +- method = 'ModifyInstance', +- object = namespace, +- payload = payload) +- +-class EnumerateClassNames(WBEMClientFactory): +- """Factory to produce EnumerateClassNames WBEM clients.""" +- +- def __init__(self, creds, namespace = 'root/cimv2', **kwargs): +- +- self.localnsp = LocalNamespacePath +- +- payload = self.imethodcallPayload( +- 'EnumerateClassNames', +- namespace, +- **kwargs) +- +- WBEMClientFactory.__init__( +- self, +- creds, +- operation = 'MethodCall', +- method = 'EnumerateClassNames', +- object = LocalNamespacePath, +- payload = payload) +- +- def __repr__(self): +- return '<%s(/%s) at 0x%x>' % \ +- (self.__class__, self.namespace, id(self)) +- +- def parseResponse(self, xml): +- +- tt = [pywbem.tupletree.xml_to_tupletree(tostring(x)) +- for x in xml.findall('.//CLASSNAME')] +- +- return [pywbem.tupleparse.parse_classname(x) for x in tt] +- +-class EnumerateClasses(WBEMClientFactory): +- """Factory to produce EnumerateClasses WBEM clients.""" +- +- def __init__(self, creds, namespace = 'root/cimv2', **kwargs): +- +- self.localnsp = LocalNamespacePath +- +- payload = self.imethodcallPayload( +- 'EnumerateClasses', +- namespace, +- **kwargs) +- +- WBEMClientFactory.__init__( +- self, +- creds, +- operation = 'MethodCall', +- method = 'EnumerateClasses', +- object = namespace, +- payload = payload) +- +- def __repr__(self): +- return '<%s(/%s) at 0x%x>' % \ +- (self.__class__, self.namespace, id(self)) +- +- def parseResponse(self, xml): +- +- tt = [pywbem.tupletree.xml_to_tupletree(tostring(x)) +- for x in xml.findall('.//CLASS')] +- +- return [pywbem.tupleparse.parse_class(x) for x in tt] +- +-class GetClass(WBEMClientFactory): +- """Factory to produce GetClass WBEM clients.""" +- +- def __init__(self, creds, classname, namespace = 'root/cimv2', **kwargs): +- +- self.classname = classname +- self.namespace = namespace +- +- payload = self.imethodcallPayload( +- 'GetClass', +- namespace, +- ClassName = CIMClassName(classname), +- **kwargs) +- +- WBEMClientFactory.__init__( +- self, +- creds, +- operation = 'MethodCall', +- method = 'GetClass', +- object = namespace, +- payload = payload) +- +- def __repr__(self): +- return '<%s(/%s:%s) at 0x%x>' % \ +- (self.__class__, self.namespace, self.classname, id(self)) +- +- def parseResponse(self, xml): +- +- tt = pywbem.tupletree.xml_to_tupletree( +- tostring(xml.find('.//CLASS'))) +- +- return pywbem.tupleparse.parse_class(tt) +- +-class Associators(WBEMClientFactory): +- """Factory to produce Associators WBEM clients.""" +- +- # TODO: Implement __repr__ method +- +- def __init__(self, creds, obj, namespace = 'root/cimv2', **kwargs): +- +- if isinstance(obj, CIMInstanceName): +- kwargs['ObjectName'] = obj +- else: +- kwargs['ObjectName'] = CIMClassName(obj) +- +- payload = self.imethodcallPayload( +- 'Associators', +- namespace, +- **kwargs) +- +- WBEMClientFactory.__init__( +- self, +- creds, +- operation = 'MethodCall', +- method = 'Associators', +- object = namespace, +- payload = payload) +- +-class AssociatorNames(WBEMClientFactory): +- """Factory to produce AssociatorNames WBEM clients.""" +- +- # TODO: Implement __repr__ method +- +- def __init__(self, creds, obj, namespace = 'root/cimv2', **kwargs): +- +- if isinstance(obj, CIMInstanceName): +- kwargs['ObjectName'] = obj +- else: +- kwargs['ObjectName'] = CIMClassName(obj) +- +- payload = self.imethodcallPayload( +- 'AssociatorNames', +- namespace, +- **kwargs) +- +- WBEMClientFactory.__init__( +- self, +- creds, +- operation = 'MethodCall', +- method = 'AssociatorNames', +- object = namespace, +- payload = payload) +- +- def parseResponse(self, xml): +- +- if len(xml.findall('.//INSTANCENAME')) > 0: +- +- tt = [pywbem.tupletree.xml_to_tupletree(tostring(x)) +- for x in xml.findall('.//INSTANCENAME')] +- +- return [pywbem.tupleparse.parse_instancename(x) for x in tt] +- +- else: +- +- tt = [pywbem.tupletree.xml_to_tupletree(tostring(x)) +- for x in xml.findall('.//OBJECTPATH')] +- +- return [pywbem.tupleparse.parse_objectpath(x)[2] for x in tt] +- +-class References(WBEMClientFactory): +- """Factory to produce References WBEM clients.""" +- +- def __init__(self, creds, obj, namespace = 'root/cimv2', **kwargs): +- +- if isinstance(obj, CIMInstanceName): +- kwargs['ObjectName'] = obj +- else: +- kwargs['ObjectName'] = CIMClassName(obj) +- +- payload = self.imethodcallPayload( +- 'References', +- namespace, +- **kwargs) +- +- WBEMClientFactory.__init__( +- self, +- creds, +- operation = 'MethodCall', +- method = 'References', +- object = namespace, +- payload = payload) +- +-class ReferenceNames(WBEMClientFactory): +- """Factory to produce ReferenceNames WBEM clients.""" +- +- # TODO: Implement __repr__ method +- +- def __init__(self, creds, obj, namespace = 'root/cimv2', **kwargs): +- +- if isinstance(obj, CIMInstanceName): +- kwargs['ObjectName'] = obj +- else: +- kwargs['ObjectName'] = CIMClassName(obj) +- +- payload = self.imethodcallPayload( +- 'ReferenceNames', +- namespace, +- **kwargs) +- +- WBEMClientFactory.__init__( +- self, +- creds, +- operation = 'MethodCall', +- method = 'ReferenceNames', +- object = namespace, +- payload = payload) +- +- def parseResponse(self, xml): +- +- if len(xml.findall('.//INSTANCENAME')) > 0: +- +- tt = [pywbem.tupletree.xml_to_tupletree(tostring(x)) +- for x in xml.findall('.//INSTANCENAME')] +- +- return [pywbem.tupleparse.parse_instancename(x) for x in tt] +- +- else: +- +- tt = [pywbem.tupletree.xml_to_tupletree(tostring(x)) +- for x in xml.findall('.//OBJECTPATH')] +- +- return [pywbem.tupleparse.parse_objectpath(x)[2] for x in tt] +- +-class InvokeMethod(WBEMClientFactory): +- """Factory to produce InvokeMethod WBEM clients.""" +- +- def __init__(self, creds, MethodName, ObjectName, namespace = 'root/cimv2', +- **kwargs): +- +- # Convert string to CIMClassName +- +- obj = ObjectName +- +- if isinstance(obj, StringTypes): +- obj = CIMClassName(obj, namespace = namespace) +- +- if isinstance(obj, CIMInstanceName) and obj.namespace is None: +- obj = ObjectName.copy() +- obj.namespace = namespace +- +- # Make the method call +- +- payload = self.methodcallPayload( +- MethodName, +- obj, +- namespace, +- **kwargs) +- +- WBEMClientFactory.__init__( +- self, +- creds, +- operation = 'MethodCall', +- method = MethodName, +- object = obj, +- payload = payload) +- +- def parseResponse(self, xml): +- +- # Return value of method +- +- result_xml = pywbem.tupletree.xml_to_tupletree( +- tostring(xml.find('.//RETURNVALUE'))) +- +- result_tt = pywbem.tupleparse.parse_any(result_xml) +- +- result = cim_obj.tocimobj(result_tt[1]['PARAMTYPE'], +- result_tt[2]) +- +- # Output parameters +- +- params_xml = [pywbem.tupletree.xml_to_tupletree(tostring(x)) +- for x in xml.findall('.//PARAMVALUE')] +- +- params_tt = [pywbem.tupleparse.parse_any(x) for x in params_xml] +- +- params = {} +- +- for p in params_tt: +- if p[1] == 'reference': +- params[p[0]] = p[2] +- else: +- params[p[0]] = cim_obj.tocimobj(p[1], p[2]) +- +- return (result, params) diff --git a/SPECS/pywbem.spec b/SPECS/pywbem.spec new file mode 100644 index 0000000..37f9a83 --- /dev/null +++ b/SPECS/pywbem.spec @@ -0,0 +1,122 @@ +%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} +%global svnrev 625 +%global revdate 20130827 + +Name: pywbem +Version: 0.7.0 +Release: 16.%{revdate}svn%{svnrev}%{?dist} +Summary: Python WBEM Client and Provider Interface +Group: Development/Libraries +License: LGPLv2 +URL: http://pywbem.sourceforge.net +# The source for this package was pulled from upstream svn repository. +# Use the following commands to get the archive: +# svn export -r 613 svn://svn.code.sf.net/p/pywbem/code/pywbem/trunk pywbem-20130128 +# tar -cJvf pywbem-20130128.tar.xz pywbem-20130128 +Source0: %{name}-%{revdate}.tar.xz +BuildRequires: python-setuptools-devel +BuildArch: noarch + +# fix module imports in /usr/bin/mofcomp +Patch0: pywbem-20130411-mof_compiler-import.patch +# Remove python-twisted module, we don't want twisted in RHEL +Patch1: pywbem-remove-twisted.patch +# Use system python, in case someone has enabled software collection +# See bug #987039 +Patch2: pywbem-20130723-shebang.patch + +%description +A Python library for making CIM (Common Information Model) operations over HTTP +using the WBEM CIM-XML protocol. It is based on the idea that a good WBEM +client should be easy to use and not necessarily require a large amount of +programming knowledge. It is suitable for a large range of tasks from simply +poking around to writing web and GUI applications. + +WBEM, or Web Based Enterprise Management is a manageability protocol, like +SNMP, standardised by the Distributed Management Task Force (DMTF) available +at http://www.dmtf.org/standards/wbem. + +It also provides a Python provider interface, and is the fastest and +easiest way to write providers on the planet. + +%prep +%setup -q -n %{name}-%{revdate} +%patch0 -p1 -b .mofcomp-imports +%patch1 -p1 +%patch2 -p1 -b .shebang + +%build +# dirty workaround to fix the mof_compiler.py module path +ln -s . pywbem +CFLAGS="%{optflags}" %{__python} setup.py build + +%install +rm -rf %{buildroot} +%{__python} setup.py install -O1 --skip-build --root %{buildroot} +mkdir -p -m755 %{buildroot}%{_bindir} +mv %{buildroot}/%{python_sitelib}/%{name}/wbemcli.py %{buildroot}/%{_bindir}/pywbemcli +mv %{buildroot}/%{python_sitelib}/%{name}/mof_compiler.py %{buildroot}/%{_bindir}/mofcomp +rm %{buildroot}/%{python_sitelib}/%{name}/wbemcli.py[co] +rm %{buildroot}/%{python_sitelib}/%{name}/mof_compiler.py[co] + +%clean +rm -rf %{buildroot} + +%files +%{python_sitelib}/* +%attr(755,root,root) %{_bindir}/mofcomp +%attr(755,root,root) %{_bindir}/pywbemcli +%doc README + +%changelog +* Tue Aug 27 2013 Jan Safranek 0.7.0-16.20130827svn625 +- Fixed parsing of ipv6 addresses. + +* Thu Aug 15 2013 Jan Safranek 0.7.0-15.20130723svn623 +- Fixed /usr/bin/mofcomp shebang to use system python (rhbz#987039). + +* Tue Aug 13 2013 Jan Safranek 0.7.0-14.20130723svn623 +- Fixed certificate verification issue. + +* Tue Jul 23 2013 0.7.0-13.20130723svn623 +- Fixed checking of CIMVERSION in CIM-XML. + +* Tue Jul 16 2013 Jan Safranek 0.7.0-12.20130702svn622 +- Removed dependency on python-twisted. + +* Tue Jul 2 2013 Jan Safranek 0.7.0-11.20130702svn622 +- New upstream version. +- Method parameters are now case-insensitive. + +* Fri May 24 2013 Tomas Bzatek 0.7.0-10.20130411svn619 +- Fix module imports in /usr/bin/mofcomp + +* Thu Apr 11 2013 Jan Safranek 0.7.0-9.20130411svn619 +- New upstream version. +- Removed debug 'print' statements. + +* Mon Jan 28 2013 Michal Minar 0.7.0-8.20130128svn613 +- New upstream version. +- Added post-release snapshot version info. +- Removed obsoleted BuildRoot, + +* Sat Jul 21 2012 Fedora Release Engineering - 0.7.0-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Sat Jan 14 2012 Fedora Release Engineering - 0.7.0-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Wed Feb 09 2011 Fedora Release Engineering - 0.7.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Thu Jul 22 2010 David Malcolm - 0.7.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild + +* Fri Jan 01 2010 David Nalley 0.7.0-3 +- refined requires for epel compat +* Sun Jun 28 2009 David Nalley 0.7.0-2 +- Added some verbiage regarding what WBEM is and expanding WBEM and CIM acronyms +- Added python-twisted as a dependency +* Thu Jun 25 2009 David Nalley 0.7.0-1 +- Initial packaging +