From patchwork Thu Oct 24 01:56:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D7171: packaging: write out editor.rc in Python From: phabricator X-Patchwork-Id: 42561 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Thu, 24 Oct 2019 01:56:26 +0000 indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Let's dynamically generate the file from Python instead of relying on Inno functionality, as that will give more visibility into what's going on. I spotted this as part of converging the install layout of Inno and WiX: the former doesn't install an editor.rc and instead defines the editor via its mercurial.rc file. We will change the behavior of WiX later once it is consuming the staged install directory for packaging. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D7171 AFFECTED FILES contrib/packaging/hgpackaging/py2exe.py contrib/packaging/inno/mercurial.iss CHANGE DETAILS To: indygreg, #hg-reviewers Cc: mercurial-devel 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 @@ -48,7 +48,6 @@ [INI] Filename: {app}\Mercurial.url; Section: InternetShortcut; Key: URL; String: https://mercurial-scm.org/ -Filename: {app}\hgrc.d\editor.rc; Section: ui; Key: editor; String: notepad [UninstallDelete] Type: files; Name: {app}\Mercurial.url 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 @@ -223,6 +223,13 @@ with (staging_dir / 'hg.exe.local').open('ab'): pass + # Write out a default editor.rc file to configure notepad as the + # default editor. + with (staging_dir / 'hgrc.d' / 'editor.rc').open( + 'w', encoding='utf-8' + ) as fh: + fh.write('[ui]\neditor = notepad\n') + # Purge any files we don't want to be there. for f in STAGING_EXCLUDES: p = staging_dir / f