D7160: packaging: create empty hg.exe.local file

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Wed Oct 23 21:56:16 EDT 2019


indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Now that we stage all files before packaging, we can simply
  touch an empty file instead of using Inno magic to create it.
  This makes things more consistent.
  
  While we're here, we also document why we do this because
  it is important.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7160

AFFECTED FILES
  contrib/packaging/hgpackaging/inno.py
  contrib/packaging/hgpackaging/py2exe.py
  contrib/packaging/inno/mercurial.iss

CHANGE DETAILS

diff --git a/contrib/packaging/inno/mercurial.iss b/contrib/packaging/inno/mercurial.iss
--- a/contrib/packaging/inno/mercurial.iss
+++ b/contrib/packaging/inno/mercurial.iss
@@ -68,7 +68,6 @@
 [UninstallDelete]
 Type: files; Name: {app}\Mercurial.url
 Type: filesandordirs; Name: {app}\default.d
-Type: files; Name: "{app}\hg.exe.local"
 
 [Icons]
 Name: {group}\Uninstall Mercurial; Filename: {uninstallexe}
diff --git a/contrib/packaging/hgpackaging/py2exe.py b/contrib/packaging/hgpackaging/py2exe.py
--- a/contrib/packaging/hgpackaging/py2exe.py
+++ b/contrib/packaging/hgpackaging/py2exe.py
@@ -211,3 +211,9 @@
     files.
     """
     process_install_rules(STAGING_RULES, source_dir, staging_dir)
+
+    # An empty .exe.local file enables DLL Redirection and forces
+    # Windows to look for DLLs relative to the .exe.
+    # See https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-redirection.
+    with (staging_dir / 'hg.exe.local').open('ab'):
+        pass
diff --git a/contrib/packaging/hgpackaging/inno.py b/contrib/packaging/hgpackaging/inno.py
--- a/contrib/packaging/hgpackaging/inno.py
+++ b/contrib/packaging/hgpackaging/inno.py
@@ -29,7 +29,6 @@
 
 PACKAGE_FILES_METADATA = {
     'ReadMe.html': 'Flags: isreadme',
-    'hg.exe': "AfterInstall: Touch('{app}\\hg.exe.local')",
 }
 
 



To: indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list