Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.0, 1.0.1, and 1.0.2

setup.py: fix version handling on Windows exe file creation

The "binary" file versions for exe/dll files on Windows must have the form
W.X.Y.Z (with W,X,Y,Z in 0..65535), as can be seen by the warning we
currently get from py2exe when doing builds on Windows that are not from
a plain tag (i.e. with a '+' in the full version string):

warning: py2exe: Version Info will not be included:
could not parse version number '0.9.2+316-bb7de261c6b7+20100201'

Fixed by stripping the version string given to setup() to the part before
the '+' on Windows.

Windows exe/dll files can take an arbitrary string in the 'product version'
part of the version resource, which can be given to py2exe in the
'product_version' parameter. So we specify the full version string there.

Changeset 92447cd32dd5

Parent 564d4ebf1586

by Adrian Buehlmann

Changes to one file · Browse files at 92447cd32dd5 Showing diff from parent 564d4ebf1586 Diff from another changeset...

Change 1 of 4 Show Entire File setup.py Stacked
 
52
53
54
55
 
56
57
58
 
116
117
118
119
 
 
120
121
122
 
 
123
124
125
 
 
126
127
128
129
130
 
 
131
132
133
 
161
162
163
164
165
166
167
168
169
170
171
172
173
174
 
212
213
214
 
 
 
 
 
 
 
 
 
 
 
215
216
 
217
218
219
 
52
53
54
 
55
56
57
58
 
116
117
118
 
119
120
121
122
 
123
124
125
126
 
127
128
129
130
131
132
 
133
134
135
136
137
 
165
166
167
 
 
 
 
 
 
 
 
168
169
170
 
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
 
223
224
225
226
@@ -52,7 +52,7 @@
 cmdclass = {   'build_mo': build_mo}   -def setup_windows(): +def setup_windows(version):   # Specific definitios for Windows NT-alike installations   _scripts = []   _data_files = [] @@ -116,18 +116,22 @@
  extra['console'] = [   {'script':'contrib/hg',   'icon_resources':[(0,'icons/hg.ico')], - 'copyright':hgcopyright}, + 'copyright':hgcopyright, + 'product_version':version},   {'script':'hgtk',   'icon_resources':[(0,'icons/thg_logo.ico')], - 'copyright':thgcopyright}, + 'copyright':thgcopyright, + 'product_version':version},   {'script':'contrib/docdiff.py',   'icon_resources':[(0,'icons/TortoiseMerge.ico')], - 'copyright':thgcopyright} + 'copyright':thgcopyright, + 'product_version':version}   ]   extra['windows'] = [   {'script':'thgtaskbar.py',   'icon_resources':[(0,'icons/thg_logo.ico')], - 'copyright':thgcopyright} + 'copyright':thgcopyright, + 'product_version':version}   ]     return _scripts, _packages, _data_files, extra @@ -161,14 +165,6 @@
    return _scripts, _packages, _data_files, _extra   - -if os.name == "nt": - (scripts, packages, data_files, extra) = setup_windows() - desc='Windows shell extension for Mercurial VCS' -else: - (scripts, packages, data_files, extra) = setup_posix() - desc='TortoiseHg dialogs for Mercurial VCS' -  def runcmd(cmd, env):   p = subprocess.Popen(cmd, stdout=subprocess.PIPE,   stderr=subprocess.PIPE, env=env) @@ -212,8 +208,19 @@
 except ImportError:   version = 'unknown'   +if os.name == "nt": + (scripts, packages, data_files, extra) = setup_windows(version) + desc='Windows shell extension for Mercurial VCS' + # 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] +else: + (scripts, packages, data_files, extra) = setup_posix() + desc='TortoiseHg dialogs for Mercurial VCS' + setupversion=version +  setup(name="tortoisehg", - version=version, + version=setupversion,   author='Steve Borho',   author_email='steve@borho.org',   url='http://tortoisehg.org',