Installer: Support different display version than component version

The component version must be numeric, but we want to display e.g.
Qt Creator 4.0.0-beta1 in the installer title.
The change adds a -d parameter to the script and adds corresponding
replacement variables.
Display version falls back to component version.

Change-Id: Ia8bcd05444e280f8a44ab321b043f4031725600d
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Eike Ziller
2016-03-11 14:49:20 +01:00
parent c3772bfd4c
commit db61acce80
4 changed files with 17 additions and 10 deletions

View File

@@ -2,7 +2,7 @@
<Installer> <Installer>
<Name>Qt Creator</Name> <Name>Qt Creator</Name>
<Version>{version}</Version> <Version>{version}</Version>
<Title>Qt Creator {version}</Title> <Title>Qt Creator {display_version}</Title>
<Publisher>Qt Project</Publisher> <Publisher>Qt Project</Publisher>
<ProductUrl>http://www.qt.io</ProductUrl> <ProductUrl>http://www.qt.io</ProductUrl>
@@ -11,6 +11,6 @@
<WizardDefaultHeight>520</WizardDefaultHeight> <WizardDefaultHeight>520</WizardDefaultHeight>
<MaintenanceToolName>QtCreatorUninstaller</MaintenanceToolName> <MaintenanceToolName>QtCreatorUninstaller</MaintenanceToolName>
<!-- @homeDir@ and @rootDir@ are some of the supported vars --> <!-- @homeDir@ and @rootDir@ are some of the supported vars -->
<TargetDir>@homeDir@/qtcreator-{version}</TargetDir> <TargetDir>@homeDir@/qtcreator-{display_version}</TargetDir>
<AdminTargetDir>/opt/qtcreator-{version}</AdminTargetDir> <AdminTargetDir>/opt/qtcreator-{display_version}</AdminTargetDir>
</Installer> </Installer>

View File

@@ -2,7 +2,7 @@
<Installer> <Installer>
<Name>Qt Creator</Name> <Name>Qt Creator</Name>
<Version>{version}</Version> <Version>{version}</Version>
<Title>Qt Creator {version}</Title> <Title>Qt Creator {display_version}</Title>
<Publisher>Qt Project</Publisher> <Publisher>Qt Project</Publisher>
<ProductUrl>http://www.qt.io</ProductUrl> <ProductUrl>http://www.qt.io</ProductUrl>
@@ -11,6 +11,6 @@
<WizardDefaultHeight>560</WizardDefaultHeight> <WizardDefaultHeight>560</WizardDefaultHeight>
<MaintenanceToolName>Uninstall Qt Creator</MaintenanceToolName> <MaintenanceToolName>Uninstall Qt Creator</MaintenanceToolName>
<!-- @homeDir@ and @rootDir@ are some of the supported vars --> <!-- @homeDir@ and @rootDir@ are some of the supported vars -->
<TargetDir>@homeDir@/Applications/Qt Creator {version}</TargetDir> <TargetDir>@homeDir@/Applications/Qt Creator {display_version}</TargetDir>
<AllowSpaceInPath>true</AllowSpaceInPath> <AllowSpaceInPath>true</AllowSpaceInPath>
</Installer> </Installer>

View File

@@ -2,7 +2,7 @@
<Installer> <Installer>
<Name>Qt Creator</Name> <Name>Qt Creator</Name>
<Version>{version}</Version> <Version>{version}</Version>
<Title>Qt Creator {version}</Title> <Title>Qt Creator {display_version}</Title>
<Publisher>Qt Project</Publisher> <Publisher>Qt Project</Publisher>
<ProductUrl>http://www.qt.io</ProductUrl> <ProductUrl>http://www.qt.io</ProductUrl>
@@ -11,6 +11,6 @@
<WizardDefaultHeight>560</WizardDefaultHeight> <WizardDefaultHeight>560</WizardDefaultHeight>
<MaintenanceToolName>QtCreatorUninst</MaintenanceToolName> <MaintenanceToolName>QtCreatorUninst</MaintenanceToolName>
<!-- @homeDir@ and @rootDir@ are some of the supported vars --> <!-- @homeDir@ and @rootDir@ are some of the supported vars -->
<TargetDir>@rootDir@/Qt/qtcreator-{version}</TargetDir> <TargetDir>@rootDir@/Qt/qtcreator-{display_version}</TargetDir>
<StartMenuDir>Qt Creator</StartMenuDir> <StartMenuDir>Qt Creator</StartMenuDir>
</Installer> </Installer>

View File

@@ -36,7 +36,7 @@ import shutil
import inspect import inspect
def usage(): def usage():
print('Usage: %s [-v|--version-string=versionstring] [-i|--installer-path=/path/to/installerfw] [-a|--archive=archive.7z] [-d|--debug] <outputname>' % os.path.basename(sys.argv[0])) print('Usage: %s [-v|--version-string=versionstring] [-d|--display-version=versionstring] [-i|--installer-path=/path/to/installerfw] [-a|--archive=archive.7z] [--debug] <outputname>' % os.path.basename(sys.argv[0]))
def substitute_file(infile, outfile, substitutions): def substitute_file(infile, outfile, substitutions):
with open(infile, 'r') as f: with open(infile, 'r') as f:
@@ -51,7 +51,7 @@ def ifw_template_dir():
def main(): def main():
try: try:
opts, args = getopt.gnu_getopt(sys.argv[1:], 'hv:i:a:d', ['help', 'version-string=', 'installer-path=', 'archive', 'debug']) opts, args = getopt.gnu_getopt(sys.argv[1:], 'hv:d:i:a:', ['help', 'version-string=', 'display-version=', 'installer-path=', 'archive', 'debug'])
except: except:
usage() usage()
sys.exit(2) sys.exit(2)
@@ -61,6 +61,7 @@ def main():
sys.exit(2) sys.exit(2)
version = '' version = ''
display_version = ''
ifw_location = '' ifw_location = ''
archives = [] archives = []
debug = False debug = False
@@ -70,16 +71,21 @@ def main():
sys.exit(0) sys.exit(0)
if o in ('-v', '--version-string'): if o in ('-v', '--version-string'):
version = a version = a
if o in ['-d', '--display-version']:
display_version = a
if o in ('-i', '--installer-path'): if o in ('-i', '--installer-path'):
ifw_location = a ifw_location = a
if o in ('-a', '--archive'): if o in ('-a', '--archive'):
archives.append(a) archives.append(a)
if o in ('-d', '--debug'): if o in ['--debug']:
debug = True debug = True
if (version == ''): if (version == ''):
raise Exception('Version not specified (--version-string)!') raise Exception('Version not specified (--version-string)!')
if not display_version:
display_version = version
if (ifw_location == ''): if (ifw_location == ''):
raise Exception('Installer framework location not specified (--installer-path)!') raise Exception('Installer framework location not specified (--installer-path)!')
@@ -108,6 +114,7 @@ def main():
try: try:
substs = {} substs = {}
substs['version'] = version substs['version'] = version
substs['display_version'] = display_version
substs['date'] = datetime.date.today().isoformat() substs['date'] = datetime.date.today().isoformat()
substs['archives'] = ','.join(archives) substs['archives'] = ','.join(archives)