File mingw-python3_pythonw.patch of Package mingw-python3

diff -rupN --no-dereference Python-3.11.8/Makefile.pre.in Python-3.11.8-new/Makefile.pre.in
--- Python-3.11.8/Makefile.pre.in	2024-02-16 22:21:28.027345545 +0100
+++ Python-3.11.8-new/Makefile.pre.in	2024-02-16 22:21:28.031345549 +0100
@@ -284,6 +284,7 @@ LIBOBJS=	@LIBOBJS@
 
 PYTHON=		python$(EXE)
 BUILDPYTHON=	python$(BUILDEXE)
+BUILDPYTHONW=	pythonw$(BUILDEXE)
 
 HOSTRUNNER= @HOSTRUNNER@
 
@@ -585,7 +586,7 @@ LIBEXPAT_HEADERS= \
 
 # Default target
 all:		@DEF_MAKE_ALL_RULE@
-build_all:	check-clean-src $(BUILDPYTHON) platform oldsharedmods sharedmods \
+build_all:	check-clean-src $(BUILDPYTHON) $(BUILDPYTHONW) platform oldsharedmods sharedmods \
 		gdbhooks Programs/_testembed python-config
 build_wasm: check-clean-src $(BUILDPYTHON) platform oldsharedmods python-config
 
@@ -704,9 +705,29 @@ coverage-report: regen-token regen-froze
 clinic: check-clean-src $(srcdir)/Modules/_blake2/blake2s_impl.c
 	$(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py --make --srcdir $(srcdir)
 
+pythonnt_rc.h:
+	# FIXME: FIELD3 not set
+	@echo '#define FIELD3 0' > $@
+	@echo '#define MS_DLL_ID "$(VERSION)"' >> $@
+	@echo '#define PYTHON_DLL_NAME "$(DLLLIBRARY)"' >> $@
+
+python_exe.o: pythonnt_rc.h $(srcdir)/PC/python_exe.rc
+	$(WINDRES) -I$(srcdir)/Include -I$(srcdir)/PC -I. $(srcdir)/PC/python_exe.rc $@
+
+pythonw_exe.o: pythonnt_rc.h $(srcdir)/PC/pythonw_exe.rc
+	$(WINDRES) -I$(srcdir)/Include -I$(srcdir)/PC -I. $(srcdir)/PC/pythonw_exe.rc $@
+
+python_nt.o: pythonnt_rc.h $(srcdir)/PC/python_nt.rc
+	$(WINDRES) -I$(srcdir)/Include -I$(srcdir)/PC -I. $(srcdir)/PC/python_nt.rc $@
+
+$(BUILDPYTHONW): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) pythonw_exe.o
+	$(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -municode -mwindows -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) pythonw_exe.o
+
+
+
 # Build the interpreter
-$(BUILDPYTHON):	Programs/python.o $(LINK_PYTHON_DEPS)
-	$(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(LINK_PYTHON_OBJS) $(LIBS) $(MODLIBS) $(SYSLIBS)
+$(BUILDPYTHON):	Programs/python.o $(LINK_PYTHON_DEPS) python_exe.o
+	$(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(LINK_PYTHON_OBJS) $(LIBS) $(MODLIBS) $(SYSLIBS) python_exe.o
 
 platform: $(PYTHON_FOR_BUILD_DEPS) pybuilddir.txt
 	$(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print("%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' >platform
@@ -810,10 +831,10 @@ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION
 
 # This rule builds the Cygwin Python DLL and import library if configured
 # for a shared core library; otherwise, this rule is a noop.
-$(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS)
+$(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS) python_nt.o
 	if test -n "$(DLLLIBRARY)"; then \
 		$(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
-			$(LIBS) $(MODLIBS) $(SYSLIBS); \
+			$(LIBS) $(MODLIBS) $(SYSLIBS) python_nt.o; \
 	else true; \
 	fi
 
@@ -1805,6 +1826,7 @@ altbininstall: $(BUILDPYTHON) @FRAMEWORK
 	done
 	if test "$(PYTHONFRAMEWORKDIR)" = "no-framework" ; then \
 		$(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(LDVERSION)$(EXE); \
+		$(INSTALL_PROGRAM) $(BUILDPYTHONW) $(DESTDIR)$(BINDIR)/python3w$(EXE); \
 	else \
 		$(INSTALL_PROGRAM) $(STRIPFLAG) Mac/pythonw $(DESTDIR)$(BINDIR)/python$(LDVERSION)$(EXE); \
 	fi
diff -rupN --no-dereference Python-3.11.8/PC/python_exe.rc Python-3.11.8-new/PC/python_exe.rc
--- Python-3.11.8/PC/python_exe.rc	2024-02-06 22:21:21.000000000 +0100
+++ Python-3.11.8-new/PC/python_exe.rc	2024-02-16 22:21:28.032345550 +0100
@@ -12,7 +12,7 @@
 // current versions of Windows.
 1 RT_MANIFEST "python.manifest"
 
-1 ICON DISCARDABLE "icons\python.ico" 
+1 ICON DISCARDABLE "icons/python.ico"
 
 
 /////////////////////////////////////////////////////////////////////////////
diff -rupN --no-dereference Python-3.11.8/PC/python_nt.rc Python-3.11.8-new/PC/python_nt.rc
--- Python-3.11.8/PC/python_nt.rc	2024-02-06 22:21:21.000000000 +0100
+++ Python-3.11.8-new/PC/python_nt.rc	2024-02-16 22:21:28.035345553 +0100
@@ -39,7 +39,7 @@ BEGIN
             VALUE "FileVersion", PYTHON_VERSION
             VALUE "InternalName", "Python DLL\0"
             VALUE "LegalCopyright", PYTHON_COPYRIGHT "\0"
-            VALUE "OriginalFilename", ORIGINAL_FILENAME "\0"
+            VALUE "OriginalFilename", PYTHON_DLL_NAME "\0"
             VALUE "ProductName", "Python\0"
             VALUE "ProductVersion", PYTHON_VERSION
         END
diff -rupN --no-dereference Python-3.11.8/PC/python_ver_rc.h Python-3.11.8-new/PC/python_ver_rc.h
--- Python-3.11.8/PC/python_ver_rc.h	2024-02-06 22:21:21.000000000 +0100
+++ Python-3.11.8-new/PC/python_ver_rc.h	2024-02-16 22:21:28.038345555 +0100
@@ -3,6 +3,7 @@
 //
 #pragma code_page(1252)
 #include "winver.h"
+#include "pythonnt_rc.h"
 
 #define PYTHON_COMPANY   "Python Software Foundation"
 #define PYTHON_COPYRIGHT "Copyright \xA9 2001-2023 Python Software Foundation. Copyright \xA9 2000 BeOpen.com. Copyright \xA9 1995-2001 CNRI. Copyright \xA9 1991-1995 SMC."
diff -rupN --no-dereference Python-3.11.8/PC/pythonw_exe.rc Python-3.11.8-new/PC/pythonw_exe.rc
--- Python-3.11.8/PC/pythonw_exe.rc	2024-02-06 22:21:21.000000000 +0100
+++ Python-3.11.8-new/PC/pythonw_exe.rc	2024-02-16 22:21:28.042345560 +0100
@@ -12,7 +12,7 @@
 // current versions of Windows.
 1 RT_MANIFEST "python.manifest"
 
-1 ICON DISCARDABLE "icons\pythonw.ico" 
+1 ICON DISCARDABLE "icons/pythonw.ico"
 
 
 /////////////////////////////////////////////////////////////////////////////
diff -rupN --no-dereference Python-3.11.8/Programs/python.c Python-3.11.8-new/Programs/python.c
--- Python-3.11.8/Programs/python.c	2024-02-06 22:21:21.000000000 +0100
+++ Python-3.11.8-new/Programs/python.c	2024-02-16 22:21:28.046345563 +0100
@@ -8,10 +8,9 @@ wmain(int argc, wchar_t **argv)
 {
     return Py_Main(argc, argv);
 }
-#else
+#endif
 int
 main(int argc, char **argv)
 {
     return Py_BytesMain(argc, argv);
 }
-#endif
openSUSE Build Service is sponsored by