# HG changeset patch # User Daniel Jacobs # Date 1266596856 0 # Node ID 9372474d4b0730618d264600e5613fcbda0085f7 # Parent 62e1f66421b1c3fe65948443922d08a2fc35a73b Updates to Raptor Windows installer maker tool. diff -r 62e1f66421b1 -r 9372474d4b07 sbsv2/raptor/util/install-windows/raptorinstallermaker.py --- a/sbsv2/raptor/util/install-windows/raptorinstallermaker.py Thu Feb 18 16:42:28 2010 +0000 +++ b/sbsv2/raptor/util/install-windows/raptorinstallermaker.py Fri Feb 19 16:27:36 2010 +0000 @@ -30,13 +30,28 @@ tempdir = "" parser = optparse.OptionParser() -parser.add_option("-s", "--sbs-home", dest="sbshome", - help="Path to use as SBS_HOME environment variable. If not present the script exits.") -parser.add_option("-w", "--win32-support", dest="win32support", - help="Path to Win32 support directory. If not present the script exits.") + +parser.add_option("-s", "--sbs-home", dest="sbshome", help="Path to use as SBS_HOME environment variable. If not present the script exits.") + +parser.add_option("-w", "--win32-support", dest="win32support", help="Path to Win32 support directory. If not present the script exits.") + +parser.add_option("-b", "--bv", dest="bv", help="Path to Binary variation CPP \"root\" directory. Can be a full/relatitve path; prefix with \"WIN32SUPPORT\\\" to be relative to the Win32 support directory. Omitting this value will assume a default to a path inside the Win32 support directory.") + +parser.add_option("-c", "--cygwin", dest="cygwin", help="Path to Cygwin \"root\" directory. Can be a full/relatitve path; prefix with \"WIN32SUPPORT\\\" to be relative to the Win32 support directory. Omitting this value will assume a default to a path inside the Win32 support directory.") + +parser.add_option("-m", "--mingw", dest="mingw", help="Path to MinGW \"root\" directory. Can be a full/relatitve path; prefix with \"WIN32SUPPORT\\\" to be relative to the Win32 support directory. Omitting this value will assume a default to a path inside the Win32 support directory.") + +parser.add_option("-p", "--python", dest="python", help="Path to Python \"root\" directory. Can be a full/relatitve path; prefix with \"WIN32SUPPORT\\\" to be relative to the Win32 support directory. Omitting this value will assume a default to a path inside the Win32 support directory.") + +parser.add_option("--prefix", dest="versionprefix", help="A string to use as a prefix to the Raptor version string. This will be present in the Raptor installer's file name, the installer's pages as well as the in output from sbs -v.", type="string", default="") + +parser.add_option("--postfix", dest="versionpostfix", help="A string to use as a postfix to the Raptor version string. This will be present in the Raptor installer's file name, the installer's pages as well as the in output from sbs -v.", type="string", default="") (options, args) = parser.parse_args() +# Required directories inside the win32-support repository +win32supportdirs = {"bv":"bv", "cygwin":"cygwin", "mingw":"mingw", "python":"python264"} + if options.sbshome == None: print "ERROR: no SBS_HOME passed in. Exiting..." sys.exit(2) @@ -45,16 +60,33 @@ print "ERROR: no win32support directory specified. Unable to proceed. Exiting..." sys.exit(2) else: - # Required irectories inside the win32-support repository - win32supportdirs = ["bv", "cygwin", "mingw", "python264"] - for dir in win32supportdirs: - if not os.path.isdir(os.path.join(options.win32support, dir)): + # Check for command line overrides to defaults + for directory in win32supportdirs: + print "TEST %s" % directory + value = getattr(options,directory) + print "value = %s" % str(value) + if value != None: # Command line override + if value.lower().startswith("win32support"): + # Strip off "WIN32SUPPORT\" and join to Win32 support location + win32supportdirs[directory] = os.path.join(options.win32support, value[13:]) + else: + # Relative to current directory + win32supportdirs[directory] = value + + else: # Use default location + win32supportdirs[directory] = os.path.join(options.win32support, win32supportdirs[directory]) + + print "\n\nwin32supportdirs = %s\n\n" % win32supportdirs + + # Check that all the specified directories exist and exit if any of them is missing. + for directory in win32supportdirs: + dir = win32supportdirs[directory] + if os.path.isdir(dir): + print "Found directory %s" % dir + else: print "ERROR: directory %s does not exist. Cannot build installer. Exiting..." % dir sys.exit(2) -def parseconfig(xmlFile="raptorinstallermaker.xml"): - pass - def generateinstallerversionheader(sbshome = None): shellenv = os.environ.copy() shellenv["PYTHONPATH"] = os.path.join(sbshome, "python") @@ -83,6 +115,29 @@ fh.close() print "Wrote raptorversion.nsh" return 0 + +def generateinstallerversion(sbshome = None): + shellenv = os.environ.copy() + shellenv["PYTHONPATH"] = os.path.join(sbshome, "python") + + raptorversioncommand = "python -c \"import raptor_version; print raptor_version.numericversion()\"" + + # Raptor version is obtained from raptor_version module's numericversion function. + sbs_version_matcher = re.compile(".*(\d+\.\d+\.\d+).*", re.I) + + # Create Raptor subprocess + versioncommand = subprocess.Popen(raptorversioncommand, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=shellenv) + raptorversion = "" + # Get all the lines matching the RE + for line in versioncommand.stdout.readlines(): + res = sbs_version_matcher.match(line) + if res: + raptorversion = res.group(1) + print "Successfully determined Raptor version %s" % raptorversion + + versioncommand.wait() # Wait for process to end + + return raptorversion def unzipnsis(pathtozip): global tempdir @@ -113,8 +168,14 @@ print "Done." makensispath = unzipnsis(".\\NSIS.zip") -generateinstallerversionheader(options.sbshome) -nsiscommand = makensispath + " /DRAPTOR_LOCATION=%s /DWIN32SUPPORT=%s raptorinstallerscript.nsi" % (options.sbshome, options.win32support) +# generateinstallerversionheader(options.sbshome) +raptorversion = options.versionprefix + generateinstallerversion(options.sbshome) + options.versionpostfix +nsiscommand = makensispath + " /DRAPTOR_LOCATION=%s /DBV_LOCATION=%s /DCYGWIN_LOCATION=%s /DMINGW_LOCATION=%s /DPYTHON_LOCATION=%s /DRAPTOR_VERSION=%s raptorinstallerscript.nsi" % (options.sbshome, + win32supportdirs["bv"], + win32supportdirs["cygwin"], + win32supportdirs["mingw"], + win32supportdirs["python"], + raptorversion) print "nsiscommand = %s" % nsiscommand runmakensis(nsiscommand) cleanup() diff -r 62e1f66421b1 -r 9372474d4b07 sbsv2/raptor/util/install-windows/raptorinstallerscript.nsi --- a/sbsv2/raptor/util/install-windows/raptorinstallerscript.nsi Thu Feb 18 16:42:28 2010 +0000 +++ b/sbsv2/raptor/util/install-windows/raptorinstallerscript.nsi Fri Feb 19 16:27:36 2010 +0000 @@ -44,10 +44,9 @@ # Custom includes (depend on above variables so much be here) !include "raptorinstallerutils.nsh" # Functions and macros for handling environment variables -!include "raptorversion.nsh" # Define the RAPTOR_VERSION variable +# !include "raptorversion.nsh" # Define the RAPTOR_VERSION variable # Defines -# !define /date DATE_STAMP "%Y-%m-%d-%H-%M-%S" !define INSTALLER_NAME "Raptor v${RAPTOR_VERSION}" !define RAPTOR "sbs" !define INSTALLER_FILENAME "${RAPTOR}-${RAPTOR_VERSION}.exe" @@ -112,16 +111,16 @@ File /r /x distribution.policy.s60 ${RAPTOR_LOCATION}\python\*.* SetOutPath "$INSTDIR\schema" File /r /x distribution.policy.s60 ${RAPTOR_LOCATION}\schema\*.* - SetOutPath "$INSTDIR\win32" - File /r /x distribution.policy.s60 ${RAPTOR_LOCATION}\win32\*.* + SetOutPath "$INSTDIR\win32\bin" + File /r /x distribution.policy.s60 ${RAPTOR_LOCATION}\win32\bin\*.* SetOutPath "$INSTDIR\win32\bv" - File /r /x distribution.policy.s60 /x .hg ${WIN32SUPPORT}\bv\*.* + File /r /x distribution.policy.s60 /x .hg ${BV_LOCATION}\*.* SetOutPath "$INSTDIR\win32\cygwin" - File /r /x distribution.policy.s60 /x .hg ${WIN32SUPPORT}\cygwin\*.* + File /r /x distribution.policy.s60 /x .hg ${CYGWIN_LOCATION}\*.* SetOutPath "$INSTDIR\win32\mingw" - File /r /x distribution.policy.s60 /x .hg ${WIN32SUPPORT}\mingw\*.* + File /r /x distribution.policy.s60 /x .hg ${MINGW_LOCATION}\*.* SetOutPath "$INSTDIR\win32\python264" - File /r /x distribution.policy.s60 /x .hg ${WIN32SUPPORT}\python264\*.* + File /r /x distribution.policy.s60 /x .hg ${PYTHON_LOCATION}\*.* SetOutPath "$INSTDIR" File ${RAPTOR_LOCATION}\RELEASE-NOTES.txt