if not PROJECT_ID_PREFIX or not PROJECT_FOLDER or not PUBLISHER or not PUBLISHER_URL: print 'You need to fill in PROJECT_ID_PREFIX and all that. Use a file named tidevtools_settings.py' sys.exit(1) project_name = sys.argv[1] project_folder = os.path.join(PROJECT_FOLDER, project_name) resources_folder = os.path.join(project_folder, 'Resources') if os.path.exists(project_folder): print "%s already exists." % project_folder sys.exit(1) isWindows = ticommon.is_windows() # Find the Titanium SDK tisdk_path, sdkver = ticommon.find_ti_sdk() if len(tisdk_path) == 0 or not os.path.exists(tisdk_path): print "I couldn't find the Titanium Mobile SDK" sys.exit(1) print "Found Titanium SDK at %s" % tisdk_path android_sdk = ticommon.find_android_sdk() if len(android_sdk) == 0 or not os.path.exists(android_sdk): print "Could not find your android sdk folder. Avoid this in the future by making an ANDROID_SDK env var" sys.exit(1) print "Using Android sdk found at %s" % android_sdk sys.path.append(tisdk_path) sys.path.append(os.path.join(tisdk_path, 'android')) import project, run
def error(msg): print >> sys.stderr, "Error: " + msg sys.exit(1) if not (os.path.exists(tiappXML) or os.path.exists(timoduleXML)): error("No tiapp.xml/timodule.xml found, are you in a Titanium project?") androidSDK = ticommon.find_android_sdk() if not os.path.exists(androidSDK): error("Android SDK directory doesn't exist: %s" % androidSDK) if "TI_VERSION" in os.environ: tiDevSDK = ticommon.find_ti_sdk(version=os.environ["TI_VERSION"])[0] else: tiDevSDK = ticommon.find_ti_sdk()[0] if not os.path.exists(tiDevSDK): error("Titanium Mobile SDK directory doesn't exist: %s" % tiDevSDK) builderScript = os.path.join(tiDevSDK, "android", "builder.py") if not os.path.exists(builderScript): error("Builder script doesn't exist: %s" % builderScript) appInfo = ticommon.get_app_info(projectPath) name = appInfo["name"] id = appInfo["id"]
* http://github.com/billdawson/tidevtools * * Just run this script at the top of a project folder. """ import sys, os, platform, shutil from os import environ as env this_path = os.path.abspath(os.path.dirname(__file__)) sys.path.append(this_path) try: import ticommon except: print >> sys.stderr, "[ERROR] Couldn't load ticommon from %s. It should be sitting side-by-side with this script. Message: &%s." % (this_path, err) sys.exit(1) tisdk = ticommon.find_ti_sdk()[0] if not os.path.exists(tisdk): print >> sys.stderr, "[ERROR] Couldn't locate your Titanium Mobile sdk folder. Please set a TI_DEV_SDK environment variable with the path to the the latest version of the Titanium Mobile SDK." sys.exit(1) sys.path.append(os.path.join(tisdk, "android")) from tilogger import * log = TiLogger(None, level=TiLogger.INFO) if not os.path.exists('tiapp.xml'): log.error("I don't see any tiapp.xml file here. \nLooks like \n%s \nis not a Titanium project folder. Exiting..." % os.getcwd()) sys.exit(1) resources_folder = os.path.join('.', 'Resources') if not os.path.exists(resources_folder): log.error("Couldn't find a Resources folder here.")