Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Find and remove all occurrences of instantiating AndroidSDK with api …

…level 4. There were many places where an api level was passed just because it had to be, so I made that argument to AndroidSDK's constructor a named argument with a default value set to a constant at the top of androidsdk.py. Now we only need to change in one place next time we up the level. TIMOB-3592
  • Loading branch information...
commit 3baed7f8ea79d5713ee6b23be5b3373e7c1d07b1 1 parent 4ec4579
@billdawson billdawson authored
View
2  support/android/android.py
@@ -287,6 +287,6 @@ def create(self, dir, build_time=False, project_dir=None):
print "Usage: %s <name> <id> <directory> <sdk>" % os.path.basename(sys.argv[0])
sys.exit(1)
- sdk = AndroidSDK(sys.argv[4], 4)
+ sdk = AndroidSDK(sys.argv[4])
android = Android(sys.argv[1], sys.argv[2], sdk, None, 'java')
android.create(sys.argv[3])
View
8 support/android/androidsdk.py
@@ -5,6 +5,8 @@
import os, sys, platform, glob, subprocess, types, re
+DEFAULT_API_LEVEL = 7
+
android_api_levels = {
3: 'android-1.5',
4: 'android-1.6',
@@ -36,7 +38,7 @@ def is_offline(self):
return self.offline
class AndroidSDK:
- def __init__(self, android_sdk, api_level):
+ def __init__(self, android_sdk, api_level=DEFAULT_API_LEVEL):
self.android_sdk = self.find_sdk(android_sdk)
if self.android_sdk is None:
raise Exception('No Android SDK directory found')
@@ -305,7 +307,7 @@ def jdwp_kill(self, app_id, adb_args=None, forward_port=51111):
if sdk_path == '-':
sdk_path = None
- api_level = 7
+ api_level = DEFAULT_API_LEVEL
if len(sys.argv) > 2:
api_level = int(sys.argv[2])
try:
@@ -315,4 +317,4 @@ def jdwp_kill(self, app_id, adb_args=None, forward_port=51111):
print "ANDROID_PLATFORM=%s" % sdk.get_platform_dir()
print "GOOGLE_APIS=%s" % sdk.get_google_apis_dir()
except Exception, e:
- print >>sys.stderr, e
+ print >>sys.stderr, e
View
2  support/android/avd.py
@@ -41,6 +41,6 @@ def get_avds(sdk):
print "Usage: %s <directory>" % os.path.basename(sys.argv[0])
sys.exit(1)
- sdk = AndroidSDK(os.path.expanduser(dequote(sys.argv[1])), 7)
+ sdk = AndroidSDK(os.path.expanduser(dequote(sys.argv[1])))
print get_avds(sdk)
View
4 support/android/devices.py
@@ -8,7 +8,7 @@
sys.exit(1)
-sdk = AndroidSDK(sys.argv[1], 4)
+sdk = AndroidSDK(sys.argv[1])
devices = sdk.list_devices()
json = "["
@@ -16,4 +16,4 @@
json += "{\"name\": \"%s\", \"port\": %d, \"is_emulator\": %s, \"is_offline\": %s}" % (device.get_name(), device.get_port(), str(device.is_emulator()).lower(), str(device.is_offline()).lower())
json += "]"
-print json
+print json
View
4 support/android/jdwp_kill.py
@@ -11,9 +11,9 @@
device_id = sys.argv[2]
app_id = sys.argv[3]
-sdk = androidsdk.AndroidSDK(android_sdk, 4)
+sdk = androidsdk.AndroidSDK(android_sdk)
try:
sdk.jdwp_kill(app_id, adb_args=['-s', device_id])
except Exception, e:
print >>sys.stderr, 'Error killing App %s on Device %s' % (app_id, device_id)
- traceback.print_exc()
+ traceback.print_exc()
View
4 support/android/prereq.py
@@ -31,10 +31,10 @@ def check_android_sdk():
failed = False
status = "OK"
try:
- sdk = AndroidSDK(None, 7)
+ sdk = AndroidSDK(None)
status = sdk.get_android_sdk()
except Exception, e:
- status = "Missing Android 2.1 SDK: %s" % e
+ status = "Missing default Android SDK: %s" % e
failed = True
return (failed, status)
View
2  support/android/wait_for_device.py
@@ -61,7 +61,7 @@ def wait_for_device(sdk, type, hard_timeout=20):
print 'Usage: %s <path/to/android-sdk> (device|emulator)' % sys.argv[0]
sys.exit(-1)
- sdk = androidsdk.AndroidSDK(sys.argv[1], 4)
+ sdk = androidsdk.AndroidSDK(sys.argv[1])
hard_timeout = 20
type = "e"
View
2  support/module/builder.py
@@ -188,7 +188,7 @@ def main(args):
if is_android(platform):
build_properties = read_properties(open(os.path.join(project_dir, 'build.properties')))
android_sdk_path = os.path.dirname(os.path.dirname(build_properties['android.platform']))
- android_sdk = AndroidSDK(android_sdk_path, 4)
+ android_sdk = AndroidSDK(android_sdk_path)
if command == 'run':
def run_callback(gen_project_dir):
View
2  support/project.py
@@ -31,7 +31,7 @@ def main(args,argc):
from androidsdk import AndroidSDK
android_sdk = args[argc-1].decode("utf-8")
try:
- sdk = AndroidSDK(android_sdk, 4)
+ sdk = AndroidSDK(android_sdk)
except Exception, e:
print >>sys.stderr, e
sys.exit(1)
Please sign in to comment.
Something went wrong with that request. Please try again.