Package pywbem
[frames] | no frames]

Source Code for Package pywbem

  1  # 
  2  # (C) Copyright 2004,2006 Hewlett-Packard Development Company, L.P. 
  3  # 
  4  # This library is free software; you can redistribute it and/or 
  5  # modify it under the terms of the GNU Lesser General Public 
  6  # License as published by the Free Software Foundation; either 
  7  # version 2.1 of the License, or (at your option) any later version. 
  8  # 
  9  # This program is distributed in the hope that it will be useful, but 
 10  # WITHOUT ANY WARRANTY; without even the implied warranty of 
 11  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
 12  # Lesser General Public License for more details. 
 13  # 
 14  # You should have received a copy of the GNU Lesser General Public 
 15  # License along with this program; if not, write to the Free Software 
 16  # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
 17  # 
 18  # Author: Tim Potter <tpot@hp.com> 
 19  # Author: Martin Pool <mbp@hp.com> 
 20  # 
 21   
 22  """ 
 23  The ``pywbem`` package provides a WBEM client library and some WBEM utility 
 24  commands, all written in pure Python. 
 25   
 26  A WBEM client library allows issuing operations to a WBEM server, using 
 27  the CIM operations over HTTP (CIM-XML) protocol defined in the DMTF standards 
 28  DSP0200 and DSP0201. See http://www.dmtf.org/standards/wbem for information 
 29  about WBEM and for these standards. 
 30   
 31  This package is based on the idea that a good WBEM client should be easy to use 
 32  and not necessarily require a large amount of programming knowledge. It is 
 33  suitable for a large range of tasks from simply poking around to writing web 
 34  and GUI applications. 
 35   
 36  WBEM client library 
 37  ------------------- 
 38   
 39  Class `WBEMConnection` is the main class of the WBEM client library and is a 
 40  good starting point to understand the WBEM client API. 
 41   
 42  Importing the ``pywbem`` package causes some names from its sub-modules to 
 43  be folded into the package namespace. 
 44  For example, class `WBEMConnection` is defined in the `cim_operations` 
 45  sub-module and is folded into the package namespace:: 
 46   
 47      import pywbem 
 48      conn = pywbem.WBEMConnection(...) 
 49   
 50  it can also be used from its sub-module:: 
 51   
 52      from pywbem.cim_operations import WBEMConnection 
 53      conn = WBEMConnection(...) 
 54   
 55  Using the symbol from the package namespace is preferred; but both forms are 
 56  supported. 
 57   
 58  Not all public symbols from all sub-modules of the ``pywbem`` package are part 
 59  of the external API of the WBEM client library. The external API generally 
 60  consists of the symbols in the ``pywbem`` package namespace, and the 
 61  corresponding symbols in its sub-modules. 
 62   
 63  Consumers of this package that use other symbols than those from the external 
 64  API are at the risk of suffering from incompatible changes in future versions 
 65  of this package. 
 66   
 67  The Epydoc documentation tool that is used to produce these web pages does 
 68  not list all symbols that are folded into the package namespace, unfortunately 
 69  (as you can see, it lists only the variables, not including `__version__`). 
 70  It does however honor the ``__all__`` variable defining the exported symbols 
 71  in each sub-module, and shows only those exported symbols in the documentation 
 72  that is generated for the sub-modules. In other words, the symbols that 
 73  you can see in the generated documentation for a sub-module is exactly 
 74  what is part of the external API. 
 75   
 76  The external API of the WBEM client library consists of the following symbols: 
 77   
 78  * All symbols exported by the ``pywbem`` package, which are: 
 79   
 80    - `__version__` (string) - Version of the ``pywbem`` package. 
 81   
 82    - The symbols exported from the sub-modules in the remainder of this list, 
 83      folded into the ``pywbem`` package namespace. 
 84   
 85  * All symbols exported by the `cim_operations` module. 
 86   
 87  * All symbols exported by the `cim_constants` module. 
 88   
 89  * All symbols exported by the `cim_types` module. 
 90   
 91  * All symbols exported by the `cim_obj` module. 
 92   
 93  * All symbols exported by the `tupleparse` module. 
 94   
 95  * All symbols exported by the `cim_http` module. 
 96   
 97  WBEM utility commands 
 98  --------------------- 
 99   
100  This package provides the following commands (implemented as Python scripts): 
101   
102  * ``mof_compiler`` : A MOF compiler. 
103   
104    It has a pluggable interface for the MOF repository. The default 
105    implementation of that interface uses a WBEM server as its MOF repository. 
106    It uses the `mof_compiler` module that can also be used by Python programs 
107    that need to compile MOF. 
108   
109    Invoke with ``--help`` for help. 
110   
111    The external API of the MOF compiler consists of the following symbols: 
112   
113    - All symbols exported by the `mof_compiler` module. This includes the 
114      plug interface for the MOF repository. 
115   
116  * ``wbemcli`` : A WBEM client CLI. 
117   
118    It is currently implemented as an interactive shell, and is expected to morph 
119    into a full fledged command line utility in the future. 
120   
121    Invoke with ``--help`` for help, or see the `wbemcli` module. 
122   
123    The WBEM client CLI does not have an external API on its own; it is for the 
124    most part a consumer of the `WBEMConnection` class. 
125   
126  These commands are installed into the Python script directory and should 
127  therefore be available in the command search path. 
128   
129  Experimental components 
130  ----------------------- 
131   
132  This package contains some components that are considered experimental at 
133  this point: 
134   
135  * `cim_provider` :   Module for writing CIM providers in Python. 
136   
137  * `cim_provider2` :  Another module for writing CIM providers in Python. 
138   
139  * `twisted_client` : An experimental alternative WBEM client library that uses 
140    the Python `twisted` package. 
141   
142  These components are included in this package, but they are not covered in the 
143  generated documentation, at this point. 
144   
145  WBEM Listener (``irecv``) 
146  ------------------------- 
147   
148  The PYWBEM Client project on GitHub (https://github.com/pywbem/pywbem) 
149  contains the ``irecv`` package in addition to the ``pywbem`` package. The 
150  ``irecv`` package is a WBEM listener (indication receiver) and is considered 
151  experimental at this point. 
152   
153  It is not included in this package or in the generated documentation, at this 
154  point. 
155   
156  You can get it by accessing the 
157  `irecv directory <https://github.com/pywbem/pywbem/tree/master/irecv>`_ 
158  of the PyWBEM Client project on GitHub. 
159   
160  Version 
161  ------- 
162   
163  For the current version of the ``pywbem`` package, see the `NEWS <NEWS.txt>`_ 
164  file. Its version can also be retrieved from the `pywbem.__version__` 
165  attribute (as a string). 
166   
167  Changes 
168  ------- 
169   
170  The change log is in the `NEWS <NEWS.txt>`_ file. 
171   
172  Compatibility 
173  ------------- 
174   
175  The ``pywbem`` package is supported in these environments: 
176   
177  * on Windows, with Python 2.6, 2.7, 3.4, 3.5, and higher 3.x 
178   
179  * on Linux, with Python 2.6, 2.7, 3.4, 3.5, and higher 3.x 
180   
181  OS X has simply not been tested and is therefore not listed, above. 
182  You are welcome to try it out and report any issues. 
183  """ 
184   
185  # There are submodules, but clients shouldn't need to know about them. 
186  # Importing just this module is enough. 
187  # These are explicitly safe for 'import *' 
188   
189  import sys 
190   
191  from .cim_types import * 
192  from .cim_constants import * 
193  from .cim_operations import * 
194  from .cim_obj import * 
195  from .tupleparse import * 
196  from .cim_http import * 
197   
198  # Version of the pywbem package 
199  # !!! Keep in sync with version stated in module docstring, above !!! 
200  # !!! Keep in sync with version in ../setup.py !!! 
201  # Possible formats are: 
202  #   M.N.Udev   : During development of future M.N.U release 
203  #   M.N.UrcX   : Release candidate X of future M.N.U release 
204  #   M.N.U      : The final M.N.U release 
205  __version__ = '0.8.4' 
206   
207  _python_m = sys.version_info[0] 
208  _python_n = sys.version_info[1] 
209  if _python_m == 2 and _python_n < 6: 
210      raise RuntimeError('On Python 2, PyWBEM requires Python 2.6 or higher') 
211  elif _python_m == 3 and _python_n < 4: 
212      raise RuntimeError('On Python 3, PyWBEM requires Python 3.4 or higher') 
213