setup: properly package distutils in py2exe virtualenv builds

Authored by indygreg.


setup: properly package distutils in py2exe virtualenv builds

Our in-repo py2exe packaging code uses virtualenvs for managing
dependencies. An advantage of this is that packaging is more
deterministic and reproducible. Without virtualenvs, we need to
install packages in the system Python install. Packages installed
by other consumers of the system Python could leak into the Mercurial

A regression from this change was that py2exe packages contained
the virtualenv's hacked distutils modules instead of the original
distutils modules. (virtualenv installs a hacked distutils module
because distutils uses relative path lookups that fail when running
from a virtualenv.)

This commit introduces a workaround so py2exe packaging uses the
original distutils modules when running from a virtualenv.

With this change, import distutils no longer fails from py2exe
builds produced from a virtualenv. This fixes the regression.
Furthermore, we now include all distutils modules. Before, py2exe's
module finding would only find modules there were explicitly
referenced in code. So, we now package a complete copy of distutils
instead of a partial one. This is even better than before.

  1. no-check-commit foo_bar function name


indygregApr 20 2019, 10:29 AM
rHG84b5ad5fc2aa: merge: forgot to pull before release