Skip to content

Commit d6deaf8

Browse files
committed
Support Python 3.8 and Python 3.9 (Issues cztomczak#546 and cztomczak#593).
1 parent 55e6360 commit d6deaf8

14 files changed

Lines changed: 39 additions & 20 deletions

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,9 @@ support old operating systems then choose the v31 release.
210210

211211
OS | Py2 | Py3 | 32bit | 64bit | Requirements
212212
--- | --- | --- | --- | --- | ---
213-
Windows | 2.7 | 3.4 / 3.5 / 3.6 / 3.7 / 3.8 | Yes | Yes | Windows 7+
214-
Linux | 2.7 | 3.4 / 3.5 / 3.6 / 3.7 3.8 | Yes | Yes | Debian 8+, Ubuntu 14.04+,<br> Fedora 24+, openSUSE 13.3+
215-
Mac | 2.7 | 3.4 / 3.5 / 3.6 / 3.7 / 3.8 | No | Yes | MacOS 10.9+
213+
Windows | 2.7 | 3.4 / 3.5 / 3.6 / 3.7 / 3.8 / 3.9 | Yes | Yes | Windows 7+ (Note that Python 3.9 supports Windows 8.1+)
214+
Linux | 2.7 | 3.4 / 3.5 / 3.6 / 3.7 | Yes | Yes | Debian 8+, Ubuntu 14.04+,<br> Fedora 24+, openSUSE 13.3+
215+
Mac | 2.7 | 3.4 / 3.5 / 3.6 / 3.7 | No | Yes | MacOS 10.9+
216216

217217
These platforms are not supported yet:
218218
- ARM - see [Issue #267](../../issues/267)

docs/Build-instructions.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ are named "cefpythonXX" where XX is Chromium version number.
6666
from [here](https://www.microsoft.com/en-us/download/details.aspx?id=44266)
6767

6868
5) For Python 2.7 and when using using "Visual C++ compiler for Python 2.7"
69-
you have to install "Visual C++ 2008 Redistributable Package (x64)"
70-
from [here](https://www.microsoft.com/en-us/download/details.aspx?id=15336)
69+
you have to install "Visual C++ 2008 Redistributable Package"
70+
from [here](https://www.microsoft.com/en-us/download/details.aspx?id=29)
71+
and [here](https://www.microsoft.com/en-us/download/details.aspx?id=15336)
7172

7273
6) Clone cefpython, checkout for example "cefpython57" branch
7374
that includes Chromium v57, then create a build/ directory and enter it:
@@ -164,7 +165,8 @@ requirements common for all platforms.
164165
* For Python 2.7 install "Microsoft Visual C++ Compiler for Python 2.7"
165166
from [here](https://www.microsoft.com/en-us/download/details.aspx?id=44266)
166167
* When using "Visual C++ compiler for Python 2.7" you have to install
167-
"Microsoft Visual C++ 2008 Redistributable Package (x64)" from
168+
"Microsoft Visual C++ 2008 Redistributable Package" from
169+
[here](https://www.microsoft.com/en-us/download/details.aspx?id=29) and
168170
[here](https://www.microsoft.com/en-us/download/details.aspx?id=15336)
169171
* For Python 2.7 copy "cefpython/src/windows/py27/stdint.h" to
170172
"%LocalAppData%\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\include\"

examples/screenshot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
import sys
4343

4444
try:
45-
from PIL import Image, PILLOW_VERSION
45+
from PIL import Image, __version__ as PILLOW_VERSION
4646
except ImportError:
4747
print("[screenshot.py] Error: PIL module not available. To install"
4848
" type: pip install Pillow")

src/common/cefpython_public_api.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
#include "../../build/build_cefpython/cefpython_py37_fixed.h"
4949
#elif PY_MINOR_VERSION == 8
5050
#include "../../build/build_cefpython/cefpython_py38_fixed.h"
51+
#elif PY_MINOR_VERSION == 9
52+
#include "../../build/build_cefpython/cefpython_py39_fixed.h"
5153
#endif // PY_MINOR_VERSION
5254
#endif // PY_MAJOR_VERSION
5355

src/compile_time_constants.pxi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@
55

66
DEF UNAME_SYSNAME = "Windows"
77
DEF PY_MAJOR_VERSION = 3
8+
cdef extern from "limits.h":
9+
cdef int INT_MIN
10+
cdef int INT_MAX

src/subprocess/main_message_loop/util_win.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ int GetCefKeyboardModifiers(WPARAM wparam, LPARAM lparam) {
136136
return modifiers;
137137
}
138138

139-
bool IsKeyDown(WPARAM wparam) {
140-
return (GetKeyState(wparam) & 0x8000) != 0;
139+
bool IsKeyDown(int keycode) {
140+
return (GetKeyState(keycode) & 0x8000) != 0;
141141
}
142142

143143
float GetDeviceScaleFactor() {

src/subprocess/main_message_loop/util_win.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ WNDPROC SetWndProcPtr(HWND hWnd, WNDPROC wndProc);
3131

3232
int GetCefMouseModifiers(WPARAM wparam);
3333
int GetCefKeyboardModifiers(WPARAM wparam, LPARAM lparam);
34-
bool IsKeyDown(WPARAM wparam);
34+
bool IsKeyDown(int keycode);
3535

3636
// Returns the device scale factor. For example, 200% display scaling will
3737
// return 2.0.

tools/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ def build_cefpython_module():
809809
args = list()
810810
args.append("\"{python}\"".format(python=sys.executable))
811811
args.append(os.path.join(TOOLS_DIR, os.path.basename(__file__)))
812-
assert __file__ in sys.argv[0]
812+
assert os.path.basename(__file__) in sys.argv[0]
813813
args.extend(SYS_ARGV_ORIGINAL[1:])
814814
command = " ".join(args)
815815
print("[build.py] Running command: %s" % command)

tools/build_distrib.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,14 @@
8080
ALLOW_PARTIAL = False
8181

8282
# Python versions
83-
SUPPORTED_PYTHON_VERSIONS = [(2, 7), (3, 4), (3, 5), (3, 6), (3, 7), (3, 8)]
83+
SUPPORTED_PYTHON_VERSIONS = [(2, 7), (3, 4), (3, 5), (3, 6), (3, 7), (3, 8), (3, 9)]
8484

8585
# Python search paths. It will use first Python found for specific version.
8686
# Supports replacement of one environment variable in path eg.: %ENV_KEY%.
8787
PYTHON_SEARCH_PATHS = dict(
8888
WINDOWS=[
8989
"C:\\Python*\\",
90+
"C:\\Pythons\\Python*\\",
9091
"%LOCALAPPDATA%\\Programs\\Python\\Python*\\",
9192
"C:\\Program Files\\Python*\\",
9293
"C:\\Program Files (x86)\\Python*\\",
@@ -614,7 +615,7 @@ def check_cpp_extension_dependencies_issue359(setup_dir, all_pythons):
614615
return
615616
checked_any = False
616617
for python in all_pythons:
617-
if python["version2"] in ((3, 5), (3, 6), (3, 7)):
618+
if python["version2"] in ((3, 5), (3, 6), (3, 7), (3, 8), (3, 9)):
618619
checked_any = True
619620
if not os.path.exists(os.path.join(setup_dir, "cefpython3",
620621
"msvcp140.dll")):

tools/common.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,15 +219,19 @@
219219

220220
VS_PLATFORM_ARG = "x86" if ARCH32 else "amd64"
221221

222+
# Python 3.5 / 3.6 / 3.7 / 3.8 / 3.9
222223
VS2015_VCVARS = ("C:\\Program Files (x86)\\Microsoft Visual Studio 14.0"
223224
"\\VC\\vcvarsall.bat")
224225

226+
# Required for building old CEF branches < 2704
225227
VS2013_VCVARS = ("C:\\Program Files (x86)\\Microsoft Visual Studio 12.0"
226228
"\\VC\\vcvarsall.bat")
227229

230+
# Python 3.4
228231
VS2010_VCVARS = ("C:\\Program Files (x86)\\Microsoft Visual Studio 10.0"
229232
"\\VC\\vcvarsall.bat")
230233

234+
# Python 2.7
231235
VS2008_VCVARS = ("C:\\Program Files (x86)\\Microsoft Visual Studio 9.0"
232236
"\\VC\\vcvarsall.bat")
233237

@@ -475,6 +479,8 @@ def get_msvs_for_python(vs_prefix=False):
475479
return "VS2015" if vs_prefix else "2015"
476480
elif sys.version_info[:2] == (3, 8):
477481
return "VS2015" if vs_prefix else "2015"
482+
elif sys.version_info[:2] == (3, 9):
483+
return "VS2015" if vs_prefix else "2015"
478484
else:
479485
print("ERROR: This version of Python is not supported")
480486
sys.exit(1)

0 commit comments

Comments
 (0)