Fwd: [PATCH] Set automatically hg version in win32 installer

Martin Geisler mg at lazybytes.net
Mon May 4 10:17:48 CDT 2009


Pascal Quantin <pascal.quantin at gmail.com> writes:

Hi Pascal

I don't use Windows myself, but I noticed that this patch hasn't
received any feedback yet...

> here is a new attempt trying to address Patrick's comments (do not
> store version in a new file in source directory). This time I do not
> store the version string in a new file, but instead I read
> __version__.py content.
> Unfortunately due to bugs in Inno Setup Preprocessor string functions,
> I have to hard code the string position.

Provided I understand the commands correctly, it doesn't look all that
hardcoded to me -- you grab the content between the double quotes in the
second line. I think that's very reasonable.

I hope a Windows guy can verify that it works and push it -- having the
version number readily available is a good thing.

> diff --git a/contrib/win32/mercurial.iss b/contrib/win32/mercurial.iss
> --- a/contrib/win32/mercurial.iss
> +++ b/contrib/win32/mercurial.iss
> @@ -1,9 +1,23 @@
>  ; Script generated by the Inno Setup Script Wizard.
>  ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
> +
> +#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
> +


-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20090504/a2f7f41f/attachment.pgp 


More information about the Mercurial-devel mailing list