Change in vdsm[master]: Import CPopen and IOStream only in python2 to allow test runs

ybronhei at redhat.com ybronhei at redhat.com
Tue Dec 22 13:50:14 UTC 2015


Yaniv Bronhaim has uploaded a new change for review.

Change subject: Import CPopen and IOStream only in python2 to allow test runs
......................................................................

Import CPopen and IOStream only in python2 to allow test runs

Currently we still use CPopen and IOStream in ExecCmd and AsycProc which
works incorrectly over python3. Until fixing those area this patch
allows to run vdsm with python3 by avoiding those imports.

Change-Id: I5ece01ef331fead19e497ac2015955e299907efd
Signed-off-by: Yaniv Bronhaim <ybronhei at redhat.com>
---
M lib/vdsm/utils.py
1 file changed, 7 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/02/50902/1

diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index fd7db78..11b4191 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -30,7 +30,6 @@
 from collections import namedtuple, deque, OrderedDict
 from contextlib import contextmanager
 from fnmatch import fnmatch
-from StringIO import StringIO
 from weakref import proxy
 from .compat import pickle
 import distutils.spawn
@@ -54,7 +53,13 @@
 import time
 import vdsm.infra.zombiereaper as zombiereaper
 
-from cpopen import CPopen
+if sys.version[0] == '2':
+    from StringIO import StringIO
+    from cpopen import CPopen
+else:
+    from warnings import warn
+    warn('execCmd and AsycProc are unsupported on Python 3')
+
 from . import cmdutils
 from . import constants
 


-- 
To view, visit https://gerrit.ovirt.org/50902
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5ece01ef331fead19e497ac2015955e299907efd
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei at redhat.com>


More information about the vdsm-patches mailing list