Page MenuHomePhabricator

wix: functionality to automate building WiX installers

Authored by indygreg on Mar 8 2019, 1:49 PM.



Like we did for Inno Setup, we want to make it easier to
produce WiX installers. This commit does that.

We introduce a new hgpackaging.wix module for performing
all the high-level tasks required to produce WiX installers.
This required miscellaneous enhancements to existing code in
hgpackaging, including support for signing binaries.

A new script for calling into the module APIs has been
created. It behaves very similarly to the Inno Setup

Unlike Inno Setup, we didn't have code in the repo previously
to generate WiX installers. It appears that all existing
automation for building WiX installers lives in the repository - most
notably in its file. My strategy for inventing the
code in this commit was to step through the code in that repo's and observe what it was doing. Despite the length of in that repository, the actual amount of steps required
to produce a WiX installer is actually quite low. It consists
of a basic py2exe build plus invocations of candle.exe and
light.exe to produce the MSI.

One rabbit hole that gave me fits was locating the Visual Studio
9 C Runtime merge modules. These merge modules are only present
on your system if you have a full Visual Studio 2008 installation.
Fortunately, I have a copy of Visual Studio 2008 and was able
to install all the required updates. I then uploaded these merge
modules to a personal repository on GitHub. That is where the
added code references them from. We probably don't need to
ship the merge modules. But that is for another day.

The installs from the MSIs produced with the new automation
differ from the last official MSI in the following ways:

  • Our HTML manual pages have UNIX line endings instead of Windows.
  • We ship modules in the mercurial.pure package. It appears the upstream packaging code is not including this package due to omission (they supply an explicit list of packages that has drifted out of sync with our
  • We do not ship various distutils.* modules. This is because virtualenvs have a custom distutils/ that automagically imports distutils from its original location and py2exe gets confused by this. We don't use distutils in core Mercurial and don't provide a usable python.exe, so this omission should be acceptable.
  • The version of the enum package is different and we ship an enum.pyc instead of an enum/
  • The version of the docutils package is different and we ship a different set of files.
  • The version of Sphinx is drastically newer and we ship a number of files the old version did not. (I'm not sure why we ship Sphinx - I think it is a side-effect of the way the THG code was installing dependencies.)
  • We ship the idna package (dependent of requests which is a dependency of newer versions of Sphinx).
  • The version of imagesize is different and we ship an imagesize.pyc instead of an imagesize/__init__.pyc.
  • The version of the jinja2 package is different and the sets of files differs.
  • We ship the packaging package, which is a dependency for Sphinx.
  • The version of the pygments package is different and the sets of files differs.
  • We ship the requests package, which is a dependency for Sphinx.
  • We ship the snowballstemmer package, which is a dependency for Sphinx.
  • We ship the urllib3 package, which is a dependency for requests, which is a dependency for Sphinx.
  • We ship a newer version of the futures package, which includes a handful of extra modules that match Python 3 module names.
  1. no-check-commit because foo_bar naming

Diff Detail

rHG Mercurial
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

indygreg created this revision.Mar 8 2019, 1:49 PM
This revision was automatically updated to reflect the committed changes.