Changeset 5619

Show
Ignore:
Timestamp:
08/01/12 07:20:38 (7 years ago)
Author:
justinc
Message:

move to the new Android installer format (a zip file). There is a split
architecture between the APK and zip file.

Location:
seattle/trunk/dist
Files:
1 removed
1 modified

Legend:

Unmodified
Added
Removed
  • seattle/trunk/dist/make_base_installers.py

    r5104 r5619  
    5454LINUX_PATH = "/dist/linux/scripts" 
    5555MAC_PATH = "/dist/mac/scripts" 
    56 ANDROID_PATH = "/dist/android/SeattleOnAndroid" 
    57 ANDROID_ZIP_PATH = "/dist/android/SeattleOnAndroid/res/raw/seattle.zip" 
    5856 
    5957# The path to the directory, relative the trunk, of the OS-specific script 
     
    106104      base_name += ".zip" 
    107105  elif "android" in dist: 
    108     base_name += ".apk" 
     106    base_name += ".zip" 
    109107  else: 
    110108    base_name += ".tgz" 
     
    557555  """ 
    558556  <Purpose> 
    559     Creates an Android-specific package (APK) with the installation. 
     557    Packages the installation files specific to Android into a 
     558    tarball and adds the specific installation scripts for this OS. 
     559    THIS IS CUT AND PASTED FROM ABOVE WITH ONLY MINOR CHANGES.  NEEDS REFACTOR! 
    560560 
    561561  <Arguments> 
     
    577577 
    578578  <Exceptions> 
    579     IOError on bad file paths 
    580     EnvironmentError if the external build tools (Ant, Java) complain 
     579    IOError on bad file paths. 
    581580 
    582581  <Side Effects> 
    583     Puts the final APK in the temporary tarball directory. 
     582    Puts the final zipfile in the temporary tarball directory. 
    584583 
    585584  <Returns> 
    586585    None.   
    587586   """ 
    588   # Create a zipfile for Android. 
    589   installer_zipfile = zipfile.ZipFile(temp_tarball_dir + os.sep + 'seattle.zip', 
    590                                       "w") 
    591  
    592   # Put all general program files into the zipfile. 
     587 
     588  installer_zipfile = zipfile.ZipFile(temp_tarball_dir+os.sep+inst_name, "w") 
     589     
     590  # Put all general installer files into the zip file. 
    593591  for fname in gen_files: 
    594     installer_zipfile.write(temp_install_dir + os.sep + fname, 
    595                             BASE_PROGRAM_FILES_DIR + os.sep + fname) 
    596  
    597   # Close zipfile 
     592    installer_zipfile.write(temp_install_dir + os.sep + fname,BASE_PROGRAM_FILES_DIR + os.sep + fname) 
     593 
     594 
     595  # Put generic files in the zipfile.  (Same as Linux) 
     596  specific_installer_dir = trunk_location + os.sep + LINUX_PATH 
     597  specific_files = os.listdir(specific_installer_dir) 
     598 
     599  # Add the OS-specific files to the zipfile. 
     600  for fname in specific_files: 
     601    if not "svn" in fname and fname != "manifest.txt": 
     602      if "README" in fname or "LICENSE" in fname: 
     603        installer_zipfile.write(specific_installer_dir + os.sep + fname, 
     604                              BASE_INSTALL_DIR + os.sep + fname) 
     605      else: 
     606        installer_zipfile.write(specific_installer_dir + os.sep + fname, 
     607                              BASE_PROGRAM_FILES_DIR + os.sep + fname) 
     608 
     609 
     610 
     611  # Second, copy all script wrappers (which call those in the 
     612  # BASE_PROGRAM_FILES_DIR) to the BASE_INSTALL_DIR. 
     613  script_wrappers_dir = trunk_location + os.sep + LINUX_SCRIPT_WRAPPERS_PATH 
     614  script_wrappers = os.listdir(script_wrappers_dir) 
     615 
     616  # Add script wrappers to the zipfile. 
     617  for fname in script_wrappers: 
     618    if not "svn" in fname: 
     619      installer_zipfile.write(script_wrappers_dir + os.sep + fname, BASE_INSTALL_DIR + os.sep + fname) 
     620 
     621 
    598622  installer_zipfile.close() 
    599623 
    600   # Move zipfile into the resources directory of the Android application 
    601   shutil.move(temp_tarball_dir + os.sep + 'seattle.zip', 
    602               trunk_location + os.sep + ANDROID_ZIP_PATH) 
    603  
    604   # Create APK using ant. 
    605   # Make sure the path to the Android SDK is configured in local.properties 
    606   path_to_localproperties = trunk_location + os.sep + ANDROID_PATH + \ 
    607     os.sep + 'local.properties' 
    608   if not os.path.exists(path_to_localproperties): 
    609     print "Build process for Android failed. See '" + ANDROID_PATH + os.sep, 
    610     print "README' on how to set up '" + path_to_localproperties + "'." 
    611     raise IOError("File '" + path_to_localproperties + "' not found.") 
    612  
    613   # If ant doesn't exist, inform the user appropriately. 
    614   try: 
    615     ant_exit_status = subprocess.call(['ant', 'release'], 
    616                   cwd=trunk_location + os.sep + ANDROID_PATH) 
    617   except OSError: 
    618     # Typical Exceptions are OSErrors 2 (not found) and 13 (permission denied) 
    619     print "Build process for Android failed when calling ant." 
    620     print "Please make sure ant is installed and in your $PATH." 
    621     raise 
    622  
    623   if ant_exit_status != 0: 
    624     print "Build process for Android failed when calling ant." 
    625     raise EnvironmentError("Ant failed with error code " +  
    626       str(ant_exit_status)+".") 
    627  
    628   # Move APK to the temporary tarball directory 
    629   shutil.copyfile(trunk_location + os.sep + ANDROID_PATH + 
    630                   os.sep + '/bin/SeattleOnAndroid-release-unsigned.apk', 
    631                   temp_tarball_dir + os.sep + inst_name) 
    632  
    633   # Clean up after the ant build process 
    634   subprocess.call(['ant', 'clean'], cwd=trunk_location + os.sep + ANDROID_PATH) 
     624 
     625 
    635626 
    636627