##// END OF EJS Templates
packaging: use PyOxidizer for producing WiX MSI installer...
packaging: use PyOxidizer for producing WiX MSI installer We recently taught our in-tree PyOxidizer configuration file to produce MSI installers with WiX using PyOxidizer's built-in support for doing so. This commit changes our WiX + PyOxidizer installer generation code to use this functionality. After this change, all the Python packaging code is doing is the following: * Building HTML documentation * Making gettext available to the build process. * Munging CLI arguments to variables for the `pyoxidizer` execution. * Invoking `pyoxidizer build`. * Copying the produced `.msi` to the `dist/` directory. Applying this stack on stable and rebuilding the 5.8 MSI installer produced the following differences from the official 5.8 installer: * .exe and .pyd files aren't byte identical (this is expected). * Various .dist-info/ directories have different names due to older versions of PyOxidizer being buggy and not properly normalizing package names. (The new behavior is correct.) * Various *.dist-info/RECORD files are different due to content divergence of files (this is expected). * The python38.dll differs due to newer PyOxidizer shipping a newer version of Python 3.8. * We now ship python3.dll because PyOxidizer now includes this file by default. * The vcruntime140.dll differs because newer PyOxidizer installs a newer version. We also now ship a vcruntime140_1.dll because newer versions of the redistributable ship 2 files now. The WiX GUIDs and IDs of installed files have likely changed as a result of PyOxidizer's different mechanism for generating those identifiers. This means that an upgrade install of the MSI will replace files instead of doing an incremental update. This is likely harmless and we've incurred this kind of breakage before. As far as I can tell, the new PyOxidizer-built MSI is functionally equivalent to the old method. Once we drop support for Python 2.7 MSI installers, we can delete the WiX code from the repository. This commit temporarily drops support for extra `.wxs` files. We raise an exception instead of silently not using them, which I think is appropriate. We should be able to add support back in by injecting state into pyoxidizer.bzl via `--var`. I just didn't want to expend cognitive load to think about the solution as part of this series. Differential Revision: https://phab.mercurial-scm.org/D10688

File last commit:

r47506:63a3941d default
r47981:73f1a103 default
Show More
subsetmaker.py
170 lines | 4.8 KiB | text/x-python | PythonLexer
"""revset to select sample of repository
Hopefully this is useful to create interesting discovery cases.
"""
import collections
import random
from mercurial.i18n import _
from mercurial import (
registrar,
revset,
revsetlang,
smartset,
)
revsetpredicate = registrar.revsetpredicate()
@revsetpredicate(b'subsetspec("<spec>")')
def subsetmarkerspec(repo, subset, x):
"""use a shorthand spec as used by search-discovery-case
Supported format are:
- "scratch-count-seed": not scratch(all(), count, "seed")
- "randomantichain-seed": ::randomantichain(all(), "seed")
- "rev-REV": "::REV"
"""
args = revsetlang.getargs(
x, 0, 1, _(b'subsetspec("spec") required an argument')
)
spec = revsetlang.getstring(args[0], _(b"spec should be a string"))
case = spec.split(b'-')
t = case[0]
if t == b'scratch':
spec_revset = b'not scratch(all(), %s, "%s")' % (case[1], case[2])
elif t == b'randomantichain':
spec_revset = b'::randomantichain(all(), "%s")' % case[1]
elif t == b'rev':
spec_revset = b'::%d' % case[1]
else:
assert False, spec
selected = repo.revs(spec_revset)
return selected & subset
@revsetpredicate(b'scratch(REVS, <count>, [seed])')
def scratch(repo, subset, x):
"""randomly remove <count> revision from the repository top
This subset is created by recursively picking changeset starting from the
heads. It can be summarized using the following algorithm::
selected = set()
for i in range(<count>):
unselected = repo.revs("not <selected>")
candidates = repo.revs("heads(<unselected>)")
pick = random.choice(candidates)
selected.add(pick)
"""
m = _(b"scratch expects revisions, count argument and an optional seed")
args = revsetlang.getargs(x, 2, 3, m)
if len(args) == 2:
x, n = args
rand = random
elif len(args) == 3:
x, n, seed = args
seed = revsetlang.getinteger(seed, _(b"seed should be a number"))
rand = random.Random(seed)
else:
assert False
n = revsetlang.getinteger(n, _(b"scratch expects a number"))
selected = set()
heads = set()
children_count = collections.defaultdict(lambda: 0)
parents = repo.changelog._uncheckedparentrevs
baseset = revset.getset(repo, smartset.fullreposet(repo), x)
baseset.sort()
for r in baseset:
heads.add(r)
p1, p2 = parents(r)
if p1 >= 0:
heads.discard(p1)
children_count[p1] += 1
if p2 >= 0:
heads.discard(p2)
children_count[p2] += 1
for h in heads:
assert children_count[h] == 0
selected = set()
for x in range(n):
if not heads:
break
pick = rand.choice(list(heads))
heads.remove(pick)
assert pick not in selected
selected.add(pick)
p1, p2 = parents(pick)
if p1 in children_count:
assert p1 in children_count
children_count[p1] -= 1
assert children_count[p1] >= 0
if children_count[p1] == 0:
assert p1 not in selected, (r, p1)
heads.add(p1)
if p2 in children_count:
assert p2 in children_count
children_count[p2] -= 1
assert children_count[p2] >= 0
if children_count[p2] == 0:
assert p2 not in selected, (r, p2)
heads.add(p2)
return smartset.baseset(selected) & subset
@revsetpredicate(b'randomantichain(REVS, [seed])')
def antichain(repo, subset, x):
"""Pick a random anti-chain in the repository
A antichain is a set of changeset where there isn't any element that is
either a descendant or ancestors of any other element in the set. In other
word, all the elements are independant. It can be summarized with the
following algorithm::
selected = set()
unselected = repo.revs('all()')
while unselected:
pick = random.choice(unselected)
selected.add(pick)
unselected -= repo.revs('::<pick> + <pick>::')
"""
args = revsetlang.getargs(
x, 1, 2, _(b"randomantichain expects revisions and an optional seed")
)
if len(args) == 1:
(x,) = args
rand = random
elif len(args) == 2:
x, seed = args
seed = revsetlang.getinteger(seed, _(b"seed should be a number"))
rand = random.Random(seed)
else:
assert False
selected = set()
baseset = revset.getset(repo, smartset.fullreposet(repo), x)
undecided = baseset
while undecided:
pick = rand.choice(list(undecided))
selected.add(pick)
undecided = repo.revs(
'%ld and not (::%ld or %ld::head())', baseset, selected, selected
)
return smartset.baseset(selected) & subset