# HG changeset patch
# User Matt Harbison <
matt_h...@yahoo.com>
# Date 1652473690 14400
# Fri May 13 16:28:10 2022 -0400
# Node ID a276ddcdde1aba7a162e0b40bcc3ad92f1ef53c6
# Parent 1cfb87f6e536d6207f18f5173a4c0cb253d45577
# EXP-Topic windows-py3-packaging
packaging: bundle windows-curses in the py3 installer (fixes #5780)
It's a trivial workaround for the upstream issue, and I don't feel like waiting
for it to be fixed and released.
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
@@ -305,7 +305,7 @@
fp.write('''
[py2exe]
includes = PyQt5.sip, PyQt5.QtPrintSupport, PyQt5.QtSvg, PyQt5.QtXml,
- mercurial_keyring, pygit2
+ mercurial_keyring, pygit2, _curses, _curses_panel
packages = ctypes, curses, dulwich, email, encodings, iniparse, json, keyring,
keyring.backends, nntplib, pygments, sspi, sqlite3, six,
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -523,6 +523,15 @@
try:
import py2exe
+ if sys.version_info.major >= 3:
+ # The py3 version of py2exe hardcodes _curses in the exclusion list,
+ # assuming it is a non-Windows module. But that prevents
+ # windows-curses from being bundled.
+ #
+ # See
https://github.com/py2exe/py2exe/issues/132
+ from py2exe import hooks
+ hooks.windows_excludes.remove('_curses')
+
# Help py2exe to find win32com.shell
try:
import modulefinder
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
@@ -85,8 +85,7 @@
<File Name="_bz2.pyd" />
<File Name="_cffi_backend.pyd" />
<File Name="_ctypes.pyd" />
- <!-- TODO: enable this when py2exe recognizes the curses module -->
- <!-- <File Name="_curses.pyd" -->
+ <File Name="_curses.pyd" />
<File Name="_curses_panel.pyd" />
<File Name="_decimal.pyd" />
<File Name="_elementtree.pyd" />
diff --git a/win32/wix/guids.wxi b/win32/wix/guids.wxi
--- a/win32/wix/guids.wxi
+++ b/win32/wix/guids.wxi
@@ -32,7 +32,7 @@
<?define templates.static.guid = {2c807a50-27ce-46c4-b8e6-1cb0be1e7105} ?>
<!-- dist.wxs -->
- <?define dist.guid = {98b18124-41af-449c-9396-202a3e0c0c41} ?>
+ <?define dist.guid = {148657a8-7dbd-438b-820a-7c7d80138e41} ?>
<?define lib.guid = {7b261357-2643-401d-90c9-b31270242927} ?>
<?define imageformats.guid = {12885995-61ed-468f-a964-3654d091138e} ?>
<?define platforms.guid = {4b2c42d4-fbb3-4449-b1df-31bf789e009e} ?>