Skip to content

Instantly share code, notes, and snippets.

@masami256
Created July 4, 2014 09:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masami256/8c7cc412e9e00750a8d7 to your computer and use it in GitHub Desktop.
Save masami256/8c7cc412e9e00750a8d7 to your computer and use it in GitHub Desktop.
Support python2 and python3 in api.py
diff --git a/scripts/osv/modules/api.py b/scripts/osv/modules/api.py
index 59a709d..264e572 100644
--- a/scripts/osv/modules/api.py
+++ b/scripts/osv/modules/api.py
@@ -26,10 +26,17 @@ class java_app(object):
def get_jvm_args(self):
return []
+def get_string_object():
+ import sys
+ if sys.version < '3':
+ return basestring
+ else:
+ return str
+
def _to_args_list(text_or_list):
if not text_or_list:
return []
- if isinstance(text_or_list, basestring):
+ if isinstance(text_or_list, get_string_object()):
return text_or_list.split()
return text_or_list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment