]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-41070: Simplify pyshellext.dll build (GH-21037)
authorNikita Nemkin <nikita@nemkin.ru>
Tue, 23 Jun 2020 23:32:23 +0000 (04:32 +0500)
committerGitHub <noreply@github.com>
Tue, 23 Jun 2020 23:32:23 +0000 (00:32 +0100)
Replace MIDL-generated file with manual GUID definition.
Use the same .def file for release and debug builds.
Update setup build to support latest toolset

PC/pyshellext.cpp
PC/pyshellext.def
PC/pyshellext.idl [deleted file]
PC/pyshellext_d.def [deleted file]
PCbuild/pyshellext.vcxproj
PCbuild/pyshellext.vcxproj.filters
Tools/msi/bundle/bootstrap/pythonba.vcxproj

index 019880264bee92946deea391d0a765a29c061f9f..ffca169857c37596e0cf216fbd0c5e84c5a00552 100644 (file)
 #include <olectl.h>
 #include <strsafe.h>
 
-#include "pyshellext_h.h"
-
 #define DDWM_UPDATEWINDOW (WM_USER+3)
 
 static HINSTANCE hModule;
 static CLIPFORMAT cfDropDescription;
 static CLIPFORMAT cfDragWindow;
 
-static const LPCWSTR CLASS_SUBKEY = L"Software\\Classes\\CLSID\\{BEA218D2-6950-497B-9434-61683EC065FE}";
+#define CLASS_GUID "{BEA218D2-6950-497B-9434-61683EC065FE}"
+static const LPCWSTR CLASS_SUBKEY = L"Software\\Classes\\CLSID\\" CLASS_GUID;
 static const LPCWSTR DRAG_MESSAGE = L"Open with %1";
 
 using namespace Microsoft::WRL;
@@ -121,8 +120,7 @@ HRESULT FilenameListCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, LPCWSTR psz
     return hr;
 }
 
-
-class PyShellExt : public RuntimeClass<
+class DECLSPEC_UUID(CLASS_GUID) PyShellExt : public RuntimeClass<
     RuntimeClassFlags<ClassicCom>,
     IDropTarget,
     IPersistFile
@@ -483,7 +481,7 @@ public:
     }
 
     STDMETHODIMP GetClassID(CLSID *pClassID) {
-        *pClassID = CLSID_PyShellExt;
+        *pClassID = __uuidof(PyShellExt);
         return S_OK;
     }
 };
index 5424bd1180d24715db78e623458c7a62e7cb46f4..288a9adf982f19718f51b610bf8169e5e6f0f2e4 100644 (file)
@@ -1,4 +1,3 @@
-LIBRARY        "pyshellext"
 EXPORTS
   DllRegisterServer PRIVATE
   DllUnregisterServer PRIVATE
diff --git a/PC/pyshellext.idl b/PC/pyshellext.idl
deleted file mode 100644 (file)
index c0a1838..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-import "ocidl.idl";
-
-[uuid(44039A76-3BDD-41C1-A31B-71C00202CE81), version(1.0)]
-library PyShellExtLib
-{
-    [uuid(BEA218D2-6950-497B-9434-61683EC065FE), version(1.0)]
-    coclass PyShellExt
-    {
-        [default] interface IDropTarget;
-        interface IPersistFile;
-    }
-};
\ No newline at end of file
diff --git a/PC/pyshellext_d.def b/PC/pyshellext_d.def
deleted file mode 100644 (file)
index 7d2148b..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-LIBRARY        "pyshellext_d"
-EXPORTS
-  DllRegisterServer PRIVATE
-  DllUnregisterServer PRIVATE
-  DllGetClassObject PRIVATE
-  DllCanUnloadNow PRIVATE
index 655054e3723b431d9d4c99c77b5de60ec2e54465..ea432d6bc9a3f33f6f041144ed3bbd12ecb162fb 100644 (file)
@@ -96,7 +96,7 @@
     <Link>
       <AdditionalDependencies>version.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <SubSystem>Console</SubSystem>
-      <ModuleDefinitionFile>..\PC\pyshellext$(PyDebugExt).def</ModuleDefinitionFile>
+      <ModuleDefinitionFile>..\PC\pyshellext.def</ModuleDefinitionFile>
     </Link>
     <Midl>
       <CompileInterface>true</CompileInterface>
   </ItemDefinitionGroup>
   <ItemGroup>
     <ClCompile Include="..\PC\pyshellext.cpp" />
-    <Midl Include="..\PC\pyshellext.idl" />
   </ItemGroup>
   <ItemGroup>
     <None Include="..\PC\pyshellext.def" />
-    <None Include="..\PC\pyshellext_d.def" />
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="..\PC\pyshellext.rc" />
index 36d1d1655f5dfdbfbdcf86086e7d9ef5d4d873de..77cd3060857a80b536256d5ccb1ba9e0e0fec690 100644 (file)
       <Filter>Source Files</Filter>
     </ClCompile>
   </ItemGroup>
-  <ItemGroup>
-    <Midl Include="..\PC\pyshellext.idl">
-      <Filter>Source Files</Filter>
-    </Midl>
-  </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="..\PC\pyshellext.rc">
       <Filter>Resource Files</Filter>
@@ -29,8 +24,5 @@
     <None Include="..\PC\pyshellext.def">
       <Filter>Source Files</Filter>
     </None>
-    <None Include="..\PC\pyshellext_d.def">
-      <Filter>Source Files</Filter>
-    </None>
   </ItemGroup>
 </Project>
\ No newline at end of file
index 75aad442a4403633af02fdc84d4cf96b4e2f58cd..ef71fe7da08d32b550d832005cef79d69dff5b0d 100644 (file)
@@ -21,6 +21,9 @@
   <PropertyGroup Label="Globals">
     <Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
     <Platform Condition="'$(Platform)' == ''">Win32</Platform>
+    <PlatformToolset Condition="'$(PlatformToolset)' == '' and ('$(MSBuildToolsVersion)' == '16.0' or '$(VisualStudioVersion)' == '16.0')">v142</PlatformToolset>
+    <PlatformToolset Condition="'$(PlatformToolset)' == '' and ('$(MSBuildToolsVersion)' == '15.0' or '$(VisualStudioVersion)' == '15.0')">v141</PlatformToolset>
+    <PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(VCTargetsPath14)' != ''">v140</PlatformToolset>
     <PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(VCTargetsPath14)' != ''">v140</PlatformToolset>
     <PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(VCTargetsPath12)' != ''">v120</PlatformToolset>
     <ProjectGuid>{7A09B132-B3EE-499B-A700-A4B2157FEA3D}</ProjectGuid>
@@ -47,6 +50,8 @@
     </ClCompile>
     <Link>
       <AdditionalDependencies>comctl32.lib;gdiplus.lib;msimg32.lib;shlwapi.lib;wininet.lib;dutil.lib;balutil.lib;version.lib;uxtheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories Condition="'$(PlatformToolset)' == 'v142'">$(WixInstallPath)sdk\vs2017\lib\x86</AdditionalLibraryDirectories>
+      <AdditionalLibraryDirectories Condition="'$(PlatformToolset)' == 'v141'">$(WixInstallPath)sdk\vs2017\lib\x86</AdditionalLibraryDirectories>
       <AdditionalLibraryDirectories Condition="'$(PlatformToolset)' == 'v140'">$(WixInstallPath)sdk\vs2015\lib\x86</AdditionalLibraryDirectories>
       <AdditionalLibraryDirectories Condition="'$(PlatformToolset)' == 'v120'">$(WixInstallPath)sdk\vs2013\lib\x86</AdditionalLibraryDirectories>
       <ModuleDefinitionFile>pythonba.def</ModuleDefinitionFile>