[PATCH 1 of 2] packaging: bundle configitems.toml from Mercurial on Windows

2 views
Skip to first unread message

Matt Harbison

unread,
Dec 2, 2023, 1:12:16 AM12/2/23
to thg...@googlegroups.com
# HG changeset patch
# User Matt Harbison <matt_h...@yahoo.com>
# Date 1701454319 18000
# Fri Dec 01 13:11:59 2023 -0500
# Branch stable
# Node ID ce8444c6988b7d3a18e1615253a3532df2620cb3
# Parent 90118cfe679e7f2cb2dfb9f97f55d183f9a3b8ec
packaging: bundle configitems.toml from Mercurial on Windows

This is the new form of `mercurial/configitems.py` that is usable with Rust, and
needs to live next to the executable. I'm assuming the macOS packaging is also
broken, but haven't tested it yet.

diff --git a/contrib/packaging/thgpackaging/py2exe.py b/contrib/packaging/thgpackaging/py2exe.py
--- a/contrib/packaging/thgpackaging/py2exe.py
+++ b/contrib/packaging/thgpackaging/py2exe.py
@@ -46,6 +46,7 @@
('{hg_dir}/doc/*.html', 'doc/'),
('{hg_dir}/doc/style.css', 'doc/'),
('{hg_dir}/mercurial/helptext/**/*.txt', 'helptext/'),
+ ('{hg_dir}/mercurial/configitems.toml', './'),
# *.rc files come from TortoiseHg only
#('{hg_dir}/mercurial/defaultrc/*.rc', 'defaultrc/'),
('{hg_dir}/mercurial/locale/**/*', 'locale/'),
diff --git a/win32/wix/dist-py3.wxs b/win32/wix/dist-py3.wxs
--- a/win32/wix/dist-py3.wxs
+++ b/win32/wix/dist-py3.wxs
@@ -23,6 +23,10 @@
<File Name="libssl-1_1.dll" />
<?endif?>
</Component>
+ <Component Id='configitems.toml' Guid='*' Win64='$(var.IsX64)'>
+ <File Id='configitems.toml' Name='configitems.toml' KeyPath='yes'
+ Source='$(var.SourceDir)/configitems.toml'/>
+ </Component>
<Directory Id="libdir" Name="lib" FileSource="$(var.SourceDir)/lib">
<Component Id="libOutput" Guid="$(var.lib.guid)" Win64='$(var.IsX64)'>
<File Name="library.zip" KeyPath="yes" />
diff --git a/win32/wix/tortoisehg-py3.wxs b/win32/wix/tortoisehg-py3.wxs
--- a/win32/wix/tortoisehg-py3.wxs
+++ b/win32/wix/tortoisehg-py3.wxs
@@ -224,6 +224,7 @@
<ComponentRef Id='MainExecutable' />
<ComponentRef Id='ProgramMenuDir' />
<ComponentRef Id='COPYING' />
+ <ComponentRef Id='configitems.toml' />
<ComponentRef Id='mercurial.rc' />
<ComponentRef Id='mergetools.rc' />
<ComponentRef Id='editortools.rc' />

Matt Harbison

unread,
Dec 2, 2023, 1:12:17 AM12/2/23
to thg...@googlegroups.com
# HG changeset patch
# User Matt Harbison <matt_h...@yahoo.com>
# Date 1701496765 18000
# Sat Dec 02 00:59:25 2023 -0500
# Branch stable
# Node ID 58fa9cf515834b63ccd91d7cdd37286da7f9db44
# Parent ce8444c6988b7d3a18e1615253a3532df2620cb3
packaging: avoid a mysterious error on Windows in a TortoiseHg launched cmd.exe

I was getting this crash in py2exe all of a sudden:

[.. snip ..]
File "C:\Users\Matt\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 2270, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: Can't find a usable init.tcl in the following directories:
{C:\Program Files\TortoiseHg\lib\tcl} {C:/Program Files/TortoiseHg/lib/tcl8.6}
C:/Users/Matt/AppData/Local/Programs/Python/Python39/lib/tcl8.6
C:/Users/Matt/AppData/Local/Programs/Python/lib/tcl8.6
C:/Users/Matt/AppData/Local/Programs/lib/tcl8.6
C:/Users/Matt/AppData/Local/Programs/Python/library
C:/Users/Matt/AppData/Local/Programs/library
C:/Users/Matt/AppData/Local/Programs/tcl8.6.12/library
C:/Users/Matt/AppData/Local/tcl8.6.12/library

Eventually I figured out that something (Qt5?) is setting these variables:

TCL_LIBRARY=C:\Program Files\TortoiseHg\lib\tcl
TK_LIBRARY=C:\Program Files\TortoiseHg\lib\tk

... even though the closest files are:

C:\Program Files\TortoiseHg\lib\tcl86t.dll
C:\Program Files\TortoiseHg\lib\tk86t.dll

diff --git a/contrib/packaging/thgpackaging/py2exe.py b/contrib/packaging/thgpackaging/py2exe.py
--- a/contrib/packaging/thgpackaging/py2exe.py
+++ b/contrib/packaging/thgpackaging/py2exe.py
@@ -100,6 +100,12 @@
env["HGPLAIN"] = "1"
env["HGRCPATH"] = ""

+ # The terminal opened with Ctrl+Shift+T has these defined, even when they
+ # aren't defined in the system, and their presence causes py2exe to fail to
+ # find Tcl.
+ env.pop("TCL_LIBRARY", None)
+ env.pop("TK_LIBRARY", None)
+
site_packages_path = distutils.sysconfig.get_python_lib()

included_packages = ['mercurial']

Yuya Nishihara

unread,
Dec 2, 2023, 7:50:05 AM12/2/23
to Matt Harbison, thg...@googlegroups.com
On Sat, 02 Dec 2023 01:12:11 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_h...@yahoo.com>
> # Date 1701454319 18000
> # Fri Dec 01 13:11:59 2023 -0500
> # Branch stable
> # Node ID ce8444c6988b7d3a18e1615253a3532df2620cb3
> # Parent 90118cfe679e7f2cb2dfb9f97f55d183f9a3b8ec
> packaging: bundle configitems.toml from Mercurial on Windows

Queued for stable, thanks.

Yuya Nishihara

unread,
Dec 2, 2023, 7:50:06 AM12/2/23
to Matt Harbison, thg...@googlegroups.com
These variables would be set by python or py2exe, but removing them should be
fine.
Reply all
Reply to author
Forward
0 new messages