From 5e5e5d087fa052bd6bff1a2a5ffcebf248e8003a Mon Sep 17 00:00:00 2001 From: Avasam Date: Mon, 7 Oct 2024 00:27:12 -0400 Subject: [PATCH] Remove unbuildable `exchdapi` (#2374) --- AutoDuck/pywin32.mak | 5 - com/win32comext/mapi/__init__.py | 6 - com/win32comext/mapi/src/exchange.i | 2 +- com/win32comext/mapi/src/exchdapi.i | 264 ---------------------------- mypy.ini | 2 +- setup.py | 33 +--- 6 files changed, 7 insertions(+), 305 deletions(-) delete mode 100644 com/win32comext/mapi/src/exchdapi.i diff --git a/AutoDuck/pywin32.mak b/AutoDuck/pywin32.mak index 7245cfb2e..b6dd33464 100644 --- a/AutoDuck/pywin32.mak +++ b/AutoDuck/pywin32.mak @@ -82,7 +82,6 @@ WIN32COM_SOURCE = \ $(GENDIR)\PyIProfAdmin.d \ $(GENDIR)\PyIProfSect.d \ $(GENDIR)\exchange.d \ - $(GENDIR)\exchdapi.d \ $(ADSI_DIR)\src\*.cpp \ $(GENDIR)\adsi.d \ $(GENDIR)\PyIADsContainer.d \ @@ -231,10 +230,6 @@ $(GENDIR)\PyIProfSect.d: $(MAPI_DIR)/src/$(*B).i $(GENDIR)\exchange.d: $(MAPI_DIR)/src/$(*B).i $(PYTHON) makedfromi.py -o$*.d $(MAPI_DIR)/src/$(*B).i -# Exchange stuff. -$(GENDIR)\exchdapi.d: $(MAPI_DIR)/src/$(*B).i - $(PYTHON) makedfromi.py -o$*.d $(MAPI_DIR)/src/$(*B).i - # ADSI $(GENDIR)\adsi.d: $(ADSI_DIR)/src/$(*B).i $(PYTHON) makedfromi.py -o$*.d $(ADSI_DIR)/src/$(*B).i diff --git a/com/win32comext/mapi/__init__.py b/com/win32comext/mapi/__init__.py index d15a79e1f..181ae1c5c 100644 --- a/com/win32comext/mapi/__init__.py +++ b/com/win32comext/mapi/__init__.py @@ -14,12 +14,6 @@ sys.modules["win32com.mapi.exchange"] = exchange except ImportError: pass - try: - import exchdapi - - sys.modules["win32com.mapi.exchdapi"] = exchdapi - except ImportError: - pass else: import win32com diff --git a/com/win32comext/mapi/src/exchange.i b/com/win32comext/mapi/src/exchange.i index a70523c97..19362694f 100644 --- a/com/win32comext/mapi/src/exchange.i +++ b/com/win32comext/mapi/src/exchange.i @@ -1,4 +1,4 @@ -/* File : exchdapi.i */ +/* File : exchange.i */ /* This is designed to be an interface to the Exchange specific diff --git a/com/win32comext/mapi/src/exchdapi.i b/com/win32comext/mapi/src/exchdapi.i deleted file mode 100644 index 6f7960de8..000000000 --- a/com/win32comext/mapi/src/exchdapi.i +++ /dev/null @@ -1,264 +0,0 @@ -/* File : exchdapi.i */ - -%module exchdapi // An COM interface to Exchange's DAPI - -//%{ -//#define UNICODE -//%} - - -%include "typemaps.i" -%include "pywin32.i" -%include "pythoncom.i" -%include "mapilib.i" - -%{ - -#include "PythonCOMServer.h" -#include "PythonCOMRegister.h" - -#include -#include "EDKMDB.H" -#include "EDKMAPI.H" -#include "EDKCFG.H" -#include "EXCHINST.H" -#include "EDKUTILS.H" -// see exchange.i - the stand-alone exchange SDK seems to be -// missing lots of functions -#if defined(EXCHANGE_RE) -# define DAPI_FUNCTIONS_MISSING -#endif - -%} - -// @pyswig |HrInstallService| -%{ -HRESULT MyHrInstallService( - TCHAR *lpszServer, - TCHAR *lpszSiteDN, - TCHAR *pszServiceDisplayName, - TCHAR *lpszServiceName, - TCHAR *lpszCommonName, - TCHAR *lpszObjectGuid, - TCHAR *lpszProductGuid, - TCHAR *lpszExeName, - TCHAR *lpszDependencies, - TCHAR *lpszAccount, - TCHAR *lpszPassword -) -{ -#if defined(DAPI_FUNCTIONS_MISSING) - PyErr_Warn(PyExc_RuntimeWarning, "Not available with this version of the Exchange SDK"); - return E_NOTIMPL; -#else - return HrInstallService(lpszServer, lpszSiteDN, pszServiceDisplayName, - lpszServiceName, lpszCommonName, lpszObjectGuid, - lpszProductGuid, lpszExeName, lpszDependencies, - lpszAccount, lpszPassword); -#endif -} -%} - -%name(HrInstallService) HRESULT MyHrInstallService( - TCHAR *INPUT, // lpszServer - TCHAR *INPUT, // lpszSiteDN - TCHAR *INPUT, // lpszServiceDisplayName - TCHAR *INPUT, // lpszServiceName - TCHAR *INPUT, // lpszCommonName - TCHAR *INPUT, // lpszObjectGuid - TCHAR *INPUT, // lpszProductGuid - TCHAR *INPUT, // lpszExeName - TCHAR *INPUT_NULLOK, // lpszDependencies - TCHAR *INPUT, // lpszAccount - TCHAR *INPUT_NULLOK // lpszPassword -); - - -// @pyswig |HrInstallMailboxAgent| -%{ -HRESULT MyHrInstallMailboxAgent( - TCHAR *Server, - TCHAR *SiteDN, - TCHAR *DisplayName, - TCHAR *RDN, - TCHAR *lpszExtensionName, - TCHAR *lpszExtensionData, - TCHAR *lpszAccountName) -{ -#if defined(DAPI_FUNCTIONS_MISSING) - PyErr_Warn(PyExc_RuntimeWarning, "Not available with this version of the Exchange SDK"); - return E_NOTIMPL; -#else - return HrInstallMailboxAgent(Server, SiteDN, DisplayName, RDN, - lpszExtensionName, lpszExtensionData, - lpszAccountName); -#endif -} -%} -%name(HrInstallMailboxAgent) HRESULT MyHrInstallMailboxAgent( - TCHAR *INPUT, // Server - TCHAR *INPUT, // SiteDN - TCHAR *INPUT, // DisplayName - TCHAR *INPUT, // RDN - TCHAR *INPUT_NULLOK, // lpszExtensionName - TCHAR *INPUT_NULLOK, // lpszExtensionData - TCHAR *INPUT_NULLOK // lpszAccountName -); - -// @pyswig |HrCreateMailboxAgentProfile| -HRESULT HrCreateMailboxAgentProfile( - char *INPUT, // @pyparm string|serviceName||The name of the service. - char *INPUT // @pyparm string|profile||The profile. -); - -// @pyswig |HrCreateGatewayProfile| -HRESULT HrCreateGatewayProfile( - char *INPUT, // @pyparm string|serviceName||The name of the service. - char *INPUT // @pyparm string|profile||The profile. -); - - -// @pyswig |HrMailboxAgentExists| -%{ -HRESULT MyHrMailboxAgentExists( - TCHAR *server, - TCHAR *siteDN, - TCHAR *rdn) -{ -#if defined(DAPI_FUNCTIONS_MISSING) - PyErr_Warn(PyExc_RuntimeWarning, "Not available with this version of the Exchange SDK"); - return E_NOTIMPL; -#else - return HrMailboxAgentExists(server, siteDN, rdn); -#endif -} -%} - -%name(HrMailboxAgentExists) HRESULT MyHrMailboxAgentExists( - TCHAR *INPUT, // @pyparm string|server||The name of the server - TCHAR *INPUT, // @pyparm string|siteDN||Contains the distinguished name (DN) of the site. - TCHAR *INPUT // @pyparm string|rdn||RDN of the site where the mailbox agent might exist. -); - - -// @pyswig |HrAdminProgramExists| -HRESULT HrAdminProgramExists(); - -// @pyswig |HrRemoveMailboxAgent|Removes a Mailbox Agent -%{ -HRESULT MyHrRemoveMailboxAgent( - TCHAR *server, - TCHAR *siteDN, - TCHAR *rdn) -{ -#if defined(DAPI_FUNCTIONS_MISSING) - PyErr_Warn(PyExc_RuntimeWarning, "Not available with this version of the Exchange SDK"); - return E_NOTIMPL; -#else - return HrRemoveMailboxAgent(server, siteDN, rdn); -#endif -} -%} - -%name(HrRemoveMailboxAgent) HRESULT MyHrRemoveMailboxAgent( - TCHAR *INPUT, // @pyparm string|server||The name of the server - TCHAR *INPUT, // @pyparm string|siteDN||Contains the distinguished name (DN) of the site. - TCHAR *INPUT // @pyparm string|rdn||RDN of the site where the mailbox agent exists. -); - -// @pyswig |HrRemoveProfile|Removes a profile -HRESULT HrRemoveProfile( - char *INPUT // @pyparm string|profile||The profile to delete. -); - -// @pyswig [string, ...]|HrEnumOrganizations|Lists the names of the organizations on the server. -%{ -HRESULT MyHrEnumOrganizations( - TCHAR *p1, - TCHAR *p2, - TCHAR **out) -{ -#if defined(DAPI_FUNCTIONS_MISSING) - PyErr_Warn(PyExc_RuntimeWarning, "Not available with this version of the Exchange SDK"); - return E_NOTIMPL; -#else - return HrEnumOrganizations(p1, p2, out); -#endif -} -%} -%name(HrEnumOrganizations) HRESULT MyHrEnumOrganizations( - TCHAR *INPUT_NULLOK, // @pyparm string|rootDN||Contains the distinguished name (DN) of the directory information tree (DIT) root. - TCHAR *INPUT_NULLOK, // @pyparm string|server||The name of the server - TCHAR **OUTPUT_ARRAY // lppszOrganizations -); - -// @pyswig [string, ...]|HrEnumSites|Lists the names of the sites in an organization. -%{ -HRESULT MyHrEnumSites( - TCHAR *p1, - TCHAR *p2, - TCHAR **out) -{ -#if defined(DAPI_FUNCTIONS_MISSING) - PyErr_Warn(PyExc_RuntimeWarning, "Not available with this version of the Exchange SDK"); - return E_NOTIMPL; -#else - return HrEnumSites(p1, p2, out); -#endif -} -%} -%name(HrEnumSites) HRESULT MyHrEnumSites( - TCHAR *INPUT_NULLOK, // @pyparm string|server||The name of the server - TCHAR *INPUT_NULLOK, // @pyparm string|organizationDN||Contains the distinguished name (DN) of the organization. - TCHAR **OUTPUT_ARRAY // lppszSites -); - -// @pyswig [string, ...]|HrEnumContainers|Lists the names of the containers on the server -%{ -HRESULT MyHrEnumContainers( - TCHAR *p1, - TCHAR *p2, - BOOL b, - TCHAR **out) -{ -#if defined(DAPI_FUNCTIONS_MISSING) - PyErr_Warn(PyExc_RuntimeWarning, "Not available with this version of the Exchange SDK"); - return E_NOTIMPL; -#else - return HrEnumContainers(p1, p2, b, out); -#endif -} -%} -%name(HrEnumContainers) HRESULT MyHrEnumContainers( - TCHAR *INPUT_NULLOK, // @pyparm string|server||The name of the server - TCHAR *INPUT, // @pyparm string|siteDN||Distinguished name (DN) of the site. - BOOL fSubtree, // @pyparm int|fSubtree|| - TCHAR **OUTPUT_ARRAY // lppszContainers -); - -// @pyswig [string, ...]|HrEnumSiteAdmins|Lists the administrators for a site. -%{ -HRESULT MyHrEnumSiteAdmins( - TCHAR *p1, - TCHAR *p2, - TCHAR **out) -{ -#if defined(DAPI_FUNCTIONS_MISSING) - PyErr_Warn(PyExc_RuntimeWarning, "Not available with this version of the Exchange SDK"); - return E_NOTIMPL; -#else - return HrEnumSiteAdmins(p1, p2, out); -#endif -} -%} -%name(HrEnumSiteAdmins) HRESULT MyHrEnumSiteAdmins( - TCHAR *INPUT, // @pyparm string|server||The name of the server - TCHAR *INPUT, // @pyparm string|siteDN||Distinguished name (DN) of the site. - TCHAR **OUTPUT_ARRAY // lppszAdmins -); - -// @pyswig string|HrGetServiceAccountName|Obtains the account name for a service. -HRESULT HrGetServiceAccountName( - char *INPUT, // @pyparm string|serviceName||The name of the service - char **OUTPUT_MAPI // @pyparm string|serviceName||The name of the service -); diff --git a/mypy.ini b/mypy.ini index a93198a2f..962e9a6cc 100644 --- a/mypy.ini +++ b/mypy.ini @@ -45,7 +45,7 @@ exclude = (?x)( ) ; C-modules that will need type-stubs -[mypy-adsi.*,dde,exchange,exchdapi,mapi,perfmon,servicemanager,win32api,win32console,win32clipboard,win32comext.adsi.adsi,win32event,win32evtlog,win32file,win32gui,win32help,win32pdh,win32process,win32ras,win32security,win32service,win32trace,win32ui,win32uiole,win32wnet,_win32sysloader,_winxptheme] +[mypy-adsi.*,dde,exchange,mapi,perfmon,servicemanager,win32api,win32console,win32clipboard,win32comext.adsi.adsi,win32event,win32evtlog,win32file,win32gui,win32help,win32pdh,win32process,win32ras,win32security,win32service,win32trace,win32ui,win32uiole,win32wnet,_win32sysloader,_winxptheme] ignore_missing_imports = True ; verstamp is installed from win32verstamp.py called in setup.py diff --git a/setup.py b/setup.py index ed481b524..0f481c2c0 100644 --- a/setup.py +++ b/setup.py @@ -319,8 +319,8 @@ def __init__(self, name, **kw): WinExt_win32com.__init__(self, name, **kw) def get_pywin32_dir(self): - # 'win32com.mapi.exchange' and 'win32com.mapi.exchdapi' currently only - # ones with this special requirement + # 'win32com.mapi.exchange' is currently the only + # one with this special requirement return "win32comext/mapi" @@ -387,14 +387,7 @@ def finalize_options(self): self.swig_cpp = True # hrm - deprecated - should use swig_opts=-c++?? def _why_cant_build_extension(self, ext): - # Return None, or a reason it can't be built. - # Exclude exchange 32-bit utility libraries from 64-bit - # builds. Note that the exchange module now builds, but only - # includes interfaces for 64-bit builds. - if self.plat_name in ["win-amd64", "win-arm64"] and ext.name == "exchdapi": - return "No 64-bit library for utility functions available." - if ext.name == "exchdapi": - return "Haven't worked out how to build on vs2015" + """Return None, or a reason it can't be built.""" # axdebug fails to build on 3.11 due to Python "frame" objects changing. # This could be fixed, but is almost certainly not in use any more, so # just skip it. @@ -1625,20 +1618,6 @@ def finalize_options(self): ) ).split(), ), - WinExt_win32com_mapi( - "exchdapi", - libraries="advapi32", - include_dirs=["{mapi}/mapi_headers".format(**dirs)], - sources=( - """ - {mapi}/exchdapi.i {mapi}/exchdapi.cpp - {mapi}/mapi_stub_library/MapiStubLibrary.cpp - {mapi}/mapi_stub_library/StubUtils.cpp - """.format( - **dirs - ) - ).split(), - ), WinExt_win32com( "shell", libraries="shell32", @@ -2068,9 +2047,7 @@ def finalize_options(self): "PyIProfAdmin": "", "PyIProfSect": "IMAPIProp", "PyIConverterSession": "", - # exchange and exchdapi - "exchange": None, - "exchdapi": None, + "exchange": None, # mapi module "PyIExchangeManageStore": "", "PyIExchangeManageStoreEx": "", # ADSI @@ -2376,7 +2353,7 @@ def maybe_fixup_exes(): # Print the list of extension modules we skipped building. excluded_extensions = dist.command_obj["build_ext"].excluded_extensions if excluded_extensions: - skip_whitelist = {"exchdapi", "exchange", "axdebug"} + skip_whitelist = {"exchange", "axdebug"} skipped_ex = [] print("*** NOTE: The following extensions were NOT %s:" % what_string) for ext, why in excluded_extensions: