NSIS_PACKEDVERSION no longer optional. Tries to find a usable fallback value if not specified.
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7058 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
7962b3ccac
commit
649159cd28
2 changed files with 22 additions and 16 deletions
36
SConstruct
36
SConstruct
|
@ -255,14 +255,28 @@ f.write('// This file is automatically generated by SCons\n// DO NOT EDIT THIS F
|
|||
f.write('#include "%s"\n' % File('#/Source/tchar.h').abspath)
|
||||
|
||||
if (not defenv.has_key('VER_PACKED')) and defenv.has_key('VER_MAJOR') and defenv.has_key('VER_MINOR'):
|
||||
packed_r = packed_b = 0
|
||||
if defenv.has_key('VER_REVISION'):
|
||||
packed_r = int(defenv['VER_REVISION'])
|
||||
if defenv.has_key('VER_BUILD'):
|
||||
packed_b = int(defenv['VER_BUILD'])
|
||||
defenv['VER_PACKED'] = '0x%0.2i%0.3i%0.2i%0.1i' % (int(defenv['VER_MAJOR']),int(defenv['VER_MINOR']),packed_r,packed_b)
|
||||
if defenv.has_key('VER_PACKED'):
|
||||
f.write('#define NSIS_PACKEDVERSION _T("%s")\n' % defenv['VER_PACKED'])
|
||||
packed_r = int(defenv.get('VER_REVISION','0'))
|
||||
packed_b = int(defenv.get('VER_BUILD','0'))
|
||||
defenv['VER_PACKED'] = '0x%0.2i%0.3i%0.2i%0.1i' % (int(defenv['VER_MAJOR']), int(defenv['VER_MINOR']), packed_r, packed_b)
|
||||
if not defenv.has_key('VER_PACKED'):
|
||||
import re
|
||||
found = None
|
||||
for v in re.compile(r'^\\H\{[v]?(\S+)\}', re.M).finditer(File('#/Docs/src/history.but').get_contents()): # Try to parse the Halibut history file
|
||||
if v and not found:
|
||||
v = v.group(1).split('.')
|
||||
if len(v) >= 2:
|
||||
mi = int(re.search(r'\d+', v[1]).group())
|
||||
if mi < 1: mi = 1 # Make sure we can subtract 1 from the minor number so trunk stays below the next release
|
||||
defenv['VER_PACKED'] = '0x%0.2i%0.3i%0.2i%0.1i' % (int(re.search(r'\d+', v[0]).group()), mi - 1, 66, 6)
|
||||
if int(defenv['VER_PACKED'], 0) >= int('0x03000000', 0):
|
||||
found = v
|
||||
if not found:
|
||||
defenv['VER_PACKED'] = '0x%0.2i%0.3i%0.2i%0.1i' % (3, 3, 42, 0) # Default to a version number we never used
|
||||
print('WARNING: VER_PACKED not set, defaulting to %s!' % defenv['VER_PACKED'])
|
||||
if int(defenv['VER_PACKED'], 0) < int('0x03000000', 0) or int(defenv['VER_PACKED'], 0) >= int('0x04000000', 0):
|
||||
print('ERROR: Invalid VER_PACKED value!')
|
||||
Exit(1)
|
||||
f.write('#define NSIS_PACKEDVERSION _T("%s")\n' % defenv['VER_PACKED'])
|
||||
|
||||
if defenv.has_key('VER_MAJOR') and defenv.get('VERSION','') == '':
|
||||
defenv['VERSION'] = defenv['VER_MAJOR']
|
||||
|
@ -270,12 +284,6 @@ if defenv.has_key('VER_MAJOR') and defenv.get('VERSION','') == '':
|
|||
defenv['VERSION'] += '.' + defenv['VER_MINOR']
|
||||
if defenv.has_key('VER_REVISION'):
|
||||
defenv['VERSION'] += '.' + defenv['VER_REVISION']
|
||||
|
||||
if (not defenv.has_key('TARGET_ARCH')) or defenv['TARGET_ARCH'] == 'x86':
|
||||
vermaj = 0
|
||||
if defenv.has_key('VER_MAJOR'):
|
||||
vermaj = int(defenv['VER_MAJOR'])
|
||||
|
||||
f.write('#define NSIS_VERSION _T("v%s")\n' % defenv['VERSION'])
|
||||
|
||||
f.close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue