Skip to content

Commit 9cb02cf

Browse files
committed
Fix to clienthandler lib, there are now 2 lib files generated for
Python 2.7 and 3.2 so that Cython compilation doesn't break.
1 parent 24a7f36 commit 9cb02cf

File tree

8 files changed

+209
-14
lines changed

8 files changed

+209
-14
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
*.aps
1919
*.sdf
2020

21-
Debug/
22-
Release/
21+
Debug*/
22+
Release*/

clienthandler/clienthandler.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@
1313

1414
// To be able to use 'public' declarations you need to include Python.h and cefpython.h.
1515
#include "Python.h"
16+
17+
// Python 3.2 fix - DL_IMPORT is not defined in Python.h
18+
19+
#ifndef DL_IMPORT /* declarations for DLL import/export */
20+
#define DL_IMPORT(RTYPE) RTYPE
21+
#endif
22+
#ifndef DL_EXPORT /* declarations for DLL import/export */
23+
#define DL_EXPORT(RTYPE) RTYPE
24+
#endif
25+
1626
#include "setup/cefpython.h"
1727

1828
// CefLoadHandler types.

clienthandler/clienthandler.sln

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11

22
Microsoft Visual Studio Solution File, Format Version 10.00
33
# Visual Studio 2008
4-
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clienthandler", "clienthandler.vcproj", "{15AD928F-FFD0-4FA5-B469-E42ABB0B4196}"
4+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clienthandler_py27", "clienthandler_py27.vcproj", "{15AD928F-FFD0-4FA5-B469-E42ABB0B4196}"
5+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC943}") = "clienthandler_py32", "clienthandler_py32.vcproj", "{37AA7CD9-67AD-40B1-ADC0-D62173764BCA}"
56
EndProject
67
Global
78
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -13,6 +14,10 @@ Global
1314
{15AD928F-FFD0-4FA5-B469-E42ABB0B4196}.Debug|Win32.Build.0 = Debug|Win32
1415
{15AD928F-FFD0-4FA5-B469-E42ABB0B4196}.Release|Win32.ActiveCfg = Release|Win32
1516
{15AD928F-FFD0-4FA5-B469-E42ABB0B4196}.Release|Win32.Build.0 = Release|Win32
17+
{37AA7CD9-67AD-40B1-ADC0-D62173764BCA}.Debug|Win32.ActiveCfg = Debug|Win32
18+
{37AA7CD9-67AD-40B1-ADC0-D62173764BCA}.Debug|Win32.Build.0 = Debug|Win32
19+
{37AA7CD9-67AD-40B1-ADC0-D62173764BCA}.Release|Win32.ActiveCfg = Release|Win32
20+
{37AA7CD9-67AD-40B1-ADC0-D62173764BCA}.Release|Win32.Build.0 = Release|Win32
1621
EndGlobalSection
1722
GlobalSection(SolutionProperties) = preSolution
1823
HideSolutionNode = FALSE
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
<VisualStudioProject
33
ProjectType="Visual C++"
44
Version="9,00"
5-
Name="clienthandler"
5+
Name="clienthandler_py27"
66
ProjectGUID="{15AD928F-FFD0-4FA5-B469-E42ABB0B4196}"
7+
RootNamespace="clienthandler_py27"
78
Keyword="Win32Proj"
89
TargetFrameworkVersion="0"
910
>
@@ -17,8 +18,8 @@
1718
<Configurations>
1819
<Configuration
1920
Name="Debug|Win32"
20-
OutputDirectory="Debug"
21-
IntermediateDirectory="Debug"
21+
OutputDirectory="Debug_py27"
22+
IntermediateDirectory="Debug_py27"
2223
ConfigurationType="4"
2324
>
2425
<Tool
@@ -78,8 +79,8 @@
7879
</Configuration>
7980
<Configuration
8081
Name="Release|Win32"
81-
OutputDirectory="Release"
82-
IntermediateDirectory="Release"
82+
OutputDirectory="Release_py27"
83+
IntermediateDirectory="Release_py27"
8384
ConfigurationType="4"
8485
>
8586
<Tool
@@ -99,7 +100,7 @@
99100
/>
100101
<Tool
101102
Name="VCCLCompilerTool"
102-
AdditionalIncludeDirectories="D:\python27_d\PC;D:\python27_d\Include;../"
103+
AdditionalIncludeDirectories="D:\python27_src\PC;D:\python27_src\Include;../"
103104
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;"
104105
RuntimeLibrary="0"
105106
UsePrecompiledHeader="0"
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<VisualStudioProject
3+
ProjectType="Visual C++"
4+
Version="9,00"
5+
Name="clienthandler_py32"
6+
ProjectGUID="{37AA7CD9-67AD-40B1-ADC0-D62173764BCA}"
7+
Keyword="Win32Proj"
8+
TargetFrameworkVersion="0"
9+
>
10+
<Platforms>
11+
<Platform
12+
Name="Win32"
13+
/>
14+
</Platforms>
15+
<ToolFiles>
16+
</ToolFiles>
17+
<Configurations>
18+
<Configuration
19+
Name="Debug|Win32"
20+
OutputDirectory="Debug_py27"
21+
IntermediateDirectory="Debug_py27"
22+
ConfigurationType="4"
23+
>
24+
<Tool
25+
Name="VCPreBuildEventTool"
26+
/>
27+
<Tool
28+
Name="VCCustomBuildTool"
29+
/>
30+
<Tool
31+
Name="VCXMLDataGeneratorTool"
32+
/>
33+
<Tool
34+
Name="VCWebServiceProxyGeneratorTool"
35+
/>
36+
<Tool
37+
Name="VCMIDLTool"
38+
/>
39+
<Tool
40+
Name="VCCLCompilerTool"
41+
Optimization="0"
42+
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;"
43+
MinimalRebuild="true"
44+
BasicRuntimeChecks="3"
45+
RuntimeLibrary="3"
46+
UsePrecompiledHeader="0"
47+
WarningLevel="3"
48+
Detect64BitPortabilityProblems="true"
49+
DebugInformationFormat="4"
50+
/>
51+
<Tool
52+
Name="VCManagedResourceCompilerTool"
53+
/>
54+
<Tool
55+
Name="VCResourceCompilerTool"
56+
/>
57+
<Tool
58+
Name="VCPreLinkEventTool"
59+
/>
60+
<Tool
61+
Name="VCLibrarianTool"
62+
/>
63+
<Tool
64+
Name="VCALinkTool"
65+
/>
66+
<Tool
67+
Name="VCXDCMakeTool"
68+
/>
69+
<Tool
70+
Name="VCBscMakeTool"
71+
/>
72+
<Tool
73+
Name="VCFxCopTool"
74+
/>
75+
<Tool
76+
Name="VCPostBuildEventTool"
77+
/>
78+
</Configuration>
79+
<Configuration
80+
Name="Release|Win32"
81+
OutputDirectory="Release_py32"
82+
IntermediateDirectory="Release_py32"
83+
ConfigurationType="4"
84+
>
85+
<Tool
86+
Name="VCPreBuildEventTool"
87+
/>
88+
<Tool
89+
Name="VCCustomBuildTool"
90+
/>
91+
<Tool
92+
Name="VCXMLDataGeneratorTool"
93+
/>
94+
<Tool
95+
Name="VCWebServiceProxyGeneratorTool"
96+
/>
97+
<Tool
98+
Name="VCMIDLTool"
99+
/>
100+
<Tool
101+
Name="VCCLCompilerTool"
102+
AdditionalIncludeDirectories="D:\python32_src\PC;D:\python32_src\Include;../"
103+
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;"
104+
RuntimeLibrary="0"
105+
UsePrecompiledHeader="0"
106+
WarningLevel="3"
107+
Detect64BitPortabilityProblems="false"
108+
DebugInformationFormat="3"
109+
/>
110+
<Tool
111+
Name="VCManagedResourceCompilerTool"
112+
/>
113+
<Tool
114+
Name="VCResourceCompilerTool"
115+
/>
116+
<Tool
117+
Name="VCPreLinkEventTool"
118+
/>
119+
<Tool
120+
Name="VCLibrarianTool"
121+
/>
122+
<Tool
123+
Name="VCALinkTool"
124+
/>
125+
<Tool
126+
Name="VCXDCMakeTool"
127+
/>
128+
<Tool
129+
Name="VCBscMakeTool"
130+
/>
131+
<Tool
132+
Name="VCFxCopTool"
133+
/>
134+
<Tool
135+
Name="VCPostBuildEventTool"
136+
/>
137+
</Configuration>
138+
</Configurations>
139+
<References>
140+
</References>
141+
<Files>
142+
<Filter
143+
Name="Header Files"
144+
Filter="h;hpp;hxx;hm;inl;inc;xsd"
145+
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
146+
>
147+
<File
148+
RelativePath=".\clienthandler.h"
149+
>
150+
</File>
151+
</Filter>
152+
<Filter
153+
Name="Resource Files"
154+
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
155+
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
156+
>
157+
</Filter>
158+
<Filter
159+
Name="Source Files"
160+
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
161+
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
162+
>
163+
<File
164+
RelativePath=".\clienthandler.cpp"
165+
>
166+
</File>
167+
</Filter>
168+
</Files>
169+
<Globals>
170+
</Globals>
171+
</VisualStudioProject>

displayhandler.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ cdef public cbool DisplayHandler_OnTooltip(CefRefPtr[CefBrowser] cefBrowser,
181181
pyText = [CefStringToPyString(cefText)] # In/Out
182182
handler = pyBrowser.GetClientHandler("OnTooltip")
183183
if handler:
184-
ret = bool(handler(pyBrowser, pyText))
184+
ret = handler(pyBrowser, pyText)
185185
PyStringToCefString(pyText[0], cefText);
186-
return <cbool>ret
186+
return <cbool>bool(ret)
187187
else:
188188
return <cbool>False
189189
except:

requesthandler.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ cdef public cbool RequestHandler_GetAuthCredentials(
198198
return <cbool>bool(ret)
199199
else:
200200
# Default implementation.
201-
ret = bool(Requesthandler_GetAuthCredentials_Default(pyBrowser, pyIsProxy, pyHost, pyPort, pyRealm, pyScheme, pyUsername, pyPassword))
201+
ret = Requesthandler_GetAuthCredentials_Default(pyBrowser, pyIsProxy, pyHost, pyPort, pyRealm, pyScheme, pyUsername, pyPassword)
202202
if ret:
203203
PyStringToCefString(pyUsername[0], cefUsername)
204204
PyStringToCefString(pyPassword[0], cefPassword)

setup/setup.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from distutils.core import setup
22
from distutils.extension import Extension
33
from Cython.Distutils import build_ext
4+
import sys
45

56
ext_modules = [Extension(
67
"cefpython",
@@ -12,9 +13,16 @@
1213
'c:/Program Files/Microsoft SDKs/Windows/v7.1/Lib/',
1314
r'./../httpauth/Release/',
1415
r'./../v8functionhandler/Release/',
15-
r'./../clienthandler/Release/'
16+
r'./../clienthandler/Release_py%s%s/' % (sys.version_info.major, sys.version_info.minor)
17+
],
18+
libraries=[
19+
'libcef',
20+
'libcef_dll_wrapper',
21+
'User32',
22+
'httpauth',
23+
'v8functionhandler',
24+
'clienthandler_py%s%s' % (sys.version_info.major, sys.version_info.minor)
1625
],
17-
libraries=['libcef', 'libcef_dll_wrapper', 'User32', 'httpauth', 'v8functionhandler', 'clienthandler'],
1826
# To get rid of errors there are 2 options:
1927
# 1) compile '/clr' + link '/NODEFAULTLIB:libcmt', '/NODEFAULTLIB:msvcprt' (CLR will probably require .NET framework? YES)
2028
# 2) compile '/EHsc' + link '/NODEFAULTLIB:libcmt', '/NODEFAULTLIB:msvcprt'], '/ignore:4217'

0 commit comments

Comments
 (0)