Files
MINGW-packages/mingw-w64-python-pywin32/001-compile-and-setup-fixes.patch
Joan Karadimov d3bf624dad 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
2021-06-27 17:12:59 +02:00

415 lines
17 KiB
Diff
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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
@@ -264,16 +264,7 @@
MSVCCompiler.link = monkeypatched_link
-sdk_info = find_platform_sdk_dir()
-if not sdk_info:
- print()
- print("It looks like you are trying to build pywin32 in an environment without")
- print("the necessary tools installed. It's much easier to grab binaries!")
- print()
- print("Please read the docstring at the top of this file, or read README.md")
- print("for more information.")
- print()
- raise RuntimeError("Can't find the Windows SDK")
+sdk_info = { 'include': '', 'lib': '' }
class WinExt (Extension):
# Base class for all win32 extensions, with some predefined
@@ -305,11 +296,20 @@
extra_link_args = extra_link_args or []
if export_symbol_file:
- extra_link_args.append("/DEF:" + export_symbol_file)
+ extra_link_args.append(export_symbol_file)
# Some of our swigged files behave differently in distutils vs
# MSVC based builds. Always define DISTUTILS_BUILD so they can tell.
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
@@ -638,7 +632,7 @@
def finalize_options(self):
build_ext.finalize_options(self)
- self.windows_h_version = None
+ self.windows_h_version = 0x0600
# The pywintypes library is created in the build_temp
# directory, so we need to add this to library_dirs
self.library_dirs.append(self.build_temp)
@@ -865,7 +868,8 @@
log.debug("Looked for %s in %s", lib, look_dirs)
return "No library '%s'" % lib
self.found_libraries[lib.lower()] = found
- patched_libs.append(os.path.splitext(os.path.basename(found))[0])
+ lib_name = re.sub(r'^lib(.*)\.a', r'\1', os.path.basename(found))
+ patched_libs.append(os.path.splitext(lib_name)[0])
if ext.platforms and self.plat_name not in ext.platforms:
return "Only available on platforms %s" % (ext.platforms,)
@@ -975,6 +979,9 @@
if not self.compiler.initialized:
self.compiler.initialize()
+ if self.mingw32:
+ self.compiler.shared_lib_extension = '.dll'
+
self._fixup_sdk_dirs()
# Here we hack a "pywin32" directory (one of 'win32', 'win32com',
@@ -1226,7 +1233,7 @@
# XXX This has to be changed for mingw32
# Get the .lib files we need. This is limited to pywintypes,
# pythoncom and win32ui - but the first 2 have special names
- extra = self.debug and "_d.lib" or ".lib"
+ extra = self.debug and "_d.def" or ".def"
if ext.name in ("pywintypes", "pythoncom"):
# The import libraries are created as PyWinTypes23.lib, but
# are expected to be pywintypes.lib.
@@ -1551,7 +1549,7 @@
win32/src/win32crypt/PyCRYPTPROV.cpp
win32/src/win32crypt/PyCTL_CONTEXT.cpp
"""),
- ("win32file", "", None, 0x0500, """
+ ("win32file", "ws2_32 mswsock", None, 0x0500, """
win32/src/win32file.i
win32/src/win32file_comm.cpp
"""),
@@ -1813,7 +1813,7 @@
WinExt_win32com('axscript',
sources=("""
%(axscript)s/AXScript.cpp
- %(axscript)s/GUIDS.CPP %(axscript)s/PyGActiveScript.cpp
+ %(axscript)s/GUIDS.cpp %(axscript)s/PyGActiveScript.cpp
%(axscript)s/PyGActiveScriptError.cpp %(axscript)s/PyGActiveScriptParse.cpp
%(axscript)s/PyGActiveScriptSite.cpp %(axscript)s/PyGObjectSafety.cpp
%(axscript)s/PyIActiveScript.cpp %(axscript)s/PyIActiveScriptError.cpp
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
@@ -93,8 +93,8 @@
static cursorObject *cursor(PyObject *o) { return (cursorObject *)o; }
static void cursorDealloc(PyObject *self);
-PyMethodDef cursorMethods[];
-PyMemberDef cursorMembers[];
+extern PyMethodDef cursorMethods[8];
+extern PyMemberDef cursorMembers[3];
static PyTypeObject Cursor_Type = {
PYWIN_OBJECT_HEAD "odbccur", /*tp_name */
@@ -137,8 +137,8 @@
};
static void connectionDealloc(PyObject *self);
-PyMethodDef connectionMethods[];
-PyMemberDef connectionMembers[];
+extern PyMethodDef connectionMethods[6];
+extern PyMemberDef connectionMembers[2];
static PyTypeObject Connection_Type = {
PYWIN_OBJECT_HEAD "odbcconn", /*tp_name */
sizeof(connectionObject), /*tp_basicsize */
diff -aur 000/win32/src/PerfMon/perfmondata.cpp 001/win32/src/PerfMon/perfmondata.cpp
--- 000/win32/src/PerfMon/perfmondata.cpp 2015-04-09 21:00:48.772153700 -0300
+++ 001/win32/src/PerfMon/perfmondata.cpp 2015-04-09 21:02:02.366025800 -0300
@@ -93,9 +93,9 @@
// these are used to insure that the data collection functions
// accessed by Perflib will have the correct calling format.
//
-PM_OPEN_PROC OpenPerformanceData;
-PM_COLLECT_PROC CollectPerformanceData;
-PM_CLOSE_PROC ClosePerformanceData;
+extern "C" PM_OPEN_PROC OpenPerformanceData;
+extern "C" PM_COLLECT_PROC CollectPerformanceData;
+extern "C" PM_CLOSE_PROC ClosePerformanceData;
TCHAR szFullModulePath[MAX_PATH];
TCHAR szModuleName[MAX_PATH]; // will point into the buffer above.
@@ -414,7 +414,7 @@
--*/
{
HKEY hAppKey;
- TCHAR LogLevelKeyName[] = _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib");
+ TCHAR LogLevelKeyName[] = _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib");
TCHAR LogLevelValueName[] = _T("EventLogLevel");
LONG lStatus;
diff -aur 000/win32/src/PySecurityObjects.h 001/win32/src/PySecurityObjects.h
--- 000/win32/src/PySecurityObjects.h 2015-04-09 21:00:48.850278300 -0300
+++ 001/win32/src/PySecurityObjects.h 2015-04-09 21:01:55.881645000 -0300
@@ -118,7 +118,7 @@
static PyObject *GetSubAuthorityCount(PyObject *self, PyObject *args);
static PyObject *GetSubAuthority(PyObject *self, PyObject *args);
static PyObject *GetSidIdentifierAuthority(PyObject *self, PyObject *args);
- static struct PyMethodDef PySID::methods[];
+ static struct PyMethodDef methods[];
protected:
PSID m_psid;
@@ -155,7 +155,7 @@
/* Python support */
int compare(PyObject *ob);
static void deallocFunc(PyObject *ob);
- static struct PyMethodDef PyACL::methods[];
+ static struct PyMethodDef methods[];
static PyObject *Initialize(PyObject *self, PyObject *args);
static PyObject *IsValid(PyObject *self, PyObject *args);
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
@@ -49,7 +49,7 @@
PyObject *str();
PyObject *repr();
int compare(PyObject *ob);
- PyObject *PyTime::richcompare(PyObject *other, int op);
+ PyObject *richcompare(PyObject *other, int op);
int print(FILE *fp, int flags);
Py_hash_t hash(void);
diff -aur 000/win32/src/PyWinTypesmodule.cpp 001/win32/src/PyWinTypesmodule.cpp
--- 000/win32/src/PyWinTypesmodule.cpp 2015-04-09 21:00:48.990903200 -0300
+++ 001/win32/src/PyWinTypesmodule.cpp 2015-04-09 21:01:55.897264900 -0300
@@ -1119,7 +1119,7 @@
// Function to format a python traceback into a character string.
#define GPEM_ERROR(what) \
{ \
- errorMsg = "<Error getting traceback - "##what##">"; \
+ errorMsg = "<Error getting traceback - " what ">"; \
goto done; \
}
PYWINTYPES_EXPORT char *GetPythonTraceback(PyObject *exc_type, PyObject *exc_value, PyObject *exc_tb)
--- 000/win32/src/win32crypt/win32cryptmodule.cpp 2015-04-09 21:00:49.194027800 -0300
+++ 001/win32/src/win32crypt/win32cryptmodule.cpp 2015-04-09 21:02:02.397275800 -0300
@@ -581,44 +581,37 @@
pvPara = (void *)&cssrp;
}
else {
- switch ((ULONG_PTR)StoreProvider) {
- case CERT_STORE_PROV_PHYSICAL:
- case CERT_STORE_PROV_FILENAME:
- case CERT_STORE_PROV_SYSTEM:
- case CERT_STORE_PROV_SYSTEM_REGISTRY:
- case CERT_STORE_PROV_LDAP: {
+ if (StoreProvider == CERT_STORE_PROV_PHYSICAL ||
+ StoreProvider == CERT_STORE_PROV_FILENAME ||
+ StoreProvider == CERT_STORE_PROV_SYSTEM ||
+ StoreProvider == CERT_STORE_PROV_SYSTEM_REGISTRY ||
+ StoreProvider == CERT_STORE_PROV_LDAP) {
if (!PyWinObject_AsWCHAR(obpvPara, (WCHAR **)&pvPara))
return NULL;
free_wchar = TRUE;
- break;
- }
- case CERT_STORE_PROV_REG: {
+ }
+ else if (StoreProvider == CERT_STORE_PROV_REG) {
if (!PyWinObject_AsHKEY(obpvPara, (HKEY *)&pvPara))
return NULL;
- break;
- }
- case CERT_STORE_PROV_FILE: {
+ }
+ else if (StoreProvider == CERT_STORE_PROV_FILE) {
if (!PyWinObject_AsHANDLE(obpvPara, (HANDLE *)&pvPara))
return NULL;
- break;
- }
- case CERT_STORE_PROV_SERIALIZED:
- case CERT_STORE_PROV_PKCS7: {
+ }
+ else if (StoreProvider == CERT_STORE_PROV_SERIALIZED ||
+ StoreProvider == CERT_STORE_PROV_PKCS7) {
if (!PyWinObject_AsReadBuffer(obpvPara, (void **)&crypt_data_blob.pbData, &crypt_data_blob.cbData))
return NULL;
pvPara = (void *)&crypt_data_blob;
- break;
- }
- case CERT_STORE_PROV_MEMORY: {
+ }
+ else if (StoreProvider == CERT_STORE_PROV_MEMORY) {
// pvPara is not used, warn if something passed in
if (obpvPara != Py_None)
PyErr_Warn(PyExc_RuntimeWarning, "Para ignored for CERT_STORE_PROV_MEMORY");
- break;
- }
- default: {
+ }
+ else {
PyErr_SetString(PyExc_NotImplementedError, "Specified store provider type not supported");
return NULL;
- }
}
}
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
@@ -1206,6 +1206,14 @@
}
PyCFunction pfnPyEvtUpdateBookmark = (PyCFunction) PyEvtUpdateBookmark;
+#ifndef EVT_VARIANT_TYPE_ARRAY
+#define EVT_VARIANT_TYPE_ARRAY 128
+#endif
+
+#ifndef EVT_VARIANT_TYPE_MASK
+#define EVT_VARIANT_TYPE_MASK 0x7F
+#endif
+
PyObject *PyList_FromEVT_VARIANTArray(PEVT_VARIANT val)
{
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
@@ -163,7 +163,7 @@
PyDCB::~PyDCB(void) {}
#define GET_BITFIELD_ENTRY(bitfield_name) \
- else if (strcmp(name, #bitfield_name) == 0) { return PyInt_FromLong(pydcb->m_DCB.##bitfield_name); }
+ else if (strcmp(name, #bitfield_name) == 0) { return PyInt_FromLong(pydcb->m_DCB.bitfield_name); }
PyObject *PyDCB::getattro(PyObject *self, PyObject *obname)
{
@@ -198,7 +198,7 @@
PyErr_Format(PyExc_TypeError, szNeedIntAttr, #bitfield_name); \
return -1; \
} \
- pydcb->m_DCB.##bitfield_name = PyInt_AsLong(v); \
+ pydcb->m_DCB.bitfield_name = PyInt_AsLong(v); \
return 0; \
}
@@ -362,7 +362,7 @@
#undef GET_BITFIELD_ENTRY
#define GET_BITFIELD_ENTRY(bitfield_name) \
- else if (strcmp(name, #bitfield_name) == 0) { return PyInt_FromLong(pyCOMSTAT->m_COMSTAT.##bitfield_name); }
+ else if (strcmp(name, #bitfield_name) == 0) { return PyInt_FromLong(pyCOMSTAT->m_COMSTAT.bitfield_name); }
PyObject *PyCOMSTAT::getattro(PyObject *self, PyObject *obname)
{
@@ -391,7 +391,7 @@
PyErr_Format(PyExc_TypeError, szNeedIntAttr, #bitfield_name); \
return -1; \
} \
- pyCOMSTAT->m_COMSTAT.##bitfield_name = PyInt_AsLong(v); \
+ pyCOMSTAT->m_COMSTAT.bitfield_name = PyInt_AsLong(v); \
return 0; \
}
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
@@ -7,6 +7,22 @@
#include "Windows.h"
#include "WinInet.h"
#undef BOOLAPI // wininet.h defines this!
+
+#ifndef INTERNET_OPTION_CODEPAGE_PATH
+#define INTERNET_OPTION_CODEPAGE_PATH 100
+#endif
+
+#ifndef INTERNET_OPTION_CODEPAGE_EXTRA
+#define INTERNET_OPTION_CODEPAGE_EXTRA 101
+#endif
+
+#ifndef INTERNET_OPTION_IDN
+#define INTERNET_OPTION_IDN 102
+#endif
+
+#ifndef INTERNET_OPTION_HTTP_DECODING
+#define INTERNET_OPTION_HTTP_DECODING 65
+#endif
%}
%include "typemaps.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
@@ -1005,7 +1005,7 @@
{ \
if (i < seqLen) { \
PyObject *subItem = PyTuple_GET_ITEM(flags_tuple, i); \
- myCfg.cfg.##r = PyObject_IsTrue(subItem); \
+ myCfg.cfg.r = PyObject_IsTrue(subItem); \
} \
}
diff -aur 000/win32/src/win32service.i 001/win32/src/win32service.i
--- 000/win32/src/win32service.i 2015-04-09 21:00:49.990904900 -0300
+++ 001/win32/src/win32service.i 2015-04-09 21:02:02.475400700 -0300
@@ -57,6 +57,13 @@
if (fp!=NULL)
fpEnumServicesStatusEx=(EnumServicesStatusExfunc)fp;
}
+#ifndef SERVICE_CONTROL_PRESHUTDOWN
+#define SERVICE_CONTROL_PRESHUTDOWN 0x0000000F
+#endif
+
+#ifndef SERVICE_ACCEPT_PRESHUTDOWN
+#define SERVICE_ACCEPT_PRESHUTDOWN 0x00000100
+#endif
%}
%{
--- 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
// ---------------------------------------------------
//