iss: take version from iscc command line or __version__.py
authorSteve Borho <steve@borho.org>
Sun, 16 Aug 2009 21:23:48 -0500
changeset 9356 9488a4d64fb5
parent 9353 3ac42ca1f3e6
child 9357 7ee67a037dcb
iss: take version from iscc command line or __version__.py Requires InnoSetup Preprocessor to be installed.
contrib/win32/mercurial.iss
contrib/win32/win32-build.txt
--- a/contrib/win32/mercurial.iss	Fri Aug 14 11:18:23 2009 +0200
+++ b/contrib/win32/mercurial.iss	Sun Aug 16 21:23:48 2009 -0500
@@ -1,9 +1,25 @@
 ; Script generated by the Inno Setup Script Wizard.
 ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
+
+#ifndef VERSION
+#define FileHandle
+#define FileLine
+#define VERSION = "unknown"
+#if FileHandle = FileOpen(SourcePath + "\..\..\mercurial\__version__.py")
+  #expr FileLine = FileRead(FileHandle)
+  #expr FileLine = FileRead(FileHandle)
+  #define VERSION = Copy(FileLine, Pos('"', FileLine)+1, Len(FileLine)-Pos('"', FileLine)-1)
+#endif
+#if FileHandle
+  #expr FileClose(FileHandle)
+#endif
+#pragma message "Detected Version: " + VERSION
+#endif
+
 [Setup]
 AppCopyright=Copyright 2005-2009 Matt Mackall and others
 AppName=Mercurial
-AppVerName=Mercurial snapshot
+AppVerName=Mercurial {#VERSION}
 InfoAfterFile=contrib/win32/postinstall.txt
 LicenseFile=COPYING
 ShowLanguageDialog=yes
@@ -13,10 +29,10 @@
 AppUpdatesURL=http://mercurial.selenic.com/
 AppID={{4B95A5F1-EF59-4B08-BED8-C891C46121B3}
 AppContact=mercurial@selenic.com
-OutputBaseFilename=Mercurial-snapshot
+OutputBaseFilename=Mercurial-{#VERSION}
 DefaultDirName={pf}\Mercurial
 SourceDir=..\..
-VersionInfoDescription=Mercurial distributed SCM
+VersionInfoDescription=Mercurial distributed SCM (version {#VERSION})
 VersionInfoCopyright=Copyright 2005-2009 Matt Mackall and others
 VersionInfoCompany=Matt Mackall and others
 InternalCompressLevel=max
--- a/contrib/win32/win32-build.txt	Fri Aug 14 11:18:23 2009 +0200
+++ b/contrib/win32/win32-build.txt	Sun Aug 16 21:23:48 2009 -0500
@@ -25,7 +25,10 @@
       http://gnuwin32.sourceforge.net/packages/gettext.htm
 
   Inno Setup
-      http://www.jrsoftware.org/isinfo.php
+      http://www.jrsoftware.org/isdl.php#qsp
+
+      Get and install ispack-5.3.4.exe which includes Inno Setup Processor,
+      which is necessary to package Mercurial.
 
   ISTool - optional
       http://www.istool.org/default.aspx/
@@ -89,11 +92,14 @@
 If you use ISTool, you open the C:\hg\hg-release\contrib\win32\mercurial.iss
 file and type Ctrl-F9 to compile the installer file.
 
-Otherwise you run the Inno Setup compiler.  Assuming it's on the path you run:
+Otherwise you run the Inno Setup compiler.  Assuming it's in the path
+you should execute:
 
-  iscc contrib\win32\mercurial.iss
+  iscc contrib\win32\mercurial.iss /DVERSION=foo
 
-The actual installer will be in the C:\hg\hg-release\Output directory.
+Where 'foo' is the version number you would like to see in the
+'Add/Remove Applications' tool.  The installer will be placed into
+a directory named Output/ at the root of your repository.
 
 To automate the steps above you may want to create a batchfile based on the
 following:
@@ -104,6 +110,6 @@
   cd doc
   mingw32-make ASCIIDOC=asciidoc.bat html
   cd ..
-  iscc contrib\win32\mercurial.iss
+  iscc contrib\win32\mercurial.iss /DVERSION=snapshot
 
 and run it from the root of the hg repository (c:\hg\hg-release).