changeset 10400:fb203201ce30

setup.py: fixing version info for Windows hg.exe (py2exe) Fixes warning: py2exe: Version Info will not be included: could not parse version number ... which was seen when doing nightly builds. hg.exe files of nightly builds did not have any version info resoure, which may cause problems with installers. Also setting a copyright string for the version resource (was missing).
author Adrian Buehlmann <adrian@cadifra.com>
date Sun, 07 Feb 2010 23:07:58 +0100
parents e7b97b54cb02
children 6252852b4332
files setup.py
diffstat 1 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/setup.py	Mon Feb 08 23:47:23 2010 +0100
+++ b/setup.py	Sun Feb 07 23:07:58 2010 +0100
@@ -37,7 +37,6 @@
 from distutils.spawn import spawn, find_executable
 from distutils.ccompiler import new_compiler
 
-extra = {}
 scripts = ['hg']
 if os.name == 'nt':
     scripts.append('contrib/win32/hg.bat')
@@ -77,6 +76,7 @@
 # py2exe needs to be installed to work
 try:
     import py2exe
+    py2exeloaded = True
 
     # Help py2exe to find win32com.shell
     try:
@@ -92,9 +92,8 @@
     except ImportError:
         pass
 
-    extra['console'] = ['hg']
-
 except ImportError:
+    py2exeloaded = False
     pass
 
 def runcmd(cmd, env):
@@ -266,9 +265,22 @@
             packagedata['mercurial'].append(f)
 
 datafiles = []
+setupversion = version
+extra = {}
+
+if py2exeloaded:
+    extra['console'] = [
+        {'script':'hg',
+         'copyright':'Copyright (C) 2005-2010 Matt Mackall and others',
+         'product_version':version}]
+
+if os.name == 'nt':
+    # Windows binary file versions for exe/dll files must have the
+    # form W.X.Y.Z, where W,X,Y,Z are numbers in the range 0..65535
+    setupversion = version.split('+', 1)[0]
 
 setup(name='mercurial',
-      version=version,
+      version=setupversion,
       author='Matt Mackall',
       author_email='mpm@selenic.com',
       url='http://mercurial.selenic.com/',