Created
July 4, 2014 09:13
-
-
Save masami256/8c7cc412e9e00750a8d7 to your computer and use it in GitHub Desktop.
Support python2 and python3 in api.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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