Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wix installer toolset in appveyor setup #3204

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ install:
- choco install --allow-empty-checksums swig
- choco install --allow-empty-checksums vswhere
- choco install --allow-empty-checksums xsltproc

- choco install --allow-empty-checksums wixtoolset

environment:
matrix:
Expand Down Expand Up @@ -80,4 +80,4 @@ build_script:
if ( $Env:BUILD_JOB_NUM -eq $TOTAL_BUILD_JOBS){ $end = $Lines };
if ( $start -eq 0 ){ $start = 1 };
get-content all_tests.txt | select -first ($end - $start) -skip ($start - 1) | Out-File -Encoding ASCII build_tests.txt;
- cmd: powershell -Command "& { python runtest.py -j 2 -f build_tests.txt; if($LastExitCode -eq 2 -Or $LastExitCode -eq 0) { $host.SetShouldExit(0 )} else {$host.SetShouldExit(1)}}"
- cmd: powershell -Command "& { python runtest.py -j 2 -f build_tests.txt; if($LastExitCode -eq 2 -Or $LastExitCode -eq 0) { $host.SetShouldExit(0 )} else {$host.SetShouldExit(1)}}"
58 changes: 38 additions & 20 deletions src/engine/SCons/Tool/wix.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
#

__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
import glob

import SCons.Builder
import SCons.Action
Expand All @@ -39,13 +41,13 @@
def generate(env):
"""Add Builders and construction variables for WiX to an Environment."""
if not exists(env):
return
return

env['WIXCANDLEFLAGS'] = ['-nologo']
env['WIXCANDLEINCLUDE'] = []
env['WIXCANDLECOM'] = '$WIXCANDLE $WIXCANDLEFLAGS -I $WIXCANDLEINCLUDE -o ${TARGET} ${SOURCE}'

env['WIXLIGHTFLAGS'].append( '-nologo' )
env['WIXLIGHTFLAGS'].append('-nologo')
env['WIXLIGHTCOM'] = "$WIXLIGHT $WIXLIGHTFLAGS -out ${TARGET} ${SOURCES}"
env['WIXSRCSUF'] = '.wxs'
env['WIXOBJSUF'] = '.wixobj'
Expand All @@ -62,38 +64,54 @@ def generate(env):

env['BUILDERS']['WiX'] = linker_builder


def exists(env):
env['WIXCANDLE'] = 'candle.exe'
env['WIXLIGHT'] = 'light.exe'

# try to find the candle.exe and light.exe tools and
# add the install directory to light libpath.
def check_wix(e, p):
"""try to find the candle and light tools; add to path if found."""
try:
files = os.listdir(p)
if e['WIXCANDLE'] in files and e['WIXLIGHT'] in files:
e.PrependENVPath('PATH', p)
# include appropriate flags if running WiX 2.0
if 'wixui.wixlib' in files and 'WixUI_en-us.wxl' in files:
e['WIXLIGHTFLAGS'] = [os.path.join(p, 'wixui.wixlib'),
'-loc',
os.path.join(p, 'WixUI_en-us.wxl')]
else:
e['WIXLIGHTFLAGS'] = []
return 1
except OSError:
pass # ignore this, could be a stale PATH entry.
return None

# look in existing paths first
for path in os.environ['PATH'].split(os.pathsep):
if not path:
continue

# workaround for some weird python win32 bug.
if path[0] == '"' and path[-1:]=='"':
if path[0] == '"' and path[-1:] == '"':
path = path[1:-1]

# normalize the path
path = os.path.normpath(path)

# search for the tools in the PATH environment variable
try:
files = os.listdir(path)
if env['WIXCANDLE'] in files and env['WIXLIGHT'] in files:
env.PrependENVPath('PATH', path)
# include appropriate flags if running WiX 2.0
if 'wixui.wixlib' in files and 'WixUI_en-us.wxl' in files:
env['WIXLIGHTFLAGS'] = [ os.path.join( path, 'wixui.wixlib' ),
'-loc',
os.path.join( path, 'WixUI_en-us.wxl' ) ]
else:
env['WIXLIGHTFLAGS'] = []
return 1
except OSError:
pass # ignore this, could be a stale PATH entry.
if check_wix(env, path):
return 1

# Wix is not in scons' PATH. Let's look in typical install locations.
wix_env = os.environ.get('WIX', None)
if wix_env:
wix_installs = [os.path.join(wix_env, 'bin')]
else:
wix_path = r'C:\Program Files (x86)\WiX Toolset v*.*\bin'
wix_installs = glob.glob(wix_path)
for path in wix_installs:
if check_wix(env, path):
return 1

return None

Expand Down
1 change: 1 addition & 0 deletions test/packaging/msi/explicit-target.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
SUMMARY = 'balalalalal',
DESCRIPTION = 'this should be reallly really long',
VENDOR = 'Nanosoft_2000',
X_MSI_LANGUAGE = '1003',
source = env.FindInstalledFiles(),
target = "mypackage.msi",
)
Expand Down
3 changes: 3 additions & 0 deletions test/packaging/msi/file-placement.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
SUMMARY = 'balalalalal',
DESCRIPTION = 'this should be reallly really long',
VENDOR = 'Nanosoft_2000',
X_MSI_LANGUAGE = '1003',
source = [ f1 ],
)
""")
Expand Down Expand Up @@ -100,6 +101,7 @@
SUMMARY = 'balalalalal',
DESCRIPTION = 'this should be reallly really long',
VENDOR = 'Nanosoft_2000',
X_MSI_LANGUAGE = '1003',
LICENSE = 'afl',
source = [ f1, f2, f3, f4, f5, f6, f7 ],
)
Expand Down Expand Up @@ -150,6 +152,7 @@
DESCRIPTION = 'this should be reallly really long',
VENDOR = 'Nanosoft_2000',
LICENSE = 'afl',
X_MSI_LANGUAGE = '1003',
source = [ f1, f2, f3, f4 ],
)
""")
Expand Down
2 changes: 2 additions & 0 deletions test/packaging/msi/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
SUMMARY = 'balalalalal',
DESCRIPTION = 'this should be reallly really long',
VENDOR = 'Nanosoft_2000',
X_MSI_LANGUAGE = '1003',
source = [ f1, f2 ],
)

Expand Down Expand Up @@ -113,6 +114,7 @@
SUMMARY = 'balalalalal',
DESCRIPTION = 'this should be reallly really long',
VENDOR = 'Nanosoft_tx2000',
X_MSI_LANGUAGE = '1003',
source = [ f1, f2, f3, f4, f5 ],
)

Expand Down