setup: configure py2exe config via environment variables
The Inno Setup and WiX installers ship a different set of packages
with py2exe builds. And there are multiple WiX installer variants
(e.g. TortoiseHG).
Since there are multiple variants of py2exe configs and they
can be defined by entities not in our repository, let's
provide a mechanism for setup.py to supplement behavior via
environment variables. This is slighly less hacky than a setup.cfg
file IMO since the caller doesn't need to worry about mutating
global state of the source directory.
Differential Revision: https://phab.mercurial-scm.org/D6092
'''
Examples of useful python hooks for Mercurial.
'''
from __future__ import absolute_import
from mercurial import (
patch,
util,
)
def diffstat(ui, repo, **kwargs):
'''Example usage:
[hooks]
commit.diffstat = python:/path/to/this/file.py:diffstat
changegroup.diffstat = python:/path/to/this/file.py:diffstat
'''
if kwargs.get('parent2'):
return
node = kwargs['node']
first = repo[node].p1().node()
if 'url' in kwargs:
last = repo.changelog.tip()
else:
last = node
diff = patch.diff(repo, first, last)
ui.write(patch.diffstat(util.iterlines(diff)))