# HG changeset patch # User Gregory Szorc # Date 1571881148 25200 # Node ID 10454e7881113b576eabc29ff96a66fdf3c0260f # Parent 081a77df7bc65e18cce5c58dd3a879991d4d724e packaging: install and run Inno files in a build directory Upcoming commits will refactor the Windows installers so their content is dynamically derived. In preparation for this, we copy the Inno files into a new build directory and run them from there. This required changing some relative paths to work from a new directory level but is otherwise a pretty straightforward change. Differential Revision: https://phab.mercurial-scm.org/D7157 diff -r 081a77df7bc6 -r 10454e788111 contrib/packaging/hgpackaging/inno.py --- a/contrib/packaging/hgpackaging/inno.py Wed Oct 23 18:37:36 2019 -0700 +++ b/contrib/packaging/hgpackaging/inno.py Wed Oct 23 18:39:08 2019 -0700 @@ -15,7 +15,6 @@ from .py2exe import build_py2exe from .util import find_vc_runtime_files - EXTRA_PACKAGES = { 'dulwich', 'keyring', @@ -43,11 +42,16 @@ raise Exception('%s does not exist' % iscc_exe) vc_x64 = r'\x64' in os.environ.get('LIB', '') + arch = 'x64' if vc_x64 else 'x86' + inno_source_dir = source_dir / 'contrib' / 'packaging' / 'inno' + inno_build_dir = build_dir / ('inno-%s' % arch) requirements_txt = ( source_dir / 'contrib' / 'packaging' / 'inno' / 'requirements.txt' ) + inno_build_dir.mkdir(parents=True, exist_ok=True) + build_py2exe( source_dir, build_dir, @@ -71,6 +75,10 @@ print('creating installer') + # Copy Inno files into place. + for p in ('mercurial.iss', 'modpath.iss'): + shutil.copyfile(inno_source_dir / p, inno_build_dir / p) + args = [str(iscc_exe)] if vc_x64: @@ -80,6 +88,6 @@ args.append('/dVERSION=%s' % version) args.append('/Odist') - args.append('contrib/packaging/inno/mercurial.iss') + args.append(str(inno_build_dir / 'mercurial.iss')) subprocess.run(args, cwd=str(source_dir), check=True) diff -r 081a77df7bc6 -r 10454e788111 contrib/packaging/inno/mercurial.iss --- a/contrib/packaging/inno/mercurial.iss Wed Oct 23 18:37:36 2019 -0700 +++ b/contrib/packaging/inno/mercurial.iss Wed Oct 23 18:39:08 2019 -0700 @@ -5,7 +5,7 @@ #define FileHandle #define FileLine #define VERSION = "unknown" -#if FileHandle = FileOpen(SourcePath + "\..\..\..\mercurial\__version__.py") +#if FileHandle = FileOpen(SourcePath + "\..\..\mercurial\__version__.py") #expr FileLine = FileRead(FileHandle) #expr FileLine = FileRead(FileHandle) #define VERSION = Copy(FileLine, Pos('"', FileLine)+1, Len(FileLine)-Pos('"', FileLine)-1) @@ -43,7 +43,7 @@ AppID={{4B95A5F1-EF59-4B08-BED8-C891C46121B3} AppContact=mercurial@mercurial-scm.org DefaultDirName={pf}\Mercurial -SourceDir=..\..\.. +SourceDir=..\.. VersionInfoDescription=Mercurial distributed SCM (version {#VERSION}) VersionInfoCopyright=Copyright 2005-2019 Matt Mackall and others VersionInfoCompany=Matt Mackall and others