[GME-commit] GMESRC/Install/Build GMEBuild.kpf,NONE,1.1 prefs.py,NONE,1.1 build.py,1.11,1.12 tools.py,1.26,1.27 7za.exe,1.1,NONE build.bat,1.2,NONE check.py,1.7,NONE params.py,1.5,NONE testwinzip.bat,1.2,NONE

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Thu Feb 16 22:14:19 CST 2006


Update of /project/gme-repository/GMESRC/Install/Build
In directory escher:/tmp/cvs-serv18737/Install/Build

Modified Files:
	build.py tools.py 
Added Files:
	GMEBuild.kpf prefs.py 
Removed Files:
	7za.exe build.bat check.py params.py testwinzip.bat 
Log Message:
Re-designed build environment, intial check-in

CVS User: Peter Volgyesi, ISIS (volgy)

--- NEW FILE: GMEBuild.kpf ---
<?xml version="1.0" encoding="UTF-8"?>
<!-- Komodo Project File - DO NOT EDIT -->
<project kpf_version="2" id="D501123A-99C8-45DF-A612-74CA83B098E4" name="GMEBuild">
<preference-set id="">
</preference-set>
</project>

--- NEW FILE: prefs.py ---
#!/usr/bin/python
#
# Copyright (c) 2006 ISIS, Vanderbilt Univeristy 
#
# Author: Peter Volgyesi (peter.volgyesi at vanderbilt.edu)
#
"""GME Build System - preferences module"""

import time

#
# Preferences & default values (used by other modules)
#
prefs = {
	"clean" : False,
	"verbose" : False,
	"release" : False,
	"version_major" : time.localtime()[0] % 10,
	"version_minor" : time.localtime()[1],
	"version_patch" : time.localtime()[2]
	}
--- build.bat DELETED ---

--- check.py DELETED ---

--- params.py DELETED ---

--- 7za.exe DELETED ---

Index: tools.py
===================================================================
RCS file: /project/gme-repository/GMESRC/Install/Build/tools.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** tools.py	17 Nov 2005 19:15:38 -0000	1.26
--- tools.py	16 Feb 2006 22:14:17 -0000	1.27
***************
*** 1,91 ****
  #!/usr/bin/python
- # Copyright (c) 2004 ISIS, Vanderbilt Univeristy 
  #
! # Authors: Gyorgy Balogh, Peter Volgyesi
  #
! 
! """ GME Build System
! 
! This file contains useful tools for building GME
! 
! """
  
  import os
  import os.path
  import win32com.client
  
! def runExe( exePath, commandLineParams ):
      """
!     Runs an external exe
      params
!         exePath             : full path of the executable
!         commandLineParams   : command line parameters
      """
!     ret = os.spawnl( os.P_WAIT, exePath, exePath, commandLineParams )
!     if ret != 0:
!         raise "Execution of " + exePath + " failed. Exit code: %d" % (ret,)
  
! def system( command ):
      """
      Executes a system command (throws an exception on error)
      params
          command : command to execute
      """
      ret = os.system( command )
      if ret != 0:
!         raise Exception, command + " failed. Exit code: %d" % (ret,)
  
! def buildVSProject( sln_path, project_name, config_name ):
      """
!     Builds an msdev project
      params
!        dsw_path     : full path of the dsw file
!        config_name  : name of the configuration containing the project name (e.g.: "GME - Win32 Release")
      """
!     print "Compiling " + project_name + "(" + config_name + ") ..."
!     DTE = win32com.client.Dispatch("VisualStudio.DTE")
!     # DTE.MainWindow.Visible = True
      DTE.Solution.Open( sln_path )
!     sb = DTE.Solution.SolutionBuild
!     # sb.Clean(1)
!     sb.BuildProject(config_name, project_name, 1)
!     failed = sb.LastBuildInfo
      DTE.Quit()
-     
      if failed > 0:
!         raise Exception, "In solution " + sln_path + ": " + str(failed) + " project(s) failed to compile."
  
! def xme2mga( xmlFile, mgaFile, paradigm ):
      """
!     Generates .mga file from an .xme file
      """
!     mgaParser  = win32com.client.Dispatch( "MGA.MgaParser" )
!     mgaProject = win32com.client.Dispatch( "MGA.MgaProject" )
!     mgaProject.Create( "MGA="+mgaFile, paradigm )
!     mgaParser.ParseProject( mgaProject, xmlFile )
!     mgaProject.Close()    
!     
  
! def registerParadigm( xmpFile, paradigm ):
!     """    
      """
!     # Get modules for python MgaRegistar interface definitions
          
!     mgaReg = win32com.client.Dispatch( "MGA.MgaRegistrar" )
!     mgaReg.RegisterParadigmFromData( "XML=" + xmpFile, paradigm, 2 )
      
!     return mgaReg.ParadigmGUIDString(2, paradigm)
      
! def buildISProject(ISProject, config, release, properties):
!     print "Building InstallShield - " + ISProject + " - " + config + " - " + release
      ISWiProject = win32com.client.Dispatch( "ISWiAutomation.ISWiProject" )
!     ISWiProject.ImportProject(ISProject + ".ism", ISProject + ".isv")
      ISWiProject.CloseProject()
      
!     ISWiProject.OpenProject(ISProject + ".ism")
      for property in properties.keys():
          ISProperty = ISWiProject.ISWiProperties.Item(property)
          ISProperty.Value = properties[property]
!         print "\tSet property " + ISProperty.Name + " = " + ISProperty.Value
          
      ISConfig = ISWiProject.ISWiProductConfigs.Item(config)
--- 1,181 ----
  #!/usr/bin/python
  #
! # Copyright (c) 2006 ISIS, Vanderbilt Univeristy 
  #
! # Author: Peter Volgyesi (peter.volgyesi at vanderbilt.edu)
! #
! """GME Build System - tools module"""
  
  import os
  import os.path
  import win32com.client
+ from prefs import prefs
  
! #
! # Constants
! #
! ZIP_PRG = os.path.abspath("zip.exe")
! 
! #
! # Classes
! #
! class BuildException(Exception):
!     "General Exception Class for all build problems"
!     pass
! 
! #
! # Tools/utilities
! #
! def toolmsg(str):
      """
!     Displays log messages, used by other tool functions
!     """
!     if prefs['verbose']:
!         print "\t" + str + "..."
! 
! def test_CVS():
!     "Test for CVS client. Raises exception if not found."
!     system("cvs -v >NUL")
! 
! 
! def test_zip():
!     "Test for ZIP utility. Raises exception if not found."
!     system(ZIP_PRG + " >NUL")
!     
!     
! def zip(dirname, zipname, list=None):
!     """
!     Build zip archive in the specified directory.
!     The optional 'list' argument can specify the name of the file containing the
!     include patterns for the archive.
      params
!         dirname : the path to the root of the files to be archived
!         zipname : the name of the zip archive (will be created in 'dirname')
!         list    : name of the list file (see above)
      """
!     if list is not None:
!         list_arg = "-i@" + list
!     else:
!         list_arg = ""
!     cmd_line = "%s -9 -r %s %s" % (ZIP_PRG, list_arg, zipname)
!     system(cmd_line, dirname)
  
! 
! def system(command, dirname=None):
      """
      Executes a system command (throws an exception on error)
      params
          command : command to execute
+         dirname : if set, execute the command within this directory
      """
+     if dirname is not None:
+         command = "cd %s && %s" % (dirname, command)
+     toolmsg("Executing " + command)
      ret = os.system( command )
      if ret != 0:
!         raise BuildException, command + " failed. Exit code: " + str(ret)
  
! 
! def test_VS():
!     "Test for Microsoft Visual Studio.NET 2003. Raises exception if not found."
!     toolmsg("Trying to create VisualStudio.DTE object")
!     win32com.client.Dispatch("VisualStudio.DTE.7.1")
! 
! 
! def build_VS(sln_path, project_name, config_name):
      """
!     Builds a Microsoft Visual Studio.NET 2003 project.
!     It cleans the project before building it if the global 'clean' preference
!     is set.
      params
!         sln_path     : full path to the solution (.sln) file
! 	project_name : relative path to the project (.vcproj) file
! 	config_name  : name of the build configuration (e.g.: "Release")
      """
!     toolmsg("Compiling " + sln_path + " [" + project_name + "] (" + config_name + ") ")
!     DTE = win32com.client.Dispatch("VisualStudio.DTE.7.1")
      DTE.Solution.Open( sln_path )
!     builder = DTE.Solution.SolutionBuild
!     if prefs['clean']:
!         builder.Clean(1)
!     builder.BuildProject(config_name, project_name, 1)
!     failed = builder.LastBuildInfo
      DTE.Quit()
      if failed > 0:
!         raise BuildException, "In solution " + sln_path + ": " + str(failed) + " project(s) failed to compile."
  
! def xme2mga(xml_file, paradigm):
      """
!     Generates an .mga file from an .xme file
!     params
!         xml_file    : full path to the xme file 
!         paradigm    : use the specified paradigm to parse the project
!         
!     The generated .mga file will be created with the same name/path but different
!     extension.
      """
!     toolmsg("Parsing " + xml_file + " with paradigm " + paradigm)
!     parser  = win32com.client.Dispatch( "MGA.MgaParser" )
!     project = win32com.client.Dispatch( "MGA.MgaProject" )
!     mga_file = os.path.splitext(xml_file)[0] + ".mga"
!     project.Create( "MGA="+mga_file, paradigm )
!     parser.ParseProject( project, xml_file )
!     project.Close()    
  
!     
! def xmp2mta(xml_file, paradigm):
      """
!     Generates and registers (system-wide) an .mta file from an .xmp file
!     params
!         xml_file    : full path to the xmp file 
!         paradigm    : use the specified paradigm name to parse the paradigm file
          
!     The generated .mta file will be created with the same name/path but different
!     extension.
!     """
!     toolmsg("Parsing and registering" + xml_file + " (" + paradigm + ")")
!     regsitrar = win32com.client.Dispatch( "MGA.MgaRegistrar" )
!     regsitrar.RegisterParadigmFromData( "XML=" + xml_file, paradigm, 2 )
! 
! 
! def query_GUID(paradigm ):
!     """
!     Queries the current GUID of the specified paradigm.
!     In order to work properly the paradigm must be registered (system-wide)
!     before (see: xmp2mta).
!     params
!         paradigm    : the name of the paradigm to be queried
      
!     returns the GUID as a string
!     """ 
!     regsitrar = win32com.client.Dispatch( "MGA.MgaRegistrar" )
!     return regsitrar.ParadigmGUIDString(2, paradigm)
! 
! 
! def test_IS():
!     "Test for InstallShield Developer 8. Raises exception if not found."
!     toolmsg("Trying to create ISWiAutomation.ISWiProject object")
!     win32com.client.Dispatch("ISWiAutomation.ISWiProject")
      
! def build_IS(isv_file, config, release, properties):
!     """
!     Builds an InstallShield Developer 8 project.
!     params
!         isv_file : full path to the InstallShield project (.isv)
!         config   : name of the configuration to be built
!         release  : name of the build configuration (e.g.: "Release")
!         properties : dictionary of properties to set for the project at build time
!     """
!     toolmsg("Building " + isv_file + " - " + config + " - " + release)
!     ism_file = os.path.splitext(isv_file)[0] + ".ism"
      ISWiProject = win32com.client.Dispatch( "ISWiAutomation.ISWiProject" )
!     ISWiProject.ImportProject(ism_file, isv_file)
      ISWiProject.CloseProject()
      
!     ISWiProject.OpenProject(ism_file)
      for property in properties.keys():
          ISProperty = ISWiProject.ISWiProperties.Item(property)
          ISProperty.Value = properties[property]
!         toolmsg("\tSet property " + ISProperty.Name + " = " + ISProperty.Value)
          
      ISConfig = ISWiProject.ISWiProductConfigs.Item(config)
***************
*** 93,114 ****
      ISRelease.Build()
      ISWiProject.CloseProject()
-     print "Errors: " + str(ISRelease.BuildErrorCount)
-     print "Warnings: " + str(ISRelease.BuildWarningCount)
      
      if ISRelease.BuildErrorCount > 0:
!         raise "InstallShield error(s) occured"
!         
!     print "OK"
          
- # custom registry stuff
- 
- """
- def warning( message ):
-     print "warning:" + message
-     
- def error( message ):
-     print "error:" + message
- 
- def message( message ):
-     print message
-     """
--- 183,190 ----
      ISRelease.Build()
      ISWiProject.CloseProject()
      
+     if ISRelease.BuildWarningCount > 0:
+         toolmsg("Warnings found (%d)! Check logfile for details." % (ISRelease.BuildWarningCount))
      if ISRelease.BuildErrorCount > 0:
!         raise BuildException, "InstallShield error(s) occured"
          

--- testwinzip.bat DELETED ---

Index: build.py
===================================================================
RCS file: /project/gme-repository/GMESRC/Install/Build/build.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** build.py	3 Feb 2004 10:53:04 -0000	1.11
--- build.py	16 Feb 2006 22:14:17 -0000	1.12
***************
*** 1,35 ****
  #!/usr/bin/python
- # Copyright (c) 2004 ISIS, Vanderbilt Univeristy 
  #
! # Authors: Peter Volgyesi, Gyorgy Balogh
  #
! # TODO: Create labels in CVS before every release !
! """ GME Build System
  
! This is the main (initial) module of the build system.
! It loads all the modules in the components subdirectory, and
! executes them in the same order as they are listed in components.__all__
  
- It also processes command line parameters and figures out the root
- of the source tree, if it was not specified explicitly.
  
! """
  
- import params, tools, components, check
- from components import *
  
! def buildAll():
! 	for comp in components.__all__:
! 		exec comp + ".build()"
  
- # main entry point
- try:	
- 	params.setDefaultParams()
- 	check.checkAll()
- 	buildAll()	
  	
! 	print "Building process has finished successfully."
! except:
! 	print "Error details:"
! 	raise
  	
--- 1,328 ----
  #!/usr/bin/python
  #
! # Copyright (c) 2006 ISIS, Vanderbilt Univeristy 
  #
! # Author: Peter Volgyesi (peter.volgyesi at vanderbilt.edu)
! #
! """GME Build System - central module"""
  
! import sys
! import os, os.path
! import getopt
! from prefs import prefs
! import tools
! import win32com
  
  
! #
! # Constants
! #
! GME_ROOT = os.path.normpath(os.path.abspath("../.."))
  
  
! # ISvars: GMEVersionStr, GuidStrMetaGME, GuidStrSF, GuidStrUML, GuidStrHFSM
! 
! #
! # Build steps
! #
! 
! def check_prerequisites():
!     "Check prerequisites (required tools, etc.)"
!     # Test for Visual Studio.NET 2003
!     try:
!         tools.test_VS()
!     except:
!         print "Visual Studio.NET 2003 is not installed!"
!         raise
!     
!     # Test for zip utility
!     try:
!         tools.test_zip()
!     except:
!         print "ZIP utility cannot be found!"
!         raise
!     
!     # Test for InstallShield
!     try:
!         tools.test_IS()
!     except:
!         print "InstallShield Developer 8 is not installed!"
!         raise
!     
!     # Test for CVS
!     try:
!         tools.test_CVS()
!     except:
!         print "Warning: CVS client cannot be found! You won't be able to check in & tag releases"
! 
! 
! def update_version_str():
!     "Update version strings in source files"
!     pass
! 
! def compile_GME():
!     "Compile GME core components"
!     sln_file = os.path.join(GME_ROOT, "GME", "GME.sln");
!     tools.build_VS( sln_file, os.path.join("Gme", "Gme.vcproj"), "Release" )
!     cmd_dir = os.path.join(GME_ROOT, "GME");
!     tools.system( "regrelease.bat >NUL", cmd_dir)
! 
! 
! def compile_meta():
!     "Compile MetaGME components"
!     sln_file = os.path.join(GME_ROOT, "Paradigms", "MetaGME", "MetaGME.sln");
!     tools.build_VS( sln_file, os.path.join("MetaDecorator", "MetaDecorator.vcproj"), "Release" )
!     tools.build_VS( sln_file, os.path.join("MetaInterpreter2004", "MetaGME2004.vcproj"), "Release" )
!     tools.build_VS( sln_file, os.path.join("BonExtension", "BonExt.vcproj"), "Release" )
!     tools.build_VS( sln_file, os.path.join("MONTraverser", "MONTraverserBON2Component.vcproj"), "Release" )
!     cmd_dir = os.path.join(GME_ROOT, "Paradigms", "MetaGME");
!     tools.system( "regrelease.bat >NUL", cmd_dir)
! 
! 
! def compile_BON():
!     "Compile C++ component support (BON)"
!     sln_file = os.path.join(GME_ROOT, "SDK", "BON", "tools", "ComponentTools.sln");
!     tools.build_VS( sln_file, os.path.join("CreateNewComponent", "CreateNewComponent.vcproj"), "Release" )
  
  	
! def compile_JBON():
!     "Compile Java component support (JBON)"
!     sln_file = os.path.join(GME_ROOT, "Java", "native", "JavaSupport.sln");
!     tools.build_VS( sln_file, os.path.join("Jaut", "JAUT.vcproj"), "Release" )
!     tools.build_VS( sln_file, os.path.join("JavaCompRunner", "JavaCompRunner.vcproj"), "Release" )
!     tools.build_VS( sln_file, os.path.join("JavaCompRegister", "JavaCompRegister.vcproj"), "Release" )
! 
  	
+ def compile_tools():
+     "Compile external tool components"
+     
+     # Table Editor
+     sln_file = os.path.join(GME_ROOT, "Tools", "GMETableEditor", "Component.sln");
+     tools.build_VS( sln_file, "Component.vcproj", "Release" )
+     
+     # Auto Layout
+     sln_file = os.path.join(GME_ROOT, "Tools", "AutoLayout", "AutoLayout.sln");
+     tools.build_VS( sln_file, "AutoLayout.vcproj", "Release" )
+     
+     # Model Migrate
+     sln_file = os.path.join(GME_ROOT, "Tools", "ModelMigrate", "ModelMigrate.sln");
+     tools.build_VS( sln_file, os.path.join("FrontEnd", "FrontEnd.vcproj"), "Release" )
+     
+     # Pattern Processor
+     sln_file = os.path.join(GME_ROOT, "SDK", "PatProcessor", "BONComponent.sln");
+     tools.build_VS( sln_file, "BONComponent.vcproj", "Release" )
+ 
+ 
+ def compile_samples():
+     "Compile sample components"
+     
+     # SF Paradigm
+     sln_file = os.path.join(GME_ROOT, "Paradigms", "SF", "BON2Interpreter", "BON2Component.sln");
+     tools.build_VS( sln_file, "SFInterpreterBON2Component.vcproj", "Release" )
+     sln_file = os.path.join(GME_ROOT, "Paradigms", "SF", "BON2SFExample", "Bon2Component.sln");
+     tools.build_VS( sln_file, "BON2SFSampleBON2Component.vcproj", "Release" )
+     
+     # HFSM Paradigm
+     sln_file = os.path.join(GME_ROOT, "Paradigms", "HFSM", "interpreter", "BONComponent.sln");
+     tools.build_VS( sln_file, "BONComponent.vcproj", "Release" )
+     
+     # UML Paradigm
+     sln_file = os.path.join(GME_ROOT, "Paradigms", "UML", "decorator", "UMLDecorator.sln");
+     tools.build_VS( sln_file, "UMLDecorator.vcproj", "Release" )
+     
+ 
+ def zip_decorkit():
+     "Create DecoratorKit.zip"
+     zip_dir = os.path.join(GME_ROOT, "SDK", "DecorKit")
+     tools.zip(zip_dir, "DecoratorKit.zip", "packagefiles.lst")
+ 
+ 
+ def zip_dispatchSDK():
+     "Create DispatchComponents.zip"
+     zip_dir = os.path.join(GME_ROOT, "SDK", "DispatchSDK")
+     tools.zip(zip_dir, "DispatchComponents.zip", "packagefiles.lst")
+ 
+ 
+ def zip_metainterpreter():
+     "Create MetaInterpreter2004.zip"
+     zip_dir = os.path.join(GME_ROOT, "Paradigms", "MetaGME", "MetaInterpreter2004")
+     tools.zip(zip_dir, "MetaInterpreter2004.zip", "packagefiles.lst")
+ 
+ 
+ def zip_metainterpreter_framework():
+     "Create MetaInterpreterFramework.zip"
+     zip_dir = os.path.join(GME_ROOT, "Paradigms", "MetaGME", "MetaInterpreterFramework")
+     tools.zip(zip_dir, "MetaInterpreterFramework.zip", "packagefiles.lst")
+ 
+ 
+ def generate_meta_files():
+     "Generate meta files (mta/mga)"
+     meta_root = os.path.join(GME_ROOT, "Paradigms", "MetaGME", "Paradigm")
+     meta_file = os.path.join(meta_root, "MetaGME.xmp")
+     tools.xmp2mta(meta_file, "MetaGME")
+     meta_file = os.path.join(meta_root, "MetaGME-model.xme")
+     tools.xme2mga(sample_file, "MetaGME")
+ 
+ 
+ def generate_sample_files():
+     "Generate sample files (mta/mga)"
+     samples_root = os.path.join(GME_ROOT, "Paradigms")
+     
+     # SF Paradigm
+     sample_file = os.path.join(samples_root, "SF", "SFMeta.xme")
+     tools.xme2mga(sample_file, "MetaGME")
+     sample_file = os.path.join(samples_root, "SF", "SF.xmp")
+     tools.xmp2mta(sample_file, "SF") 
+     sample_file = os.path.join(samples_root, "SF", "SFDemo.xme")
+     tools.xme2mga(sample_file, "SF")
+ 
+     # HFSM Paradigm
+     sample_file = os.path.join(samples_root, "HFSM", "HFSM-Meta.xme")
+     tools.xme2mga(sample_file, "MetaGME")
+     sample_file = os.path.join(samples_root, "HFSM", "HFSM.xmp")
+     tools.xmp2mta(sample_file, "HFSM") 
+     sample_file = os.path.join(samples_root, "HFSM", "HFSM-Demo01.xme")
+     tools.xme2mga(sample_file, "HFSM")
+     sample_file = os.path.join(samples_root, "HFSM", "HFSM-Demo02.xme")
+     tools.xme2mga(sample_file, "HFSM")
+     
+     # UML Paradigm
+     sample_file = os.path.join(samples_root, "UML", "UMLMeta.xme")
+     tools.xme2mga(sample_file, "MetaGME")
+     sample_file = os.path.join(samples_root, "UML", "UML.xmp")
+     tools.xmp2mta(sample_file, "UML")
+ 
+ 
+ def build_msi():
+     "Build InstallShield Project (msi)"
+     # TODO: load IS_vars
+     tools.build_IS(os.path.join(GME_ROOT, "Install.isv"), "FullConfig", "Release", IS_vars)
+ 
+ 
+ def copy_msi():
+     "Copy the install image to the root directory"
+     pass
+ 
+ 
+ def tag_repository():
+     "Check in and Tag CVS repository (only for releases)"
+     pass
+ 
+ 
+ def do_step(num, step):
+     "Executing one building step given in param 'step'"
+     print str(num) + ".", step.__doc__, "..."
+     step()
+ 
+ 
+ #
+ # Main entry point
+ #
+ 
+ build_steps = [
+     check_prerequisites,
+     update_version_str,
+     compile_GME,
+     compile_meta,
+     compile_BON, 
+     compile_JBON,
+     compile_tools,
+     compile_samples, 
+     zip_decorkit, 
+     zip_dispatchSDK, 
+     zip_metainterpreter, 
+     zip_metainterpreter_framework, 
+     generate_meta_files,
+     generate_sample_files, 
+     build_msi,
+     copy_msi,
+     tag_repository
+     ]
+ 
+ start_step = 0
+ end_step = len(build_steps)-1
+ 
+ usage = """
+ usage: %s [OPTION]...
+ Build an installation image (msi) for GME.
+ 
+   -h, --help          display help (this message) and exit
+   -v, --verbose       verbose output (default: %s)
+   -r, --release       build a regular release (default: %s)
+   -c, --clean         clean projects before building them (default: %s)
+   -s, --start=NUM     start at build step 'NUM' (default: %d)
+   -e, --end=NUM       stop at build step 'NUM' (default: %d)
+   -i, --include=NUM   include build step 'NUM' explicitly
+   -x, --exclude=NUM   exclude build step 'NUM' explicitly
+   
+   -V, --version=MAJOR.MINOR.PATCHLEVEL
+                       set build version (default: %d.%d.%d)
+ 
+ \tBuild steps:
+ 
+ \t%s
+ """ % (sys.argv[0],
+        prefs["verbose"],
+        prefs["release"],
+        prefs["clean"],
+        start_step,
+        end_step,
+        prefs["version_major"],
+        prefs["version_minor"],
+        prefs["version_patch"],
+        "\n\t".join([str(build_steps.index(s)) + ": " + s.__doc__ for s in build_steps])
+        )
+ 
+ try:
+     opts, args = getopt.getopt(sys.argv[1:], 'hvrcs:e:i:x:V:',
+                                ["help", "verbose", "release", "clean",
+                                 "start=", "end=", "include=", "exclude=",
+                                 "version="])
+     include_steps = []
+     exclude_steps = []
+     for opt, val in opts:
+         if opt in ("-h", "--help"):
+             print usage
+             sys.exit()
+         if opt in ("-v", "--verbose"):
+             prefs["verbose"] = True
+         if opt in ("-r", "--release"):
+             prefs["release"] = True
+         if opt in ("-c", "--clean"):
+             prefs["clean"] = True
+         if opt in ("-s", "--start"):
+             start_step = int(val)
+         if opt in ("-e", "--end"):
+             end_step = int(val)
+         if opt in ("-i", "--include"):
+             step = int(val)
+             if val not in include_steps:
+                 include_steps.append(step)
+         if opt in ("-x", "--exclude"):
+             step = int(val)
+             if val not in exclude_steps:
+                 exclude_steps.append(step)
+         if opt in ("-V", "--version"):
+             (M, m, p) = val.split(".")
+             prefs["version_major"] = int(M)
+             prefs["version_minor"] = int(m)
+             prefs["version_patch"] = int(p)
+             
+ except (getopt.GetoptError, ValueError, AttributeError), e:
+     print e
+     print usage
+     sys.exit(2)
+ try:
+     for i in range(len(build_steps)):
+         if i in include_steps:
+             do_step(i, build_steps[i])
+             continue
+         if i in exclude_steps:
+             continue
+         if start_step <= i and i <= end_step:
+             do_step(i, build_steps[i])
+ 
+     print "Build SUCCEEDED."
+ except:
+     print "!!! Build FAILED !!!"
+     raise



More information about the GME-commit mailing list