--- a/contrib/packaging/hgpackaging/py2exe.py Wed Oct 23 18:39:17 2019 -0700
+++ b/contrib/packaging/hgpackaging/py2exe.py Wed Oct 23 18:39:28 2019 -0700
@@ -15,10 +15,43 @@
from .util import (
extract_tar_to_directory,
extract_zip_to_directory,
+ process_install_rules,
python_exe_info,
)
+STAGING_RULES = [
+ ('contrib/bash_completion', 'Contrib/'),
+ ('contrib/hgk', 'Contrib/hgk.tcl'),
+ ('contrib/hgweb.fcgi', 'Contrib/'),
+ ('contrib/hgweb.wsgi', 'Contrib/'),
+ ('contrib/mercurial.el', 'Contrib/'),
+ ('contrib/mq.el', 'Contrib/'),
+ ('contrib/tcsh_completion', 'Contrib/'),
+ ('contrib/tcsh_completion_build.sh', 'Contrib/'),
+ ('contrib/vim/*', 'Contrib/Vim/'),
+ ('contrib/win32/postinstall.txt', 'ReleaseNotes.txt'),
+ ('contrib/win32/ReadMe.html', 'ReadMe.html'),
+ ('contrib/xml.rnc', 'Contrib/'),
+ ('contrib/zsh_completion', 'Contrib/'),
+ ('dist/hg.exe', './'),
+ ('dist/lib/*.dll', 'lib/'),
+ ('dist/lib/*.pyd', 'lib/'),
+ ('dist/lib/library.zip', 'lib/'),
+ ('dist/Microsoft.VC*.CRT.manifest', './'),
+ ('dist/msvc*.dll', './'),
+ ('dist/python*.dll', './'),
+ ('doc/*.html', 'Docs/'),
+ ('doc/style.css', 'Docs/'),
+ ('mercurial/help/**/*.txt', 'help/'),
+ ('mercurial/default.d/*.rc', 'default.d/'),
+ ('mercurial/locale/**/*', 'locale/'),
+ ('mercurial/templates/**/*', 'Templates/'),
+ ('CONTRIBUTORS', 'Contributors.txt'),
+ ('COPYING', 'Copying.txt'),
+]
+
+
def build_py2exe(
source_dir: pathlib.Path,
build_dir: pathlib.Path,
@@ -169,3 +202,12 @@
env=env,
check=True,
)
+
+
+def stage_install(source_dir: pathlib.Path, staging_dir: pathlib.Path):
+ """Copy all files to be installed to a directory.
+
+ This allows packaging to simply walk a directory tree to find source
+ files.
+ """
+ process_install_rules(STAGING_RULES, source_dir, staging_dir)