[PATCH 08/24] pynfs: python3 support plan: cStringIO -> StringIO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Jianhong.Yin" <yin-jianhong@xxxxxxx>

try:      # python2
    import cStringIO.StringIO as StringIO
except:   # python3
    from io import StringIO

Signed-off-by: Jianhong Yin <yin-jianhong@xxxxxxx>
---
 nfs4.0/nfs4state.py | 5 ++---
 nfs4.1/fs.py        | 5 ++++-
 xdr/xdrgen.py       | 5 ++++-
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/nfs4.0/nfs4state.py b/nfs4.0/nfs4state.py
index 180e642..cd36edd 100755
--- a/nfs4.0/nfs4state.py
+++ b/nfs4.0/nfs4state.py
@@ -5,10 +5,9 @@ import nfs4acl
 import nfs4lib
 import os, time, array, random, string
 try:
-    import cStringIO
-    StringIO = cStringIO
+    import cStringIO.StringIO as StringIO
 except:
-    import StringIO
+    from io import StringIO
 from stat import *
 import sha
 
diff --git a/nfs4.1/fs.py b/nfs4.1/fs.py
index e2c7eca..e8d413e 100644
--- a/nfs4.1/fs.py
+++ b/nfs4.1/fs.py
@@ -6,7 +6,10 @@ from nfs4lib import NFS4Error
 import struct
 import logging
 from locking import Lock, RWLock
-from cStringIO import StringIO
+try:
+    import cStringIO.StringIO as StringIO
+except:
+    from io import StringIO
 import time
 from xdrdef.nfs4_pack import NFS4Packer
 
diff --git a/xdr/xdrgen.py b/xdr/xdrgen.py
index 0aa1a52..8856b4c 100755
--- a/xdr/xdrgen.py
+++ b/xdr/xdrgen.py
@@ -215,7 +215,10 @@
 
 import sys
 import keyword
-import StringIO
+try:
+    import cStringIO.StringIO as StringIO
+except:
+    from io import StringIO
 import time
 import os
 # Allow to be run stright from package
-- 
2.17.1

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux