From 510d60302d1d49cad69a3ec1b991c85043d60e0d Mon Sep 17 00:00:00 2001 From: cztomczak Date: Fri, 3 Mar 2017 22:07:00 +0100 Subject: [PATCH] Python 3 support on Mac (#121, #295) --- docs/Knowledge-Base.md | 13 +++++-------- examples/qt4.py | 1 + tools/build.py | 4 ++-- tools/make_installer.py | 6 +++--- tools/run_examples.py | 2 +- 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/docs/Knowledge-Base.md b/docs/Knowledge-Base.md index 73aa95b6..31d26909 100644 --- a/docs/Knowledge-Base.md +++ b/docs/Knowledge-Base.md @@ -112,15 +112,12 @@ as of now. To see if some feature is working or a bug is fixed in newer CEF release perform the following steps: -1. Download and install [CMake](https://cmake.org/download/) and - [Ninja](https://github.com/ninja-build/ninja/releases) -2. Go to [Spotify Automated Builds] +1. Go to [Spotify Automated Builds] (http://opensource.spotify.com/cefbuilds/index.html) - and download latest CEF for your platform. Choose "Standard - Distribution" binaries. -3. Follow the instructions in `CMakeLists.txt` file, choose steps - for building using Ninja -4. Run either cefclient or cefsimple to test features + to download latest CEF for your platform. Choose "Sample + Application" binaries. +2. Extract the archive and run sample application from the + Release/ directory. ## How to capture Audio and Video in HTML5? diff --git a/examples/qt4.py b/examples/qt4.py index b5925ca3..dad875ca 100644 --- a/examples/qt4.py +++ b/examples/qt4.py @@ -9,6 +9,7 @@ # Issues on Mac (tested with PySide): # - Keyboard focus issues when switching between controls (Issue #284) # - Mouse cursor never changes when hovering over links (Issue #311) +# - Sometimes process hangs when quitting app from cefpython3 import cefpython as cef import ctypes diff --git a/tools/build.py b/tools/build.py index a7297c9a..54b9c56e 100644 --- a/tools/build.py +++ b/tools/build.py @@ -459,13 +459,13 @@ def clear_cache(): # Cache in CEFPYTHON_BINARY directory (eg. cefpython_linux64/) os.chdir(CEFPYTHON_BINARY) delete_files_by_pattern("./"+MODULE_NAME_TEMPLATE - .format(pyversion="*", ext=MODULE_EXT)) + .format(pyversion=PYVERSION, ext=MODULE_EXT)) # Cache in build_cefpython/ directory os.chdir(BUILD_CEFPYTHON) delete_files_by_pattern("./"+MODULE_NAME_TEMPLATE - .format(pyversion="*", ext=MODULE_EXT)) + .format(pyversion=PYVERSION, ext=MODULE_EXT)) delete_files_by_pattern("./*.pyx") try: diff --git a/tools/make_installer.py b/tools/make_installer.py index 5d4f7501..901dfd7c 100644 --- a/tools/make_installer.py +++ b/tools/make_installer.py @@ -126,10 +126,10 @@ def copy_template_file(src, dst, variables): print("[make_installer.py] Copy_t: {src} ==> {dst}" .format(src=short_src_path(src), dst=short_dst_path(dst))) with open(src, "rb") as fo: - contents = fo.read() + contents = fo.read().decode("utf-8") contents = replace_template_vars(contents, variables) with open(dst, "wb") as fo: - fo.write(contents) + fo.write(contents.encode("utf-8")) return contents @@ -280,7 +280,7 @@ def create_empty_log_file(log_file): print("[make_installer.py] Create: {file}" .format(file=short_dst_path(log_file))) with open(log_file, "wb") as fo: - fo.write("") + fo.write("".encode("utf-8")) # On Linux and Mac chmod so that for cases when package is # installed using sudo. When wheel package is created it # will remember file permissions set. diff --git a/tools/run_examples.py b/tools/run_examples.py index 7d191e27..db77572d 100644 --- a/tools/run_examples.py +++ b/tools/run_examples.py @@ -71,7 +71,7 @@ def main(): # tkinter if MAC: # This example often crashes on Mac (Issue #309) - print(["run_examples.py] PASS: tkinter_.py (Issue #309)"]) + print("[run_examples.py] PASS: tkinter_.py (Issue #309)") passed.append("tkinter_.py (Issue #309)") elif packages["tkinter"] or packages["Tkinter"]: examples.append("tkinter_.py")