Change in vdsm[master]: py3: introduce a compatibility helper

fromani at redhat.com fromani at redhat.com
Fri Mar 28 12:54:48 UTC 2014


Francesco Romani has uploaded a new change for review.

Change subject: py3: introduce a compatibility helper
......................................................................

py3: introduce a compatibility helper

introduce a module to host all the compatibility
code we need to support python2 and python3 with
the same codebase.

Change-Id: I2af4ccecf72045695ea263c1fc36ef9f76a499ed
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M debian/vdsm-python.install
M lib/vdsm/Makefile.am
A lib/vdsm/compat.py
M vdsm.spec.in
4 files changed, 29 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/96/26196/1

diff --git a/debian/vdsm-python.install b/debian/vdsm-python.install
index 7a78042..135860f 100644
--- a/debian/vdsm-python.install
+++ b/debian/vdsm-python.install
@@ -2,6 +2,7 @@
 ./usr/bin/vdsm-tool
 ./usr/lib/python2.7/dist-packages/vdsm/SecureXMLRPCServer.py
 ./usr/lib/python2.7/dist-packages/vdsm/__init__.py
+./usr/lib/python2.7/dist-packages/vdsm/compat.py
 ./usr/lib/python2.7/dist-packages/vdsm/config.py
 ./usr/lib/python2.7/dist-packages/vdsm/constants.py
 ./usr/lib/python2.7/dist-packages/vdsm/define.py
diff --git a/lib/vdsm/Makefile.am b/lib/vdsm/Makefile.am
index 8575887..223edc7 100644
--- a/lib/vdsm/Makefile.am
+++ b/lib/vdsm/Makefile.am
@@ -23,6 +23,7 @@
 
 dist_vdsmpylib_PYTHON = \
 	__init__.py \
+	compat.py \
 	define.py \
 	exception.py \
 	ipwrapper.py \
diff --git a/lib/vdsm/compat.py b/lib/vdsm/compat.py
new file mode 100644
index 0000000..a183198
--- /dev/null
+++ b/lib/vdsm/compat.py
@@ -0,0 +1,26 @@
+#
+# Copyright 2014 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+
+try:
+    import cPickle as pickle
+except ImportError:  # py3
+    import pickle
+
+pickle  # make pyflakes happy
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 64dce6e..a3343e3 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -1129,6 +1129,7 @@
 %dir %{python_sitearch}/%{vdsm_name}
 %dir %{python_sitearch}/%{vdsm_name}/tool
 %{python_sitearch}/%{vdsm_name}/__init__.py*
+%{python_sitearch}/%{vdsm_name}/compat.py*
 %{python_sitearch}/%{vdsm_name}/config.py*
 %{python_sitearch}/%{vdsm_name}/constants.py*
 %{python_sitearch}/%{vdsm_name}/define.py*


-- 
To view, visit http://gerrit.ovirt.org/26196
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2af4ccecf72045695ea263c1fc36ef9f76a499ed
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>


More information about the vdsm-patches mailing list