python-pywin32: Fix more compilation errors

- update to 228
- drop Python 2 support
- fix some MAPI compilation problems
- simplfy the patch file for dependencies
- drop the patch file for min/max
- disable some modules
This commit is contained in:
Joan Karadimov
2020-06-20 14:25:30 +03:00
committed by Christoph Reiter
parent 266b4488a6
commit d3bf624dad
9 changed files with 285 additions and 391 deletions

View File

@@ -1,7 +1,7 @@
diff -aur 000/setup.py 001/setup.py
--- 000/setup.py 2015-04-09 21:00:48.725278100 -0300
+++ 001/setup.py 2015-04-09 21:02:02.350399800 -0300
@@ -245,16 +245,7 @@
@@ -264,16 +264,7 @@
MSVCCompiler.link = monkeypatched_link
@@ -19,7 +19,7 @@ diff -aur 000/setup.py 001/setup.py
class WinExt (Extension):
# Base class for all win32 extensions, with some predefined
@@ -291,11 +282,13 @@
@@ -305,11 +296,20 @@
extra_link_args = extra_link_args or []
if export_symbol_file:
@@ -31,6 +31,13 @@ diff -aur 000/setup.py 001/setup.py
define_macros = define_macros or []
+ define_macros.append(("NTDDI_VERSION", 0x06000000))
+ define_macros.append(("_WIN32_WINNT", 0x0600))
+ define_macros.append(("USE_COM_CONTEXT_DEF", None))
+ define_macros.append(("NO_PYCOM_IDISPATCHEX", None))
+ define_macros.append(("__in", ""))
+ define_macros.append(("__in_opt", ""))
+ define_macros.append(("__out", ""))
+ define_macros.append(("__deref_out_ecount_full(x)", ""))
+ define_macros.append(("_Check_return_", ""))
define_macros.append(("DISTUTILS_BUILD", None))
define_macros.append(("_CRT_SECURE_NO_WARNINGS", None))
self.pch_header = pch_header
@@ -164,7 +171,7 @@ diff -aur 000/win32/src/PySecurityObjects.h 001/win32/src/PySecurityObjects.h
diff -aur 000/win32/src/PyWinObjects.h 001/win32/src/PyWinObjects.h
--- 000/win32/src/PyWinObjects.h 2015-04-09 21:00:48.881528000 -0300
+++ 001/win32/src/PyWinObjects.h 2015-04-09 21:01:55.881645000 -0300
@@ -50,7 +50,7 @@
@@ -49,7 +49,7 @@
PyObject *str();
PyObject *repr();
int compare(PyObject *ob);
@@ -251,7 +258,7 @@ diff -aur 000/win32/src/PyWinTypesmodule.cpp 001/win32/src/PyWinTypesmodule.cpp
diff -aur 000/win32/src/win32evtlog.i 001/win32/src/win32evtlog.i
--- 000/win32/src/win32evtlog.i 2015-04-09 21:00:49.256528100 -0300
+++ 001/win32/src/win32evtlog.i 2015-04-09 21:02:02.397275800 -0300
@@ -997,6 +997,14 @@
@@ -1206,6 +1206,14 @@
}
PyCFunction pfnPyEvtUpdateBookmark = (PyCFunction) PyEvtUpdateBookmark;
@@ -263,9 +270,9 @@ diff -aur 000/win32/src/win32evtlog.i 001/win32/src/win32evtlog.i
+#define EVT_VARIANT_TYPE_MASK 0x7F
+#endif
+
PyObject *PyWinObject_FromEVT_VARIANT(PEVT_VARIANT val)
PyObject *PyList_FromEVT_VARIANTArray(PEVT_VARIANT val)
{
if (val->Type & EVT_VARIANT_TYPE_ARRAY){
if ((val->Type & EVT_VARIANT_TYPE_ARRAY) == 0) {
diff -aur 000/win32/src/win32file_comm.cpp 001/win32/src/win32file_comm.cpp
--- 000/win32/src/win32file_comm.cpp 2015-04-09 21:00:49.490903600 -0300
+++ 001/win32/src/win32file_comm.cpp 2015-04-09 21:02:02.412900800 -0300
@@ -334,7 +341,7 @@ diff -aur 000/win32/src/win32inet.i 001/win32/src/win32inet.i
diff -aur 000/win32/src/win32pdhmodule.cpp 001/win32/src/win32pdhmodule.cpp
--- 000/win32/src/win32pdhmodule.cpp 2015-04-09 21:00:49.662779100 -0300
+++ 001/win32/src/win32pdhmodule.cpp 2015-04-09 21:02:02.444150800 -0300
@@ -1004,7 +1004,7 @@
@@ -1005,7 +1005,7 @@
{ \
if (i < seqLen) { \
PyObject *subItem = PyTuple_GET_ITEM(flags_tuple, i); \
@@ -360,3 +367,48 @@ diff -aur 000/win32/src/win32service.i 001/win32/src/win32service.i
%}
%{
--- 000/com/win32comext/mapi/src/mapi_headers/mapidefs.h 2020-06-13 08:39:03.000000000 +0300
+++ 001/com/win32comext/mapi/src/mapi_headers/mapidefs.h 2020-06-19 16:10:51.180079900 +0300
@@ -2728,5 +2728,4 @@
#endif
#endif /* MAPIDEFS_H */
-
--- 000/com/win32comext/mapi/src/mapi_headers/MAPICode.h 2020-06-13 08:39:03.000000000 +0300
+++ 001/com/win32comext/mapi/src/mapi_headers/MAPICode.h 2020-06-19 16:11:57.872096400 +0300
@@ -216,5 +216,4 @@
#endif
#endif /* MAPICODE_H */
-
--- 000/com/win32comext/mapi/src/mapi_headers/MSPST.h 2020-06-13 08:39:03.000000000 +0300
+++ 001/com/win32comext/mapi/src/mapi_headers/MSPST.h 2020-06-19 16:12:52.572096500 +0300
@@ -97,5 +97,4 @@
0xd9, 0x6e, 0x00, 0x00 }
#endif /* _MSPST_H_ */
-
--- 000/com/win32comext/mapi/src/mapi_headers/MAPIForm.h 2020-06-13 08:39:03.000000000 +0300
+++ 001/com/win32comext/mapi/src/mapi_headers/MAPIForm.h 2020-06-20 13:20:38.548390500 +0300
@@ -631,5 +631,4 @@
#endif /* MAPIFORM_H */
-
--- 000/com/win32comext/mapi/src/PyIMAPIAdviseSink.cpp 2020-06-13 08:39:03.000000000 +0300
+++ 001/com/win32comext/mapi/src/PyIMAPIAdviseSink.cpp 2020-06-20 13:17:46.660390600 +0300
@@ -6,6 +6,10 @@
#include "PyMAPIUtil.h"
#include "PyIMAPIAdviseSink.h"
+#ifdef __MINGW32__
+#define __FUNCSIG__ __PRETTY_FUNCTION__
+#endif
+
// @doc - This file contains autoduck documentation
// ---------------------------------------------------
//

View File

@@ -0,0 +1,56 @@
diff -aur 000/setup.py 001/setup.py
--- 000/setup.py 2015-04-09 21:00:48.725278100 -0300
+++ 001/setup.py 2015-04-09 21:02:02.350399800 -0300
@@ -100,7 +100,7 @@
# some modules need a static CRT to avoid problems caused by them having a
# manifest.
-static_crt_modules = ["winxpgui"]
+static_crt_modules = []
from distutils.dep_util import newer_group
@@ -476,6 +476,7 @@
class WinExt_win32(WinExt):
def __init__ (self, name, **kw):
+ kw["libraries"] = kw.get("libraries", "") + " oleaut32 ole32 pywintypes"
WinExt.__init__(self, name, **kw)
def get_pywin32_dir(self):
return "win32"
@@ -499,7 +500,7 @@
# itself - thus, output is "win32comext"
class WinExt_win32com(WinExt):
def __init__ (self, name, **kw):
- kw["libraries"] = kw.get("libraries", "") + " oleaut32 ole32"
+ kw["libraries"] = kw.get("libraries", "") + " oleaut32 ole32 uuid pywintypes pythoncom"
# COM extensions require later windows headers.
if not kw.get("windows_h_version"):
@@ -1500,6 +1504,10 @@
"win32/src/PySecurityObjects.h",
],
extra_compile_args = ['-DBUILD_PYWINTYPES'],
+ extra_link_args = ['-Wl,--out-implib,build/temp.mingw-%d.%d/libpywintypes.dll.a' % (
+ sys.version_info.major,
+ sys.version_info.minor,
+ )],
libraries = "advapi32 user32 ole32 oleaut32",
pch_header = "PyWinTypes.h",
)
@@ -1764,9 +1762,13 @@
%(win32com)s/include\\PyIEnumContextProps.h %(win32com)s/include\\PyIClientSecurity.h
%(win32com)s/include\\PyIServerSecurity.h
""" % dirs).split(),
- libraries = "oleaut32 ole32 user32 urlmon",
- export_symbol_file = 'com/win32com/src/PythonCOM.def',
+ libraries = "oleaut32 ole32 user32 urlmon uuid pywintypes",
+ # export_symbol_file = 'com/win32com/src/PythonCOM.def',
extra_compile_args = ['-DBUILD_PYTHONCOM'],
+ extra_link_args = ['-Wl,--out-implib,build/temp.mingw-%d.%d/libpythoncom.dll.a' % (
+ sys.version_info.major,
+ sys.version_info.minor,
+ )],
pch_header = "stdafx.h",
windows_h_version = 0x500,
base_address = dll_base_address,

View File

@@ -1,193 +0,0 @@
diff -aur 000/win32/src/win32crypt/PyCRYPTPROV.cpp 001/win32/src/win32crypt/PyCRYPTPROV.cpp
--- 000/win32/src/win32crypt/PyCRYPTPROV.cpp 2015-04-09 21:00:49.100277500 -0300
+++ 001/win32/src/win32crypt/PyCRYPTPROV.cpp 2015-04-09 21:02:02.381651500 -0300
@@ -351,7 +352,7 @@
// initialize buffer with char string if passed if
ZeroMemory(pbBuffer, dwLen + 1);
if (seeddata != NULL)
- memcpy(pbBuffer, seeddata, min(dwLen, seedlen));
+ memcpy(pbBuffer, seeddata, __min(dwLen, seedlen));
if (CryptGenRandom(hcryptprov, dwLen, pbBuffer))
ret = PyString_FromStringAndSize((char *)pbBuffer, dwLen);
else
diff -aur 000/win32/src/PySECURITY_DESCRIPTOR.cpp 001/win32/src/PySECURITY_DESCRIPTOR.cpp
--- 000/win32/src/PySECURITY_DESCRIPTOR.cpp 2015-04-09 21:00:48.819029400 -0300
+++ 001/win32/src/PySECURITY_DESCRIPTOR.cpp 2015-04-09 21:01:55.881645000 -0300
@@ -786,7 +787,7 @@
{
ob_type = &PySECURITY_DESCRIPTORType;
_Py_NewReference(this);
- cb = max(cb, SECURITY_DESCRIPTOR_MIN_LENGTH);
+ cb = __max(cb, SECURITY_DESCRIPTOR_MIN_LENGTH);
PSECURITY_DESCRIPTOR psd = malloc(cb);
this->m_psd=NULL;
if (::InitializeSecurityDescriptor(psd, SECURITY_DESCRIPTOR_REVISION))
diff -aur 000/win32/src/win32gui.i 001/win32/src/win32gui.i
--- 000/win32/src/win32gui.i 2019-07-26 15:14:57.295569500 +0300
+++ 001/win32/src/win32gui.i 2019-07-26 15:15:11.562304200 +0300
@@ -3802,7 +3802,7 @@
nicons_got = 1;
#endif
// Asking for 1 always says it got 2!?
- nicons = min(nicons, nicons_got);
+ nicons = __min(nicons, nicons_got);
objects_large = PyList_New(nicons);
if (!objects_large) goto done;
objects_small = PyList_New(nicons);
@@ -6370,7 +6370,7 @@
// lpstrFile buffer receives full path and possibly multiple file names, allocate extra space
if (!PyWinObject_AsWCHAR(obFile, &initfile, TRUE, &initfilechars))
goto done;
- pofn->nMaxFile=max(pofn->nMaxFile, initfilechars+1);
+ pofn->nMaxFile=__max(pofn->nMaxFile, initfilechars+1);
bufsize=pofn->nMaxFile*sizeof(WCHAR);
pofn->lpstrFile=(LPWSTR)malloc(bufsize);
if (pofn->lpstrFile==NULL){
diff -aur 000/win32/src/win32inet.i 001/win32/src/win32inet.i
--- 000/win32/src/win32inet.i 2015-04-09 21:00:49.569028200 -0300
+++ 001/win32/src/win32inet.i 2015-04-09 21:02:02.428526500 -0300
@@ -1851,7 +1851,7 @@
}
}
if (bsuccess && GroupName)
- _tcsncpy(GroupInfo->szGroupName, GroupName, min(namelen, GROUPNAME_MAX_LENGTH));
+ _tcsncpy(GroupInfo->szGroupName, GroupName, __min(namelen, GROUPNAME_MAX_LENGTH));
Py_DECREF(dummy_tuple);
PyWinObject_FreeTCHAR(GroupName);
if (OwnerStorage)
diff -aur 000/win32/src/win32pdhmodule.cpp 001/win32/src/win32pdhmodule.cpp
--- 000/win32/src/win32pdhmodule.cpp 2015-04-09 21:00:49.662779100 -0300
+++ 001/win32/src/win32pdhmodule.cpp 2015-04-09 21:02:02.444150800 -0300
@@ -1082,7 +1083,7 @@
// Initialize the return buffer if starting path is passed in. (bInitializePath will also be set)
if (!PyWinObject_AsTCHAR(obInitialPath, &InitialPath, TRUE, &cchInitialPath))
return NULL; // Last exit without cleanup
- myCfg.cfg.cchReturnPathLength = max(cchInitialPath + 1, 1024);
+ myCfg.cfg.cchReturnPathLength = __max(cchInitialPath + 1, 1024);
myCfg.cfg.szReturnPathBuffer = (TCHAR *)malloc(myCfg.cfg.cchReturnPathLength * sizeof(TCHAR));
if (myCfg.cfg.szReturnPathBuffer == NULL) {
PyErr_NoMemory();
diff -aur 000/win32/src/win32trace.cpp 001/win32/src/win32trace.cpp
--- 000/win32/src/win32trace.cpp 2015-04-09 21:00:50.022154900 -0300
+++ 001/win32/src/win32trace.cpp 2015-04-09 21:02:02.475400700 -0300
@@ -315,7 +315,7 @@
BOOL rc = TRUE;
Py_BEGIN_ALLOW_THREADS const char *data_this = data;
while (len) {
- unsigned len_this = min(len, BUFFER_SIZE / 2);
+ unsigned len_this = __min(len, BUFFER_SIZE / 2);
BOOL ok = GetMyMutex();
if (ok) {
// must use types with identical size on win32 and win64
--- 000/com/win32com/src/PyGatewayBase.cpp 2019-07-26 01:25:33.000000000 +0300
+++ 001/com/win32com/src/PyGatewayBase.cpp 2019-07-27 11:50:36.216356200 +0300
@@ -382,7 +382,7 @@
// make sure its not a special DISPID we don't understand.
if (params->rgdispidNamedArgs[i] < 0)
return DISP_E_PARAMNOTFOUND;
- numArgs = max(numArgs, (UINT)params->rgdispidNamedArgs[i] + 1);
+ numArgs = __max(numArgs, (UINT)params->rgdispidNamedArgs[i] + 1);
}
PyObject *argList = PyTuple_New(numArgs);
@@ -597,7 +597,7 @@
ob = NULL;
firstByRef = 1;
}
- UINT max_args = min(cUserResult - firstByRef, pDispParams->cArgs);
+ UINT max_args = __min(cUserResult - firstByRef, pDispParams->cArgs);
UINT *offsets = (UINT *)_malloca(sizeof(UINT) * max_args);
// Get the offsets into our params of all BYREF args, in order.
fill_byref_offsets(pDispParams, offsets, max_args);
--- 000/com/win32comext/axcontrol/src/PyIOleCommandTarget.cpp 2019-07-26 01:25:33.000000000 +0300
+++ 001/com/win32comext/axcontrol/src/PyIOleCommandTarget.cpp 2019-07-27 12:24:16.667134100 +0300
@@ -205,7 +205,7 @@
ok = PyWinObject_AsAutoFreeBstr(obText, &tempString);
if (ok) {
UINT strLen = SysStringLen(tempString);
- UINT nwrite = min(strLen, pCmdText->cwBuf);
+ UINT nwrite = __min(strLen, pCmdText->cwBuf);
wcsncpy(pCmdText->rgwz, (WCHAR *)(BSTR)tempString, nwrite);
pCmdText->cwActual = nwrite;
}
diff -aur 000/win32/src/odbc.cpp 001/win32/src/odbc.cpp
--- 000/win32/src/odbc.cpp 2015-04-09 21:00:49.053401800 -0300
+++ 001/win32/src/odbc.cpp 2015-04-09 21:02:02.366025800 -0300
@@ -958,21 +958,21 @@
case SQL_DATE:
case SQL_TIMESTAMP:
case SQL_BIT:
- return (max(collen, (int)_tcslen(colname)));
+ return (__max(collen, (int)_tcslen(colname)));
case SQL_SMALLINT:
case SQL_INTEGER:
case SQL_TINYINT:
- return (max(collen + 1, (int)_tcslen(colname)));
+ return (__max(collen + 1, (int)_tcslen(colname)));
case SQL_DECIMAL:
case SQL_NUMERIC:
- return (max(collen + 2, (int)_tcslen(colname)));
+ return (__max(collen + 2, (int)_tcslen(colname)));
case SQL_REAL:
case SQL_FLOAT:
case SQL_DOUBLE:
- return (max(20, (int)_tcslen(colname)));
+ return (__max(20, (int)_tcslen(colname)));
case SQL_BINARY:
case SQL_VARBINARY:
- return (max(2 * collen, (int)_tcslen(colname)));
+ return (__max(2 * collen, (int)_tcslen(colname)));
case SQL_LONGVARBINARY:
case SQL_LONGVARCHAR:
default:
--- 000/com/win32comext/internet/src/PyIInternetProtocol.cpp 2019-07-26 01:25:33.000000000 +0300
+++ 001/com/win32comext/internet/src/PyIInternetProtocol.cpp 2019-07-27 15:30:10.810253700 +0300
@@ -178,7 +178,7 @@
}
else {
char *buf = PyString_AsString(result);
- *pcbRead = min(cb, (ULONG)PyString_Size(result));
+ *pcbRead = __min(cb, (ULONG)PyString_Size(result));
memcpy(pv, buf, *pcbRead);
}
return hr;
--- 000/com/win32comext/internet/src/PyIInternetProtocolInfo.cpp 2019-07-26 01:25:33.000000000 +0300
+++ 001/com/win32comext/internet/src/PyIInternetProtocolInfo.cpp 2019-07-27 15:31:50.481163500 +0300
@@ -233,7 +233,7 @@
if (!bPythonIsHappy)
return PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/);
++(*pcchResult); // Null terminator
- *pcchResult = min(*pcchResult, cchResult);
+ *pcchResult = __min(*pcchResult, cchResult);
memcpy(pwzResult, bstrTemp, *pcchResult * sizeof(WCHAR));
SysFreeString(bstrTemp);
Py_DECREF(result);
@@ -269,7 +269,7 @@
if (!bPythonIsHappy)
hr = PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/);
++(*pcchResult); // Null terminator
- *pcchResult = min(*pcchResult, cchResult);
+ *pcchResult = __min(*pcchResult, cchResult);
memcpy(pwzResult, bstrTemp, *pcchResult * sizeof(WCHAR));
SysFreeString(bstrTemp);
Py_DECREF(result);
@@ -332,7 +332,7 @@
}
}
else {
- *pcbBuf = min(cbBuffer, (ULONG)PyString_Size(result));
+ *pcbBuf = __min(cbBuffer, (ULONG)PyString_Size(result));
memcpy(pBuffer, PyString_AsString(result), *pcbBuf);
}
Py_DECREF(result);
--- 000/com/win32comext/internet/src/PyIInternetSecurityManager.cpp 2019-07-26 01:25:33.000000000 +0300
+++ 001/com/win32comext/internet/src/PyIInternetSecurityManager.cpp 2019-07-27 15:33:21.876845300 +0300
@@ -336,7 +336,7 @@
Py_DECREF(result);
return MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetSecurityId");
}
- *pcbSecurityId = min(buf_len, *pcbSecurityId);
+ *pcbSecurityId = __min(buf_len, *pcbSecurityId);
memcpy(pbSecurityId, buf, *pcbSecurityId);
Py_DECREF(result);
return hr;

View File

@@ -1,158 +0,0 @@
diff -aur 000/setup.py 001/setup.py
--- 000/setup.py 2015-04-09 21:00:48.725278100 -0300
+++ 001/setup.py 2015-04-09 21:02:02.350399800 -0300
@@ -1500,6 +1504,10 @@
"win32/src/PySecurityObjects.h",
],
extra_compile_args = ['-DBUILD_PYWINTYPES'],
+ extra_link_args = ['-Wl,--out-implib,build/temp.mingw-%d.%d/libpywintypes.dll.a' % (
+ sys.version_info.major,
+ sys.version_info.minor,
+ )],
libraries = "advapi32 user32 ole32 oleaut32",
pch_header = "PyWinTypes.h",
)
@@ -1608,7 +1606,7 @@
sources = info[4].split()
extra_compile_args = []
ext = WinExt_win32(name,
- libraries=lib_names,
+ libraries=(lib_names + ' pywintypes'),
extra_compile_args = extra_compile_args,
windows_h_version = windows_h_ver,
sources = sources,
@@ -1621,7 +1619,7 @@
sources = """
win32\\src\\win32evtlog_messages.mc win32\\src\\win32evtlog.i
""".split(),
- libraries="advapi32 oleaut32",
+ libraries="advapi32 oleaut32 pywintypes",
delay_load_libraries="wevtapi",
windows_h_version=0x0600
),
@@ -1629,7 +1627,7 @@
sources = """
win32/src/win32apimodule.cpp win32/src/win32api_display.cpp
""".split(),
- libraries="user32 advapi32 shell32 version",
+ libraries="user32 advapi32 shell32 version pywintypes",
delay_load_libraries="powrprof",
windows_h_version=0x0500,
),
@@ -1637,7 +1637,7 @@
win32/src/win32gui.i
""".split(),
windows_h_version=0x0500,
- libraries="gdi32 user32 comdlg32 comctl32 shell32",
+ libraries="gdi32 user32 comdlg32 comctl32 shell32 pywintypes",
define_macros = [("WIN32GUI", None)],
),
# winxpgui is built from win32gui.i, but sets up different #defines before
@@ -1649,7 +1647,7 @@
win32/src/winxpgui.rc win32/src/win32dynamicdialog.cpp
win32/src/win32gui.i
""".split(),
- libraries="gdi32 user32 comdlg32 comctl32 shell32",
+ libraries="gdi32 user32 comdlg32 comctl32 shell32 pywintypes",
windows_h_version=0x0500,
define_macros = [("WIN32GUI",None), ("WINXPGUI",None)],
extra_swig_commands=["-DWINXPGUI"],
@@ -1657,7 +1655,7 @@
# winxptheme
WinExt_win32("_winxptheme",
sources = ["win32/src/_winxptheme.i"],
- libraries="gdi32 user32 comdlg32 comctl32 shell32 Uxtheme",
+ libraries="gdi32 user32 comdlg32 comctl32 shell32 Uxtheme pywintypes",
windows_h_version=0x0500,
),
]
@@ -1665,7 +1663,7 @@
WinExt_win32('servicemanager',
sources = ["win32/src/PythonServiceMessages.mc", "win32/src/PythonService.cpp"],
extra_compile_args = ['-DPYSERVICE_BUILD_DLL'],
- libraries = "user32 ole32 advapi32 shell32",
+ libraries = "user32 ole32 advapi32 shell32 pywintypes",
windows_h_version = 0x500,
unicode_mode=True,),
]
@@ -1764,9 +1762,13 @@
%(win32com)s/include\\PyIEnumContextProps.h %(win32com)s/include\\PyIClientSecurity.h
%(win32com)s/include\\PyIServerSecurity.h
""" % dirs).split(),
- libraries = "oleaut32 ole32 user32 urlmon",
- export_symbol_file = 'com/win32com/src/PythonCOM.def',
+ libraries = "oleaut32 ole32 user32 urlmon uuid pywintypes",
+ # export_symbol_file = 'com/win32com/src/PythonCOM.def',
extra_compile_args = ['-DBUILD_PYTHONCOM'],
+ extra_link_args = ['-Wl,--out-implib,build/temp.mingw-%d.%d/libpythoncom.dll.a' % (
+ sys.version_info.major,
+ sys.version_info.minor,
+ )],
pch_header = "stdafx.h",
windows_h_version = 0x500,
base_address = dll_base_address,
@@ -1788,7 +1786,7 @@
%(adsi)s/PyADSIUtil.cpp %(adsi)s/PyDSOPObjects.cpp
%(adsi)s/PyIADs.cpp
""" % dirs).split()),
- WinExt_win32com('axcontrol', pch_header="axcontrol_pch.h",
+ WinExt_win32com('axcontrol', pch_header="axcontrol_pch.h", libraries = "uuid pywintypes pythoncom",
sources=("""
%(axcontrol)s/AXControl.cpp
%(axcontrol)s/PyIOleControl.cpp %(axcontrol)s/PyIOleControlSite.cpp
@@ -1800,7 +1800,7 @@
%(axcontrol)s/PyIOleObject.cpp %(axcontrol)s/PyIViewObject2.cpp
%(axcontrol)s/PyIOleCommandTarget.cpp
""" % dirs).split()),
- WinExt_win32com('axscript',
+ WinExt_win32com('axscript', libraries = "uuid pywintypes pythoncom",
sources=("""
%(axscript)s/AXScript.cpp
%(axscript)s/GUIDS.cpp %(axscript)s/PyGActiveScript.cpp
@@ -1873,7 +1871,7 @@
%(axdebug)s/stdafx.cpp
""" % dirs).split(),
),
- WinExt_win32com('internet', pch_header="internet_pch.h",
+ WinExt_win32com('internet', pch_header="internet_pch.h", libraries = "uuid pywintypes pythoncom",
sources=("""
%(internet)s/internet.cpp %(internet)s/PyIDocHostUIHandler.cpp
%(internet)s/PyIHTMLOMWindowServices.cpp %(internet)s/PyIInternetBindInfo.cpp
@@ -1930,7 +1928,7 @@
%(mapi)s/mapi_stub_library/MapiStubLibrary.cpp
%(mapi)s/mapi_stub_library/StubUtils.cpp
""" % dirs).split()),
- WinExt_win32com('shell', libraries='shell32', pch_header="shell_pch.h",
+ WinExt_win32com('shell', libraries='shell32 uuid pywintypes pythoncom', pch_header="shell_pch.h",
windows_h_version = 0x600,
sources=("""
%(shell)s/PyIActiveDesktop.cpp
@@ -2033,7 +2031,7 @@
),
- WinExt_win32com('taskscheduler', libraries='mstask',
+ WinExt_win32com('taskscheduler', libraries='mstask uuid pywintypes pythoncom',
sources=("""
%(taskscheduler)s/taskscheduler.cpp
%(taskscheduler)s/PyIProvideTaskPage.cpp
@@ -2078,8 +2076,8 @@
%(directsound)s/PyIDirectSoundCaptureBuffer.h %(directsound)s/PyIDirectSoundNotify.h
""" % dirs).split(),
optional_headers = ['dsound.h'],
- libraries='user32 dsound dxguid'),
- WinExt_win32com('authorization', libraries='aclui advapi32',
+ libraries='user32 dsound dxguid uuid pywintypes pythoncom'),
+ WinExt_win32com('authorization', libraries='aclui advapi32 pywintypes pythoncom',
sources=("""
%(authorization)s/authorization.cpp
%(authorization)s/PyGSecurityInformation.cpp
@@ -2273,7 +2273,7 @@
sources=[os.path.join("win32", "src", s) for s in
"PythonService.cpp PythonService.rc".split()],
unicode_mode = True,
- libraries = "user32 advapi32 ole32 shell32"),
+ libraries = "user32 advapi32 ole32 shell32 pywintypes"),
WinExt_pythonwin_subsys_win("Pythonwin",
sources = [
"Pythonwin/pythonwin.cpp",

View File

@@ -1,6 +1,6 @@
--- 000/win32/src/win32apimodule.cpp 2019-07-18 09:05:08.224088200 +0300
+++ 001/win32/src/win32apimodule.cpp 2018-09-28 09:32:03.000000000 +0300
@@ -706,7 +706,7 @@ static PyObject *PyFindCloseChangeNotification(PyObject *self, PyObject *args)
@@ -707,7 +707,7 @@ static PyObject *PyFindCloseChangeNotification(PyObject *self, PyObject *args)
}
// @pymethod string|win32api|FormatMessage|Returns an error message from the system error file.
@@ -9,7 +9,7 @@
{
int errCode = 0;
// @pyparm int|errCode|0|The error code to return the message for, If this value is 0, then GetLastError() is
@@ -788,6 +798,7 @@ static PyObject *PyFormatMessageA(PyObject *self, PyObject *args)
@@ -795,6 +795,7 @@ static PyObject *PyFormatMessageA(PyObject *self, PyObject *args)
{
baccessviolation = TRUE;
}
@@ -17,7 +17,7 @@
PyW32_END_ALLOW_THREADS
}
@@ -820,7 +831,7 @@ cleanup:
@@ -819,7 +818,7 @@ cleanup:
}
// @pymethod <o PyUnicode>|win32api|FormatMessageW|Returns an error message from the system error file.
@@ -34,7 +34,7 @@
PyW32_END_ALLOW_THREADS
}
@@ -5554,7 +5554,7 @@ static PyObject *PyApply(PyObject *self, PyObject *args)
@@ -5555,7 +5553,7 @@ static PyObject *PyApply(PyObject *self, PyObject *args)
Py_XDECREF(exc_type);
Py_XDECREF(exc_value);
ret = NULL;
@@ -43,3 +43,44 @@
return ret;
// @comm Calls the specified function in a manner similar to
// the built-in function apply(), but allows Win32 exceptions
--- 000/com/win32com/src/include/PythonCOM.h 2020-06-13 08:39:03.000000000 +0300
+++ 001/com/win32com/src/include/PythonCOM.h 2020-06-20 13:10:05.609363700 +0300
@@ -111,8 +111,6 @@
#ifdef __MINGW32__
// Special Mingw32 considerations.
#define NO_PYCOM_ENUMSTATPROPSTG
-#define __try try
-#define __except catch
#include <olectl.h>
#endif // __MINGW32__
--- 000/com/win32comext/mapi/src/mapi.i 2020-06-13 08:39:03.000000000 +0300
+++ 001/com/win32comext/mapi/src/mapi.i 2020-06-20 13:10:05.609363700 +0300
@@ -129,6 +129,7 @@
PyWin_SetAPIError("MAPIUninitialize", ERROR_INVALID_HANDLE);
rc = NULL;
}
+ __except_end
return rc;
}
--- 000/com/win32comext/shell/src/shell.cpp 2020-06-13 08:39:03.000000000 +0300
+++ 001/com/win32comext/shell/src/shell.cpp 2020-06-20 14:15:11.188333200 +0300
@@ -258,16 +258,13 @@
pidl = _ILNext(pidl);
}
}
-#if defined(__MINGW32__) || defined(MAINWIN)
- catch (...)
-#else
__except (EXCEPTION_EXECUTE_HANDLER)
-#endif
{
Py_DECREF(ret);
PyErr_SetString(PyExc_ValueError, "This string is an invalid PIDL (win32 exception unpacking)");
ret = NULL;
}
+ __except_end
if (bFreeSystemPIDL)
CoTaskMemFree((void *)pidl_free);
return ret;

View File

@@ -0,0 +1,89 @@
--- 000/setup.py 2020-06-20 14:41:31.583265800 +0300
+++ 001/setup.py 2020-06-20 17:41:06.998916300 +0300
@@ -1006,12 +1009,12 @@
# need at this stage.
if sys.version_info > (2, 7) and sys.version_info < (3, 3):
# only stuff built with msvc9 needs this loader.
- self._build_pycom_loader()
- self._build_scintilla()
+ #self._build_pycom_loader()
+ pass
+ #self._build_scintilla()
# Copy cpp lib files needed to create Python COM extensions
- clib_files = (['win32', 'pywintypes%s.lib'],
- ['win32com', 'pythoncom%s.lib'],
- ['win32com', 'axscript%s.lib'])
+ clib_files = (['win32', 'pywintypes%s.def'],
+ ['win32com', 'pythoncom%s.def'])
for clib_file in clib_files:
target_dir = os.path.join(self.build_lib, clib_file[0], "libs")
if not os.path.exists(target_dir):
@@ -1041,20 +1041,6 @@
mfc_version = "vc140"
mfc_libraries = ["mfc140u.dll", "mfcm140u.dll"]
- mfc_contents = self.lookupMfcInVisualStudio(mfc_version, mfc_libraries)
- if not mfc_contents:
- print("Can't find MFC contents in VisualStudio. Looking into WinSxS now..")
- mfc_contents = self.lookupMfcInWinSxS(mfc_version, mfc_libraries)
-
- if not mfc_contents:
- raise RuntimeError("No MFC files found!")
-
- for mfc_content in mfc_contents:
- shutil.copyfile(mfc_content,
- os.path.join(target_dir, os.path.split(mfc_content)[1]),
- )
-
-
def build_exefile(self, ext):
sources = ext.sources
if sources is None or type(sources) not in (list, tuple):
@@ -1917,6 +1920,6 @@
""" % dirs).split(),
depends=["%(internet)s/internet_pch.h" % dirs]),
- WinExt_win32com('mapi', libraries="advapi32", pch_header="PythonCOM.h",
+ WinExt_win32com('mapi', libraries="advapi32 SKIP", pch_header="PythonCOM.h",
include_dirs=["%(mapi)s/mapi_headers" % dirs],
sources=("""
%(mapi)s/mapi.i %(mapi)s/mapi.cpp
@@ -2041,6 +2045,6 @@
""" % dirs).split()),
- WinExt_win32com('propsys', libraries='propsys', delay_load_libraries='shell32',
+ WinExt_win32com('propsys', libraries='propsys SKIP', delay_load_libraries='shell32',
unicode_mode=True,
sources=("""
%(propsys)s/propsys.cpp
@@ -2122,6 +2127,7 @@
pythonwin_extensions = [
WinExt_pythonwin("win32ui",
+ libraries="SKIP",
sources = [
"Pythonwin/dbgthread.cpp",
"Pythonwin/dibapi.cpp",
@@ -2225,6 +2231,7 @@
],
optional_headers=['afxres.h']),
WinExt_pythonwin("win32uiole",
+ libraries="SKIP",
sources = [
"Pythonwin/stdafxole.cpp",
"Pythonwin/win32oleDlgInsert.cpp",
@@ -2242,6 +2249,7 @@
windows_h_version = 0x500,
optional_headers=['afxres.h']),
WinExt_pythonwin("dde",
+ libraries="SKIP",
sources = [
"Pythonwin/stddde.cpp",
"Pythonwin/ddetopic.cpp",
@@ -2292,6 +2300,7 @@
unicode_mode = True,
libraries = "user32 advapi32 ole32 shell32 pywintypes"),
WinExt_pythonwin_subsys_win("Pythonwin",
+ libraries="SKIP",
sources = [
"Pythonwin/pythonwin.cpp",
"Pythonwin/pythonwin.rc",

View File

@@ -8,51 +8,54 @@ pkgdesc='Python for Windows Extensions (mingw-w64)'
license=('PSF')
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
pkgver=225
pkgver=228
pkgrel=1
makedepends=(${MINGW_PACKAGE_PREFIX}-python2 ${MINGW_PACKAGE_PREFIX}-python2-setuptools
${MINGW_PACKAGE_PREFIX}-python3 ${MINGW_PACKAGE_PREFIX}-python3-setuptools
rsync)
makedepends=(${MINGW_PACKAGE_PREFIX}-python3 ${MINGW_PACKAGE_PREFIX}-python3-setuptools rsync)
pkgbase=mingw-w64-python-${_realname}
pkgname=(${MINGW_PACKAGE_PREFIX}-python2-${_realname} ${MINGW_PACKAGE_PREFIX}-python3-${_realname})
pkgname=(${MINGW_PACKAGE_PREFIX}-python3-${_realname})
source=("https://github.com/mhammond/${_realname}/archive/b${pkgver}.zip"
setup.cfg
seh.h
minmax.h
001-compile-and-setup-fixes.patch
002-min-max.patch
003-dependency-fixes.patch
004-seh.patch)
sha256sums=('4fe036b83caf8cfb1fcbf6cf98b82a11ab1e41d2b652121d0a4395b5e9deeb46'
002-dependency-fixes.patch
003-seh.patch
004-disable-modules.patch)
sha256sums=('524a40b85bd0d0bd52a5bcce7ccb236ae46a336975df5452b336d813f4b64a6d'
'74033ac90498a63b579b4dd8c5948b2ea1a9de63aa57f3d4e4e44bb0f549520b'
'03f8c0372059bb5b1933d77309101c67fa08504b42a6fce1186ed9a29e0c271f'
'071b119512ee06ea9008b96f83f6a38fdbcd55266758e169da64340861f29c3b'
'0dc953883a2917f1eddb93f1615db9749b5f758664ec539a4bf2a96f11087524'
'0013d3bb9b10511f28e5e71fa59b0431445a5cfc5ae7950e33251af14a087f5f'
'726ab045a127c98bd431f6840a7f63042668e61fa5d22834af4e5f8a2ea4cf70')
'17eb1454e8955771af57209a49439f7cf26a885767a8e707f6c77e3c3ccd479f'
'a6dc5c309148b85cd0b2e90f673d998528747e9fceab43d246bbe17ee7a4c8ad'
'fcc23eaaff99160147db4dd48cf951b6db62adb8287807e7a281c032902c4f98'
'109a3ece2cfa359b6e68aebbcc74db4b7e80eda0be3d9c6bed88a7d099c70d37'
'e8c32de54fe2a375b0331fae36efaa4400518386d03ee429da13e1846b4c2e08')
prepare() {
cd "${srcdir}/${_realname}-b${pkgver}"
patch -p1 < "${startdir}"/001-compile-and-setup-fixes.patch
patch -p1 < "${startdir}"/002-min-max.patch
patch -p1 < "${startdir}"/003-dependency-fixes.patch
patch -p1 < "${startdir}"/004-seh.patch
patch -p1 < "${startdir}"/002-dependency-fixes.patch
patch -p1 < "${startdir}"/003-seh.patch
patch -p1 < "${startdir}"/004-disable-modules.patch
cp "${startdir}"/setup.cfg setup.cfg
}
build() {
for _python in python2 python3; do
msg2 "Synchronizing ${_python} build directory"
rsync --recursive --times "${srcdir}/${_realname}-b${pkgver}"/* "${srcdir}/build-${_python}-${CARCH}-${_realname}-${pkgver}"
cd "${srcdir}/build-${_python}-${CARCH}-${_realname}-${pkgver}"
CFLAGS="-Wno-narrowing -fno-operator-names -fpermissive -include ../seh.h -DCRYPT_DECRYPT_MESSAGE_PARA_HAS_EXTRA_FIELDS" \
LIB="${MINGW_PREFIX}/lib:${MINGW_PREFIX}/${CARCH}-w64-mingw32/lib" \
INCLUDE="${MINGW_PREFIX}/include:${MINGW_PREFIX}/${CARCH}-w64-mingw32/include" \
${MINGW_PREFIX}/bin/${_python} setup.py build --compiler=mingw32
done
msg2 "Synchronizing build directory"
rsync --recursive --times "${srcdir}/${_realname}-b${pkgver}"/* "${srcdir}/build-python3-${CARCH}-${_realname}-${pkgver}"
cd "${srcdir}/build-python3-${CARCH}-${_realname}-${pkgver}"
CFLAGS="-Wno-narrowing -fno-operator-names -fpermissive -include ../seh.h -include ../minmax.h -DCRYPT_DECRYPT_MESSAGE_PARA_HAS_EXTRA_FIELDS" \
LIB="${MINGW_PREFIX}/lib:${MINGW_PREFIX}/${CARCH}-w64-mingw32/lib" \
INCLUDE="${MINGW_PREFIX}/include:${MINGW_PREFIX}/${CARCH}-w64-mingw32/include" \
${MINGW_PREFIX}/bin/python3 setup.py build
}
_package() {
cd "${srcdir}/build-${_python}-${CARCH}-${_realname}-${pkgver}"
cd "${srcdir}/build-python3-${CARCH}-${_realname}-${pkgver}"
LIB="${MINGW_PREFIX}/lib:${MINGW_PREFIX}/${CARCH}-w64-mingw32/lib" \
DISTUTILS_DEBUG=1 \
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
${MINGW_PREFIX}/bin/${_python} setup.py install \
${MINGW_PREFIX}/bin/python3 setup.py install \
--prefix=${MINGW_PREFIX} \
--root="${pkgdir}" \
--optimize=1
@@ -60,12 +63,12 @@ _package() {
package_python2-pywin32() {
depends=(${MINGW_PACKAGE_PREFIX}-python2-setuptools)
_python=python2 _package
_package
}
package_python3-pywin32() {
depends=(${MINGW_PACKAGE_PREFIX}-python3-setuptools)
_python=python3 _package
_package
}
# template start; name=mingw-w64-splitpkg-wrappers; version=1.0;

View File

@@ -0,0 +1,2 @@
#define min(a, b) (((a)<(b))?(a):(b))
#define max(a, b) (((a)>(b))?(a):(b))

View File

@@ -0,0 +1,2 @@
[build]
compiler=mingw32