Skip to content

Commit d823562

Browse files
author
Roman
authored
Add 32/64 support for WebBrowserInterop (r0x0r#218)
1 parent 2d3894f commit d823562

File tree

6 files changed

+13
-10
lines changed

6 files changed

+13
-10
lines changed

appveyor.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
environment:
22
matrix:
33

4-
#- PYTHON: "C:\\Python27"
5-
# PYTHON_VERSION: "2.7.x"
6-
# PYTHON_ARCH: "32"
4+
- PYTHON: "C:\\Python27"
5+
PYTHON_VERSION: "2.7.x"
6+
PYTHON_ARCH: "32"
77

88
- PYTHON: "C:\\Python27-x64"
99
PYTHON_VERSION: "2.7.x"
1010
PYTHON_ARCH: "64"
1111

12-
#- PYTHON: "C:\\Python36"
13-
# PYTHON_VERSION: "3.6.x"
14-
# PYTHON_ARCH: "32"
12+
- PYTHON: "C:\\Python36"
13+
PYTHON_VERSION: "3.6.x"
14+
PYTHON_ARCH: "32"
1515

1616
- PYTHON: "C:\\Python36-x64"
1717
PYTHON_VERSION: "3.6.x"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
data_files = []
66

77
if platform.system() == "Windows":
8-
data_files.append(('webview/lib', ['webview/lib/WebBrowserInterop.dll']))
8+
data_files.append(('webview/lib', ['webview/lib/WebBrowserInterop.x64.dll', 'webview/lib/WebBrowserInterop.x86.dll']))
99
extras_require = {
1010
'win32': ['pywin32', 'comtypes'],
1111
'winforms': ['pythonnet'],
File renamed without changes.

webview/lib/WebBrowserInterop.x64.dll

6.5 KB
Binary file not shown.

webview/util.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import os
1111
import re
1212
import sys
13+
import platform
1314

1415
from .js import api, npo
1516

@@ -120,19 +121,21 @@ def inject_base_uri(content, base_uri):
120121

121122

122123
def interop_dll_path():
124+
dll_name = 'WebBrowserInterop.x64.dll' if platform.architecture()[0] == '64bit' else 'WebBrowserInterop.x86.dll'
125+
123126
# Unfrozen path
124-
dll_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'lib', 'WebBrowserInterop.dll')
127+
dll_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'lib', dll_name)
125128
if os.path.exists(dll_path):
126129
return dll_path
127130

128131
# Frozen path, dll in the same dir as the executable
129-
dll_path = os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), 'WebBrowserInterop.dll')
132+
dll_path = os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), dll_name)
130133
if os.path.exists(dll_path):
131134
return dll_path
132135

133136
try:
134137
# Frozen path packed as onefile
135-
dll_path = os.path.join(sys._MEIPASS, 'WebBrowserInterop.dll')
138+
dll_path = os.path.join(sys._MEIPASS, dll_name)
136139
if os.path.exists(dll_path):
137140
return dll_path
138141
except Exception:

0 commit comments

Comments
 (0)