Fix python3 compatibility
- basestring type doesn't exist anymore in python 3, use six.string_types
- verify.py uses __future__ module to use print as a function and is now
python 3 compliant
Change-Id: Iddc722af88ff7ec5c4d82daf8bd2dbef959f332c
diff --git a/rdoinfo/__init__.py b/rdoinfo/__init__.py
index a3b0992..408659d 100644
--- a/rdoinfo/__init__.py
+++ b/rdoinfo/__init__.py
@@ -1,11 +1,9 @@
import copy
import collections
+import six
import yaml
-__version__ = '0.2'
-
-
class RdoinfoException(Exception):
msg_fmt = "An unknown error occurred"
@@ -100,7 +98,7 @@
# substitution is very simple, no recursion
new_pkg = copy.copy(pkg)
for key, val in pkg.items():
- if isinstance(val, basestring):
+ if isinstance(val, six.string_types):
try:
new_pkg[key] = val % pkg
except KeyError:
diff --git a/verify.py b/verify.py
index 402780a..4f2fc66 100755
--- a/verify.py
+++ b/verify.py
@@ -1,12 +1,13 @@
#!/usr/bin/env python
+from __future__ import print_function
import rdoinfo
import yaml
def verify(fn):
info = rdoinfo.parse_info_file(fn)
- print yaml.dump(info)
- print "\n%s looks OK" % fn
+ print(yaml.dump(info))
+ print("\n%s looks OK" % fn)
if __name__ == '__main__':