- Update to 0.16.0:

- Silenced the MOFCompiler class for verbose=False.
  - Fixed that the MOFCompiler could be created with handle=None to
    work against a local repository. It was documented that way,
    but failed with AttributeError
  - Fixed the error that the MOF compilation of a class could fail but
    the error was not surfaced. This only happened when the MOF compiler
    was invoked against a WBEM server, when the class already existed,
    and when the ModifyClass operation that was attempted in
    this case, failed.
  - Fixed that the CIM-XML payload in log entries was spread over
    multiple lines. The payload is now escaped as a single-line
    Python string.
  - Fixed handling of Unicode string in ca_certs parm of
    WBEMConnection on py2
- removed upstreamed patches:
  - silenced_MOFCompiler.patch
  - unittest2-just-say-no.patch
  - replace-yamlordereddictloader-w-yamlloader.patch

OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:wbem/python-pywbem?expand=0&rev=113
This commit is contained in:
Adam Majer 2020-04-02 17:33:41 +00:00 committed by Git OBS Bridge
parent a0889d08c2
commit 399e6071ac
7 changed files with 28 additions and 356 deletions

@ -1,3 +1,27 @@
-------------------------------------------------------------------
Thu Apr 2 16:59:28 UTC 2020 - Adam Majer <adam.majer@suse.de>
- Update to 0.16.0:
- Silenced the MOFCompiler class for verbose=False.
- Fixed that the MOFCompiler could be created with handle=None to
work against a local repository. It was documented that way,
but failed with AttributeError
- Fixed the error that the MOF compilation of a class could fail but
the error was not surfaced. This only happened when the MOF compiler
was invoked against a WBEM server, when the class already existed,
and when the ModifyClass operation that was attempted in
this case, failed.
- Fixed that the CIM-XML payload in log entries was spread over
multiple lines. The payload is now escaped as a single-line
Python string.
- Fixed handling of Unicode string in ca_certs parm of
WBEMConnection on py2
- removed upstreamed patches:
- silenced_MOFCompiler.patch
- unittest2-just-say-no.patch
- replace-yamlordereddictloader-w-yamlloader.patch
-------------------------------------------------------------------
Mon Dec 9 12:00:51 CET 2019 - Matej Cepl <mcepl@suse.com>

@ -19,22 +19,13 @@
%define skip_python2 1
%global modname pywbem
Name: python-pywbem
Version: 0.15.0
Version: 0.16.0
Release: 0
Summary: Python module for making CIM operation calls using the WBEM protocol
License: LGPL-2.1-or-later
Group: System/Management
URL: https://pywbem.github.io/
Source0: https://github.com/pywbem/%{modname}/archive/%{version}.tar.gz#/%{modname}-%{version}.tar.gz
# PATCH-FIX-UPSTREAM unittest2-just-say-no.patch gh#pywbem/pywbem#2003 mcepl@suse.com
# Don't use unittest2, ever
Patch0: unittest2-just-say-no.patch
# PATCH-FIX-UPSTREAM silenced_MOFCompiler.patch gh#pywbem/pywbem#2004 mcepl@suse.com
# fix some failing tests
Patch1: silenced_MOFCompiler.patch
# PATCH-FIX-UPSTREAM replace-yamlordereddictloader-w-yamlloader.patch gh#pywbem/pywbem#2022 mcepl@suse.com
# we can kick off deprecated yamlordereddictloader module from Factory again
Patch2: replace-yamlordereddictloader-w-yamlloader.patch
BuildRequires: %{python_module FormEncode}
BuildRequires: %{python_module M2Crypto}
BuildRequires: %{python_module PyYAML}

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6a08ae720bb6b3f6f4eaa69e6505037e8ca4031aee3ae5560be310591fe44a28
size 4251910

3
pywbem-0.16.0.tar.gz Normal file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5e1177ba0c85a70998313bdfec8454f4d3534a20441fa2844d410a61f3340e8f
size 4256370

@ -1,177 +0,0 @@
From a4b5157715a58c49a22d46ca7962df0708916199 Mon Sep 17 00:00:00 2001
From: Andreas Maier <andreas.r.maier@gmx.de>
Date: Mon, 9 Dec 2019 04:57:28 +0100
Subject: [PATCH] Replaced yamlordereddictloader package with yamlloader
Details:
* The yamlordereddictloader package is deprecated and points to yamlloader
as a replacement. Yamlloader was first released in 2018 as 0.5.0 and
is now at 0.5.5, supporting Python 2.7, and 3.4 and higher.
This change replaces the yamlordereddictloader package with yamlloader
with a minimum version of 0.5.5, but only for Python 2.7 and higher.
For Python 2.6, we are still using yamlordereddictloader.
* The invalidresponseerror.yaml testcase contains illegal Unicode sequences
(in order to test pywbem behavior against them), which gets rejected by the
yaml parser that is used when using the CLoader of yamlloader. Using the
Loader class uses a different yamnl parser that tolerates them.
Therefore, the functiontest/conftest.py class uses
yamlloader.ordereddict.Loader. The server_definitionfile.py file uses
yamlloader.ordereddict.CSafeLoader which seems to be the best default
choice.
*
Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
---
dev-requirements.txt | 3 ++-
docs/changes.rst | 6 ++++++
minimum-constraints.txt | 3 ++-
.../utils/server_definition_file.py | 18 +++++++++++++-----
tests/functiontest/conftest.py | 14 ++++++++++++--
5 files changed, 35 insertions(+), 9 deletions(-)
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -38,7 +38,8 @@ lxml>=4.4.1; python_version >= '3.8'
requests>=2.19.1; python_version == '2.6'
requests>=2.20.1; python_version > '2.6'
decorator>=4.0.11
-yamlordereddictloader>=0.4.0
+yamlordereddictloader>=0.4.0; python_version == '2.6'
+yamlloader>=0.5.5; python_version > '2.6'
funcsigs>=1.0.2
# Indirect dependencies that are needed due to version pinning
--- a/docs/changes.rst
+++ b/docs/changes.rst
@@ -149,6 +149,10 @@ Released: 2019-12-01
native Python types int, long, float. These types cannot occur in this
function, so no tests could be written that test that code.
+* For Python 2.7 and higher, replaced the yamlordereddictloader
+ package with yamlloader, as it was deprecated. For Python 2.6,
+ still using yamlordereddictloader. (See issue #2008)
+
pywbem 0.14.6
-------------
--- a/minimum-constraints.txt
+++ b/minimum-constraints.txt
@@ -85,7 +85,8 @@ lxml==4.4.1; python_version >= '3.8'
requests==2.19.1; python_version == '2.6'
requests==2.20.1; python_version > '2.6'
decorator==4.0.11
-yamlordereddictloader==0.4.0
+yamlordereddictloader==0.4.0; python_version == '2.6'
+yamlloader==0.5.5; python_version > '2.6'
funcsigs==1.0.2
FormEncode==1.3.1
--- a/tests/end2endtest/utils/server_definition_file.py
+++ b/tests/end2endtest/utils/server_definition_file.py
@@ -5,6 +5,7 @@ end2end tests.
from __future__ import absolute_import
+import sys
import os
try:
from collections import OrderedDict
@@ -12,7 +13,13 @@ except ImportError:
from ordereddict import OrderedDict
import errno
import yaml
-import yamlordereddictloader
+
+if sys.version_info[0:2] > (2, 6):
+ import yamlloader # noqa: E402
+ yaml_loader = yamlloader.ordereddict.CSafeLoader
+else:
+ import yamlordereddictloader # noqa: E402
+ yaml_loader = yamlordereddictloader.Loader
SDF_DIR = os.path.join('tests', 'server_definitions')
@@ -44,7 +51,7 @@ class ServerDefinitionFile(object):
try:
with open(self._filepath) as fp:
try:
- data = yaml.load(fp, Loader=yamlordereddictloader.Loader)
+ data = yaml.load(fp, Loader=yaml_loader)
except (yaml.parser.ParserError,
yaml.scanner.ScannerError) as exc:
raise ServerDefinitionFileError(
@@ -65,7 +72,8 @@ class ServerDefinitionFile(object):
raise ServerDefinitionFileError(
"The WBEM server definition file {0!r} is empty".
format(self._filepath))
- if not isinstance(data, OrderedDict):
+ if not isinstance(data, (dict, OrderedDict)):
+ # Starting with py38, this is a standard dict
raise ServerDefinitionFileError(
"The WBEM server definition file {0!r} must contain a "
"dictionary at the top level, but contains {1}".
@@ -77,7 +85,7 @@ class ServerDefinitionFile(object):
"'servers' item, but items: {1}".
format(self._filepath, data.keys()))
servers = data.get('servers')
- if not isinstance(servers, OrderedDict):
+ if not isinstance(servers, (dict, OrderedDict)):
raise ServerDefinitionFileError(
"'servers' in WBEM server definition file {0!r} "
"must be a dictionary, but is a {1}".
@@ -85,7 +93,7 @@ class ServerDefinitionFile(object):
self._servers.update(servers)
server_groups = data.get('server_groups', OrderedDict())
- if not isinstance(server_groups, OrderedDict):
+ if not isinstance(server_groups, (dict, OrderedDict)):
raise ServerDefinitionFileError(
"'server_groups' in WBEM server definition file {0!r} "
"must be a dictionary, but is a {1}".
--- a/tests/functiontest/conftest.py
+++ b/tests/functiontest/conftest.py
@@ -126,6 +126,7 @@ Syntax elements:
from __future__ import absolute_import, print_function
+import sys
import doctest
import socket
import re
@@ -137,7 +138,6 @@ try:
except ImportError:
from ordereddict import OrderedDict
import yaml
-import yamlordereddictloader
import pytest
import httpretty
from httpretty.core import HTTPrettyRequestEmpty, fakesock
@@ -150,6 +150,13 @@ pywbem = import_installed('pywbem') # n
from pywbem._utils import _ensure_unicode
from pywbem._nocasedict import NocaseDict
+if sys.version_info[0:2] > (2, 6):
+ import yamlloader # noqa: E402
+ yaml_loader = yamlloader.ordereddict.Loader
+else:
+ import yamlordereddictloader # noqa: E402
+ yaml_loader = yamlordereddictloader.Loader
+
class ExcThread(threading.Thread):
"""
@@ -231,7 +238,10 @@ class YamlFile(pytest.File):
def collect(self):
with self.fspath.open(encoding='utf-8') as fp:
filepath = self.fspath.relto(self.parent.fspath)
- testcases = yaml.load(fp, Loader=yamlordereddictloader.Loader)
+ # We need to be able to load illegal Unicode sequences for testing,
+ # so we use the non-C loader. This causes the yaml parser to
+ # tolerate these sequences. The C loader rejects them.
+ testcases = yaml.load(fp, Loader=yaml_loader)
for i, testcase in enumerate(testcases):
try:
tc_name = testcase['name']

@ -1,144 +0,0 @@
From 3e81df0040a3679b3488e39ce9e92dec297e71c9 Mon Sep 17 00:00:00 2001
From: Andreas Maier <andreas.r.maier@gmx.de>
Date: Sat, 7 Dec 2019 11:38:35 +0100
Subject: [PATCH] Silenced MOFCompiler for verbose=False; Fixed moftab version
check
Details:
* Silenced the MOFCompiler class for verbose=False. So far, it still printed
messages for generating the YACC parser table, causing one test to fail,
and others to issue useless prints. (Issue #2004)
* Test: Fixed an error in testing the PLY table version in testcases that caused
the LEX/YACC parser table files to be written to the pywbem installation
when using TEST_INSTALLED. (Related to issue #2004)
Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
---
docs/changes.rst | 8 ++++++++
pywbem/mof_compiler.py | 8 +++++---
tests/unittest/pywbem/test_mof_compiler.py | 8 ++++----
tests/utils.py | 21 ++++++++++-----------
4 files changed, 27 insertions(+), 18 deletions(-)
--- a/docs/changes.rst
+++ b/docs/changes.rst
@@ -78,6 +78,14 @@ Released: 2019-12-01
* Fixed several install issues with the lxml, flake8, pywin32, pip, setuptools,
and wheel packages on Python 3.8 on Windows. (See issues #1975, #1980).
+* Silenced the MOFCompiler class for verbose=False. So far, it still printed
+ messages for generating the YACC parser table, causing one test to fail,
+ and others to issue useless prints. (Issue #2004)
+
+* Test: Fixed an error in testing the PLY table version in testcases that caused
+ the LEX/YACC parser table files to be written to the pywbem installation
+ when using TEST_INSTALLED. (Related to issue #2004)
+
**Enhancements:**
* Removed the use of the 'pbr' package because it caused too many undesirable
--- a/pywbem/mof_compiler.py
+++ b/pywbem/mof_compiler.py
@@ -2639,9 +2639,10 @@ def _yacc(verbose=False, out_dir=None):
tabmodule=_tabmodule,
outputdir=out_dir,
write_tables=write_tables,
- debug=True,
+ debug=verbose,
debuglog=yacc.NullLogger(),
- errorlog=yacc.PlyLogger(sys.stdout))
+ errorlog=yacc.PlyLogger(sys.stdout) if verbose
+ else yacc.NullLogger())
def _lex(verbose=False, out_dir=None):
@@ -2675,4 +2676,5 @@ def _lex(verbose=False, out_dir=None):
outputdir=out_dir,
debug=False,
# debuglog = lex.PlyLogger(sys.stdout),
- errorlog=lex.PlyLogger(sys.stdout))
+ errorlog=yacc.PlyLogger(sys.stdout) if verbose
+ else yacc.NullLogger())
--- a/tests/unittest/pywbem/test_mof_compiler.py
+++ b/tests/unittest/pywbem/test_mof_compiler.py
@@ -77,7 +77,7 @@ class MOFTest(unittest.TestCase):
self.mofcomp = MOFCompiler(
MOFWBEMConnection(),
search_paths=[TEST_DMTF_CIMSCHEMA_MOF_DIR],
- verbose=True,
+ verbose=False,
log_func=moflog)
self.partial_schema_file = None
@@ -621,7 +621,7 @@ class TestSchemaSearch(MOFTest):
mofcomp = MOFCompiler(
MOFWBEMConnection(),
search_paths=TEST_DMTF_CIMSCHEMA_MOF_DIR,
- verbose=True,
+ verbose=False,
log_func=moflog)
mofcomp.compile_file(os.path.join(TEST_DMTF_CIMSCHEMA_MOF_DIR,
'System',
@@ -646,7 +646,7 @@ class TestSchemaSearch(MOFTest):
open(moflog_file, 'w')
mofcomp = MOFCompiler(
MOFWBEMConnection(),
- verbose=True,
+ verbose=False,
log_func=moflog)
try:
mofcomp.compile_file(os.path.join(TEST_DMTF_CIMSCHEMA_MOF_DIR,
@@ -2585,7 +2585,7 @@ class Test_CreateInstanceWithDups(unitte
self.mofcomp = MOFCompiler(
MOFWBEMConnectionInstDups(),
search_paths=[TEST_DMTF_CIMSCHEMA_MOF_DIR],
- verbose=True,
+ verbose=False,
log_func=moflog)
self.partial_schema_file = None
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -8,7 +8,7 @@ import sys
import os
from packaging import version
import pytest
-import ply
+from ply import yacc, lex
def skip_if_moftab_regenerated():
@@ -60,22 +60,22 @@ def skip_if_moftab_regenerated():
pywbem_not_tolerant = version.parse(pywbem.__version__) <= \
version.parse('0.14.4') # This causes 0.14.5.devN to be tolerant
mofparsetab_mismatch = version.parse(mofparsetab._tabversion) != \
- version.parse(ply.__version__)
+ version.parse(yacc.__tabversion__)
moflextab_mismatch = version.parse(moflextab._tabversion) != \
- version.parse(ply.__version__)
+ version.parse(lex.__tabversion__)
if test_installed and pywbem_not_tolerant and \
(mofparsetab_mismatch or moflextab_mismatch):
pytest.skip("Cannot run this MOF testcase against an installed "
"pywbem (version {0}, installed at {1}) because that "
- "pywbem version does not tolerate version mismatches "
- "between the current ply version and the ply version that "
- "was used to create the pywbem mof*tab files: "
- "current ply: {2}, ply in mofparsetab.py: {3}, "
- "ply in moflextab.py: {4}".
+ "pywbem version does not tolerate table version mismatches "
+ "between the current ply package and the generated pywbem "
+ "mof*tab files: yacc table version: current ply: {2}, "
+ "mofparsetab.py: {3}, lex table version: current ply: {4}, "
+ "moflextab.py: {5}".
format(pywbem.__version__, pywbem.__file__,
- ply.__version__,
- mofparsetab._tabversion, moflextab._tabversion))
+ yacc.__tabversion__, mofparsetab._tabversion,
+ lex.__tabversion__, moflextab._tabversion))
def import_installed(module_name):

@ -1,22 +0,0 @@
--- a/tests/unittest/pywbem/test_mof_compiler.py
+++ b/tests/unittest/pywbem/test_mof_compiler.py
@@ -8,7 +8,7 @@
from __future__ import print_function, absolute_import
import os
-import unittest2 as unittest # we use assertRaises(exc) introduced in py27
+import unittest # we use assertRaises(exc) introduced in py27
import six
from ply import lex
try:
--- a/tests/unittest/pywbem/test_recorder.py
+++ b/tests/unittest/pywbem/test_recorder.py
@@ -16,7 +16,7 @@ import logging
import logging.handlers
from io import open as _open
-import unittest2 as unittest # we use @skip introduced in py27
+import unittest # we use @skip introduced in py27
import six
from testfixtures import LogCapture, log_capture
# Enabled only to display a tree of loggers