Hello community, here is the log from the commit of package python-glfw for openSUSE:Factory checked in at 2020-03-05 23:24:19 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-glfw (Old) and /work/SRC/openSUSE:Factory/.python-glfw.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-glfw" Thu Mar 5 23:24:19 2020 rev:7 rq:781851 version:1.11.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-glfw/python-glfw.changes 2019-09-27 14:47:01.720986273 +0200 +++ /work/SRC/openSUSE:Factory/.python-glfw.new.26092/python-glfw.changes 2020-03-05 23:24:29.869384021 +0100 @@ -1,0 +2,31 @@ +Thu Mar 5 12:46:21 UTC 2020 - [email protected] + +- version update to 1.11.0 + ## [1.11.0] - 2020-02-21 + - Updated to GLFW 3.3.2 + - Include support for both X11 and Wayland libraries in the wheel + + ## [1.10.1] - 2020-01-21 + - Fixed default error callback name + + ## [1.10.0] - 2020-01-19 + - Added more options to error reporting + + ## [1.9.1] - 2020-01-08 + - Added conda search path for Windows + + ## [1.9.0] - 2019-12-30 + - Added wrappers for native functions + + ## [1.8.7] - 2019-12-10 + - Fixed glfwGetMonitorContentScale + + ## [1.8.6] - 2019-12-09 + - Added macOS wheels + - Added Microsoft Visual C++ runtime libraries to Windows wheels + + ## [1.8.5] - 2019-11-28 + - Added /usr/lib/aarch64-linux-gnu/ to library search paths + - Fix pointer types in get_window_content_scale + +------------------------------------------------------------------- Old: ---- glfw-1.8.3.tar.gz New: ---- glfw-1.11.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-glfw.spec ++++++ --- /var/tmp/diff_new_pack.pZdfoD/_old 2020-03-05 23:24:30.645384448 +0100 +++ /var/tmp/diff_new_pack.pZdfoD/_new 2020-03-05 23:24:30.645384448 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-glfw # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-glfw -Version: 1.8.3 +Version: 1.11.0 Release: 0 Summary: A ctypes-based wrapper for GLFW3 License: MIT ++++++ glfw-1.8.3.tar.gz -> glfw-1.11.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glfw-1.8.3/CHANGELOG.md new/glfw-1.11.0/CHANGELOG.md --- old/glfw-1.8.3/CHANGELOG.md 2019-08-22 19:23:26.000000000 +0200 +++ new/glfw-1.11.0/CHANGELOG.md 2020-02-21 16:18:20.000000000 +0100 @@ -4,6 +4,35 @@ For information on changes in GLFW itself, see the [GLFW version history](https://www.glfw.org/changelog.html). +## [1.11.0] - 2020-02-21 +- Updated to GLFW 3.3.2 +- Include support for both X11 and Wayland libraries in the wheel + +## [1.10.1] - 2020-01-21 +- Fixed default error callback name + +## [1.10.0] - 2020-01-19 +- Added more options to error reporting + +## [1.9.1] - 2020-01-08 +- Added conda search path for Windows + +## [1.9.0] - 2019-12-30 +- Added wrappers for native functions + +## [1.8.7] - 2019-12-10 +- Fixed glfwGetMonitorContentScale + +## [1.8.6] - 2019-12-09 +- Added macOS wheels +- Added Microsoft Visual C++ runtime libraries to Windows wheels + +## [1.8.5] - 2019-11-28 +- Added /usr/lib/aarch64-linux-gnu/ to library search paths + +## [1.8.4] - 2019-11-04 +- Fix pointer types in get_window_content_scale + ## [1.8.3] - 2019-08-22 - Updated the GLFW version in the wheels to 3.3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glfw-1.8.3/PKG-INFO new/glfw-1.11.0/PKG-INFO --- old/glfw-1.8.3/PKG-INFO 2019-08-22 19:23:57.000000000 +0200 +++ new/glfw-1.11.0/PKG-INFO 2020-02-21 16:18:54.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: glfw -Version: 1.8.3 +Version: 1.11.0 Summary: A ctypes-based wrapper for GLFW3. Home-page: https://github.com/FlorianRhiem/pyGLFW Author: Florian Rhiem @@ -26,7 +26,9 @@ - Gamma ramps use floats between 0.0 and 1.0 instead of unsigned shorts (use ``glfw.NORMALIZE_GAMMA_RAMPS=False`` to disable this) - GLFW errors are reported as ``glfw.GLFWError`` exceptions if no error - callback is set (use ``glfw.ERROR_REPORTING=False`` to disable this) + callback is set (use ``glfw.ERROR_REPORTING=False`` to disable this, + set it to 'warn' instead to issue warnings or set it to 'log' to log it + using the 'glfw' logger) - instead of a sequence for ``GLFWimage`` structs, PIL/pillow ``Image`` objects can be used @@ -42,24 +44,38 @@ Windows ~~~~~~~ - The GLFW shared library is included in the Python wheels for Windows, but the correct Microsoft Visual C++ Redistributable will be required: + The GLFW shared library and Visual C++ runtime are included in the Python wheels. - - `VC 2010 <https://www.microsoft.com/en-us/download/details.aspx?id=5555>`_ for 32-bit Python, or - - `VC 2012 <https://www.microsoft.com/en-us/download/details.aspx?id=30679>`_ for 64-bit Python. + To use a different GLFW library, you can set ``PYGLFW_LIBRARY`` to its location. - Alternatively, you can download a shared library built for a runtime already installed on your system from `glfw.org <http://www.glfw.org/download.html>`_. + macOS + ~~~~~ - Linux and macOS - ~~~~~~~~~~~~~~~ + The GLFW shared library for 64-bit is included in the Python wheels for macOS. - You will need to install the GLFW shared library yourself and should - `compile GLFW from source <http://www.glfw.org/docs/latest/compile.html>`__ + If you are using a 32-bit Python installation or otherwise cannot use the + library downloaded with the wheel, you can build and install it yourself by + `compiling GLFW from source <http://www.glfw.org/docs/latest/compile.html>`__ (use ``-DBUILD_SHARED_LIBS=ON``). pyGLFW will search for the library in a list of search paths (including those - in ``LD_LIBRARY_PATH`` on Linux and ``DYLD_LIBRARY_PATH`` on macOS). If you - want to use a specific library, you can set the ``PYGLFW_LIBRARY`` environment - variable to its path. + in ``DYLD_LIBRARY_PATH``). If you want to use a specific library, you can set + the ``PYGLFW_LIBRARY`` environment variable to its path. + + Linux + ~~~~~ + + The GLFW shared library is included in the Python wheels for Linux. + + If you cannot use these on your system, you can install the GLFW shared + library using a package management system (e.g. ``apt install libglfw3`` + on Debian or Ubuntu) or you can build and install it yourself by + `compiling GLFW from source <http://www.glfw.org/docs/latest/compile.html>`__ + (use ``-DBUILD_SHARED_LIBS=ON``). + + pyGLFW will search for the library in a list of search paths (including those + in ``LD_LIBRARY_PATH``). If you want to use a specific library, you can set + the ``PYGLFW_LIBRARY`` environment variable to its path. Example Code ------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glfw-1.8.3/README.rst new/glfw-1.11.0/README.rst --- old/glfw-1.8.3/README.rst 2019-08-22 19:23:26.000000000 +0200 +++ new/glfw-1.11.0/README.rst 2020-02-21 16:18:20.000000000 +0100 @@ -18,7 +18,9 @@ - Gamma ramps use floats between 0.0 and 1.0 instead of unsigned shorts (use ``glfw.NORMALIZE_GAMMA_RAMPS=False`` to disable this) - GLFW errors are reported as ``glfw.GLFWError`` exceptions if no error - callback is set (use ``glfw.ERROR_REPORTING=False`` to disable this) + callback is set (use ``glfw.ERROR_REPORTING=False`` to disable this, + set it to 'warn' instead to issue warnings or set it to 'log' to log it + using the 'glfw' logger) - instead of a sequence for ``GLFWimage`` structs, PIL/pillow ``Image`` objects can be used @@ -34,24 +36,38 @@ Windows ~~~~~~~ -The GLFW shared library is included in the Python wheels for Windows, but the correct Microsoft Visual C++ Redistributable will be required: +The GLFW shared library and Visual C++ runtime are included in the Python wheels. -- `VC 2010 <https://www.microsoft.com/en-us/download/details.aspx?id=5555>`_ for 32-bit Python, or -- `VC 2012 <https://www.microsoft.com/en-us/download/details.aspx?id=30679>`_ for 64-bit Python. +To use a different GLFW library, you can set ``PYGLFW_LIBRARY`` to its location. -Alternatively, you can download a shared library built for a runtime already installed on your system from `glfw.org <http://www.glfw.org/download.html>`_. +macOS +~~~~~ -Linux and macOS -~~~~~~~~~~~~~~~ +The GLFW shared library for 64-bit is included in the Python wheels for macOS. -You will need to install the GLFW shared library yourself and should -`compile GLFW from source <http://www.glfw.org/docs/latest/compile.html>`__ +If you are using a 32-bit Python installation or otherwise cannot use the +library downloaded with the wheel, you can build and install it yourself by +`compiling GLFW from source <http://www.glfw.org/docs/latest/compile.html>`__ (use ``-DBUILD_SHARED_LIBS=ON``). pyGLFW will search for the library in a list of search paths (including those -in ``LD_LIBRARY_PATH`` on Linux and ``DYLD_LIBRARY_PATH`` on macOS). If you -want to use a specific library, you can set the ``PYGLFW_LIBRARY`` environment -variable to its path. +in ``DYLD_LIBRARY_PATH``). If you want to use a specific library, you can set +the ``PYGLFW_LIBRARY`` environment variable to its path. + +Linux +~~~~~ + +The GLFW shared library is included in the Python wheels for Linux. + +If you cannot use these on your system, you can install the GLFW shared +library using a package management system (e.g. ``apt install libglfw3`` +on Debian or Ubuntu) or you can build and install it yourself by +`compiling GLFW from source <http://www.glfw.org/docs/latest/compile.html>`__ +(use ``-DBUILD_SHARED_LIBS=ON``). + +pyGLFW will search for the library in a list of search paths (including those +in ``LD_LIBRARY_PATH``). If you want to use a specific library, you can set +the ``PYGLFW_LIBRARY`` environment variable to its path. Example Code ------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glfw-1.8.3/glfw/__init__.py new/glfw-1.11.0/glfw/__init__.py --- old/glfw-1.8.3/glfw/__init__.py 2019-08-22 19:23:26.000000000 +0200 +++ new/glfw-1.11.0/glfw/__init__.py 2020-02-21 16:18:20.000000000 +0100 @@ -9,11 +9,16 @@ __author__ = 'Florian Rhiem ([email protected])' __copyright__ = 'Copyright (c) 2013-2019 Florian Rhiem' __license__ = 'MIT' -__version__ = '1.8.3' +__version__ = '1.11.0' -# By default (ERROR_REPORTING = True), GLFW errors will be reported as Python -# exceptions. Set ERROR_REPORTING to False or set a curstom error callback to -# disable this behavior. +# By default, GLFW errors will be handled by a pre-defined error callback. +# Depending on the value of ERROR_REPORTING, this callback will: +# - Raise a GLFWError exception, if ERROR_REPORTING is 'raise', 'exception' +# or True. +# - Issue a GLFWError warning, if ERROR_REPORTING is 'warn' or 'warning'. +# - Log on debug level using the 'glfw' logger, if ERROR_REPORTING is 'log'. +# - Ignore the GLFWError, if ERROR_REPORTING is 'ignore' or False. +# Alternatively, you can set a custom error callback using set_error_callback. ERROR_REPORTING = True # By default (NORMALIZE_GAMMA_RAMPS = True), gamma ramps are expected to @@ -24,9 +29,11 @@ import collections import ctypes +import logging import os import functools import sys +import warnings from .library import glfw as _glfw @@ -50,7 +57,7 @@ exec("raise exception, None, traceback") -class GLFWError(Exception): +class GLFWError(UserWarning): """ Exception class used for reporting GLFW errors. """ @@ -788,19 +795,28 @@ @_callback_exception_decorator -def _raise_glfw_errors_as_exceptions(error_code, description): +def _handle_glfw_errors(error_code, description): """ - Default error callback that raises GLFWError exceptions for glfw errors. - Set an alternative error callback or set glfw.ERROR_REPORTING to False to - disable this behavior. + Default error callback that raises GLFWError exceptions, issues GLFWError + warnings or logs to the 'glfw' logger. + Set an alternative error callback or set glfw.ERROR_REPORTING to False or + 'ignore' to disable this behavior. """ global ERROR_REPORTING - if ERROR_REPORTING: - message = "(%d) %s" % (error_code, description) + message = "(%d) %s" % (error_code, description) + if ERROR_REPORTING in ('raise', 'exception', True): raise GLFWError(message) + elif ERROR_REPORTING in ('warn', 'warning'): + warnings.warn(message, GLFWError) + elif ERROR_REPORTING in ('log',): + logging.getLogger('glfw').debug(message) + elif ERROR_REPORTING in ('ignore', False): + pass + else: + raise ValueError('Invalid value of ERROR_REPORTING while handling GLFW error:\n' + message) -_default_error_callback = _GLFWerrorfun(_raise_glfw_errors_as_exceptions) -_error_callback = (_raise_glfw_errors_as_exceptions, _default_error_callback) +_default_error_callback = _GLFWerrorfun(_handle_glfw_errors) +_error_callback = (_handle_glfw_errors, _default_error_callback) _glfw.glfwSetErrorCallback.restype = _GLFWerrorfun _glfw.glfwSetErrorCallback.argtypes = [_GLFWerrorfun] _glfw.glfwSetErrorCallback(_default_error_callback) @@ -814,14 +830,14 @@ global _error_callback previous_callback = _error_callback if cbfun is None: - cbfun = _raise_glfw_errors_as_exceptions + cbfun = _handle_glfw_errors c_cbfun = _default_error_callback else: c_cbfun = _GLFWerrorfun(cbfun) _error_callback = (cbfun, c_cbfun) cbfun = c_cbfun _glfw.glfwSetErrorCallback(cbfun) - if previous_callback is not None and previous_callback[0] != _raise_glfw_errors_as_exceptions: + if previous_callback is not None and previous_callback[0] != _handle_glfw_errors: return previous_callback[0] _glfw.glfwGetMonitors.restype = ctypes.POINTER(ctypes.POINTER(_GLFWmonitor)) @@ -930,9 +946,9 @@ Wrapper for: void glfwGetMonitorContentScale(GLFWmonitor* monitor, float* xscale, float* yscale); """ - xscale_value = ctypes.c_int(0) + xscale_value = ctypes.c_float(0) xscale = ctypes.pointer(xscale_value) - yscale_value = ctypes.c_int(0) + yscale_value = ctypes.c_float(0) yscale = ctypes.pointer(yscale_value) _glfw.glfwGetMonitorContentScale(monitor, xscale, yscale) return xscale_value.value, yscale_value.value @@ -1286,9 +1302,9 @@ Wrapper for: void glfwGetWindowContentScale(GLFWwindow* window, float* xscale, float* yscale); """ - xscale_value = ctypes.c_int(0) + xscale_value = ctypes.c_float(0) xscale = ctypes.pointer(xscale_value) - yscale_value = ctypes.c_int(0) + yscale_value = ctypes.c_float(0) yscale = ctypes.pointer(yscale_value) _glfw.glfwGetWindowContentScale(window, xscale, yscale) return xscale_value.value, yscale_value.value @@ -2719,4 +2735,348 @@ """ _glfw.glfwPostEmptyEvent() + +if hasattr(_glfw, 'glfwGetWin32Adapter'): + _glfw.glfwGetWin32Adapter.restype = ctypes.c_char_p + _glfw.glfwGetWin32Adapter.argtypes = [ctypes.POINTER(_GLFWmonitor)] + def get_win32_adapter(monitor): + """ + Returns the adapter device name of the specified monitor. + + Wrapper for: + const char* glfwGetWin32Adapter(GLFWmonitor* monitor); + """ + adapter_name = _glfw.glfwGetWin32Adapter(monitor) + if adapter_name: + return adapter_name.decode('utf-8') + return None + + +if hasattr(_glfw, 'glfwGetWin32Monitor'): + _glfw.glfwGetWin32Monitor.restype = ctypes.c_char_p + _glfw.glfwGetWin32Monitor.argtypes = [ctypes.POINTER(_GLFWmonitor)] + def get_win32_monitor(monitor): + """ + Returns the display device name of the specified monitor. + + Wrapper for: + const char* glfwGetWin32Monitor(GLFWmonitor* monitor); + """ + monitor_name = _glfw.glfwGetWin32Monitor(monitor) + if monitor_name: + return monitor_name.decode('utf-8') + return None + + +if hasattr(_glfw, 'glfwGetWin32Window'): + _glfw.glfwGetWin32Window.restype = ctypes.c_void_p + _glfw.glfwGetWin32Window.argtypes = [ctypes.POINTER(_GLFWwindow)] + def get_win32_window(window): + """ + Returns the HWND of the specified window. + + Wrapper for: + HWND glfwGetWin32Window(GLFWwindow* window); + """ + return _glfw.glfwGetWin32Window(window) + + +if hasattr(_glfw, 'glfwGetWGLContext'): + _glfw.glfwGetWGLContext.restype = ctypes.c_void_p + _glfw.glfwGetWGLContext.argtypes = [ctypes.POINTER(_GLFWwindow)] + def get_wgl_context(window): + """ + Returns the HGLRC of the specified window. + + Wrapper for: + HGLRC glfwGetWGLContext(GLFWwindow* window); + """ + return _glfw.glfwGetWGLContext(window) + + +if hasattr(_glfw, 'glfwGetCocoaMonitor'): + _glfw.glfwGetCocoaMonitor.restype = ctypes.c_uint32 + _glfw.glfwGetCocoaMonitor.argtypes = [ctypes.POINTER(_GLFWmonitor)] + def get_cocoa_monitor(monitor): + """ + Returns the CGDirectDisplayID of the specified monitor. + + Wrapper for: + CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor); + """ + return _glfw.glfwGetCocoaMonitor(monitor) + + +if hasattr(_glfw, 'glfwGetCocoaWindow'): + _glfw.glfwGetCocoaWindow.restype = ctypes.c_void_p + _glfw.glfwGetCocoaWindow.argtypes = [ctypes.POINTER(_GLFWwindow)] + def get_cocoa_window(window): + """ + Returns the NSWindow of the specified window. + + Wrapper for: + id glfwGetCocoaWindow(GLFWwindow* window); + """ + return _glfw.glfwGetCocoaWindow(window) + + +if hasattr(_glfw, 'glfwGetNSGLContext'): + _glfw.glfwGetNSGLContext.restype = ctypes.c_void_p + _glfw.glfwGetNSGLContext.argtypes = [ctypes.POINTER(_GLFWwindow)] + def get_nsgl_context(window): + """ + Returns the NSOpenGLContext of the specified window. + + Wrapper for: + id glfwGetNSGLContext(GLFWwindow* window); + """ + return _glfw.glfwGetNSGLContext(window) + + +if hasattr(_glfw, 'glfwGetX11Display'): + _glfw.glfwGetX11Display.restype = ctypes.c_void_p + _glfw.glfwGetX11Display.argtypes = [] + def get_x11_display(): + """ + Returns the Display used by GLFW. + + Wrapper for: + Display* glfwGetX11Display(void); + """ + return _glfw.glfwGetX11Display() + + +if hasattr(_glfw, 'glfwGetX11Adapter'): + _glfw.glfwGetX11Adapter.restype = ctypes.c_uint32 + _glfw.glfwGetX11Adapter.argtypes = [ctypes.POINTER(_GLFWmonitor)] + def get_x11_adapter(monitor): + """ + Returns the RRCrtc of the specified monitor. + + Wrapper for: + RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor); + """ + return _glfw.glfwGetX11Adapter(monitor) + + +if hasattr(_glfw, 'glfwGetX11Monitor'): + _glfw.glfwGetX11Monitor.restype = ctypes.c_uint32 + _glfw.glfwGetX11Monitor.argtypes = [ctypes.POINTER(_GLFWmonitor)] + def get_x11_monitor(monitor): + """ + Returns the RROutput of the specified monitor. + + Wrapper for: + RROutput glfwGetX11Monitor(GLFWmonitor* monitor); + """ + return _glfw.glfwGetX11Monitor(monitor) + + +if hasattr(_glfw, 'glfwGetX11Window'): + _glfw.glfwGetX11Window.restype = ctypes.c_uint32 + _glfw.glfwGetX11Window.argtypes = [ctypes.POINTER(_GLFWwindow)] + def get_x11_window(window): + """ + Returns the Window of the specified window. + + Wrapper for: + Window glfwGetX11Window(GLFWwindow* window); + """ + return _glfw.glfwGetX11Window(window) + + +if hasattr(_glfw, 'glfwSetX11SelectionString'): + _glfw.glfwSetX11SelectionString.restype = None + _glfw.glfwSetX11SelectionString.argtypes = [ctypes.c_char_p] + def set_x11_selection_string(string): + """ + Sets the current primary selection to the specified string. + + Wrapper for: + void glfwSetX11SelectionString(const char* string); + """ + binary_string = string.encode('utf-8') + _glfw.glfwSetX11SelectionString(binary_string) + + +if hasattr(_glfw, 'glfwGetX11SelectionString'): + _glfw.glfwGetX11SelectionString.restype = ctypes.c_char_p + _glfw.glfwGetX11SelectionString.argtypes = [] + def get_x11_selection_string(): + """ + Returns the contents of the current primary selection as a string. + + Wrapper for: + const char* glfwGetX11SelectionString(void); + """ + selection_string = _glfw.glfwGetX11SelectionString() + if selection_string: + return selection_string.decode('utf-8') + return None + + +if hasattr(_glfw, 'glfwGetGLXContext'): + _glfw.glfwGetGLXContext.restype = ctypes.c_void_p + _glfw.glfwGetGLXContext.argtypes = [ctypes.POINTER(_GLFWwindow)] + def get_glx_context(window): + """ + Returns the GLXContext of the specified window. + + Wrapper for: + GLXContext glfwGetGLXContext(GLFWwindow* window); + """ + return _glfw.glfwGetGLXContext(window) + + +if hasattr(_glfw, 'glfwGetGLXWindow'): + _glfw.glfwGetGLXWindow.restype = ctypes.c_uint32 + _glfw.glfwGetGLXWindow.argtypes = [ctypes.POINTER(_GLFWwindow)] + def get_glx_window(window): + """ + Returns the GLXWindow of the specified window. + + Wrapper for: + GLXWindow glfwGetGLXWindow(GLFWwindow* window); + """ + return _glfw.glfwGetGLXWindow(window) + + +if hasattr(_glfw, 'glfwGetWaylandDisplay'): + _glfw.glfwGetWaylandDisplay.restype = ctypes.c_void_p + _glfw.glfwGetWaylandDisplay.argtypes = [] + def get_wayland_display(): + """ + Returns the struct wl_display* used by GLFW. + + Wrapper for: + struct wl_display* glfwGetWaylandDisplay(void); + """ + return _glfw.glfwGetWaylandDisplay() + + +if hasattr(_glfw, 'glfwGetWaylandMonitor'): + _glfw.glfwGetWaylandMonitor.restype = ctypes.c_void_p + _glfw.glfwGetWaylandMonitor.argtypes = [ctypes.POINTER(_GLFWmonitor)] + def get_wayland_monitor(monitor): + """ + Returns the struct wl_output* of the specified monitor. + + Wrapper for: + struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor); + """ + return _glfw.glfwGetWaylandMonitor(monitor) + + +if hasattr(_glfw, 'glfwGetWaylandWindow'): + _glfw.glfwGetWaylandWindow.restype = ctypes.c_void_p + _glfw.glfwGetWaylandWindow.argtypes = [ctypes.POINTER(_GLFWwindow)] + def get_wayland_window(window): + """ + Returns the main struct wl_surface* of the specified window. + + Wrapper for: + struct wl_surface* glfwGetWaylandWindow(GLFWwindow* window); + """ + return _glfw.glfwGetWaylandWindow(window) + + +if hasattr(_glfw, 'glfwGetEGLDisplay'): + _glfw.glfwGetEGLDisplay.restype = ctypes.c_void_p + _glfw.glfwGetEGLDisplay.argtypes = [] + def get_egl_display(): + """ + Returns the EGLDisplay used by GLFW. + + Wrapper for: + EGLDisplay glfwGetEGLDisplay(void); + """ + return _glfw.glfwGetEGLDisplay() + + +if hasattr(_glfw, 'glfwGetEGLContext'): + _glfw.glfwGetEGLContext.restype = ctypes.c_void_p + _glfw.glfwGetEGLContext.argtypes = [ctypes.POINTER(_GLFWwindow)] + def get_egl_context(window): + """ + Returns the EGLContext of the specified window. + + Wrapper for: + EGLContext glfwGetEGLContext(GLFWwindow* window); + """ + return _glfw.glfwGetEGLContext(window) + + +if hasattr(_glfw, 'glfwGetEGLSurface'): + _glfw.glfwGetEGLSurface.restype = ctypes.c_void_p + _glfw.glfwGetEGLSurface.argtypes = [ctypes.POINTER(_GLFWwindow)] + def get_egl_surface(window): + """ + Returns the EGLSurface of the specified window. + + Wrapper for: + EGLSurface glfwGetEGLSurface(GLFWwindow* window); + """ + return _glfw.glfwGetEGLSurface(window) + + +if hasattr(_glfw, 'glfwGetOSMesaColorBuffer'): + _glfw.glfwGetOSMesaColorBuffer.restype = ctypes.c_int + _glfw.glfwGetOSMesaColorBuffer.argtypes = [ctypes.POINTER(_GLFWwindow), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_void_p)] + def get_os_mesa_color_buffer(window): + """ + Retrieves the color buffer associated with the specified window. + + Wrapper for: + int glfwGetOSMesaColorBuffer(GLFWwindow* window, int* width, int* height, int* format, void** buffer); + """ + width_value = ctypes.c_int(0) + width = ctypes.pointer(width_value) + height_value = ctypes.c_int(0) + height = ctypes.pointer(height_value) + format_value = ctypes.c_int(0) + format = ctypes.pointer(format_value) + buffer_value = ctypes.c_void_p(0) + buffer = ctypes.pointer(buffer_value) + success = _glfw.glfwGetOSMesaColorBuffer(window, width, height, format, buffer) + if not success: + return None + return width.value, height.value, format.value, buffer.value + + +if hasattr(_glfw, 'glfwGetOSMesaDepthBuffer'): + _glfw.glfwGetOSMesaDepthBuffer.restype = ctypes.c_int + _glfw.glfwGetOSMesaDepthBuffer.argtypes = [ctypes.POINTER(_GLFWwindow), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_void_p)] + def get_os_mesa_depth_buffer(window): + """ + Retrieves the depth buffer associated with the specified window. + + Wrapper for: + int glfwGetOSMesaDepthBuffer(GLFWwindow* window, int* width, int* height, int* bytesPerValue, void** buffer); + """ + width_value = ctypes.c_int(0) + width = ctypes.pointer(width_value) + height_value = ctypes.c_int(0) + height = ctypes.pointer(height_value) + bytes_per_value_value = ctypes.c_int(0) + bytes_per_value = ctypes.pointer(bytes_per_value_value) + buffer_value = ctypes.c_void_p(0) + buffer = ctypes.pointer(buffer_value) + success = _glfw.glfwGetOSMesaDepthBuffer(window, width, height, bytes_per_value, buffer) + if not success: + return None + return width.value, height.value, bytes_per_value.value, buffer.value + + +if hasattr(_glfw, 'glfwGetOSMesaContext'): + _glfw.glfwGetOSMesaContext.restype = ctypes.c_void_p + _glfw.glfwGetOSMesaContext.argtypes = [ctypes.POINTER(_GLFWwindow)] + def get_os_mesa_context(window): + """ + Returns the OSMesaContext of the specified window. + + Wrapper for: + OSMesaContext glfwGetOSMesaContext(GLFWwindow* window); + """ + return _glfw.glfwGetOSMesaContext(window) + _prepare_errcheck() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glfw-1.8.3/glfw/library.py new/glfw-1.11.0/glfw/library.py --- old/glfw-1.8.3/glfw/library.py 2019-08-22 19:23:26.000000000 +0200 +++ new/glfw-1.11.0/glfw/library.py 2020-02-21 16:18:20.000000000 +0100 @@ -125,17 +125,27 @@ Returns a list of library search paths, considering of the current working directory, default paths and paths from environment variables. """ + package_path = os.path.abspath(os.path.dirname(__file__)) search_paths = [ '', - os.path.abspath(os.path.dirname(__file__)), + package_path, sys.prefix + '/lib', '/usr/lib64', '/usr/local/lib64', '/usr/lib', '/usr/local/lib', '/run/current-system/sw/lib', - '/usr/lib/x86_64-linux-gnu/' + '/usr/lib/x86_64-linux-gnu/', + '/usr/lib/aarch64-linux-gnu/', ] + if sys.platform != 'darwin': + # manylinux2014 wheels contain libraries built for X11 and Wayland + if os.environ.get('XDG_SESSION_TYPE') == 'wayland': + search_paths.insert(1, os.path.join(package_path, 'wayland')) + else: + # X11 is the default, even if XDG_SESSION_TYPE is not set + search_paths.insert(1, os.path.join(package_path, 'x11')) + if sys.platform == 'darwin': path_environment_variable = 'DYLD_LIBRARY_PATH' else: @@ -151,15 +161,33 @@ except OSError: glfw = None elif sys.platform == 'win32': - # try glfw3.dll using windows search paths + glfw = None # Will become `not None` on success. + + # try Windows default search path try: glfw = ctypes.CDLL('glfw3.dll') except OSError: - # try glfw3.dll in package directory + pass + + # try package directory + if glfw is None: try: + if sys.maxsize > 2**32: + # load Microsoft Visual C++ 2012 runtime on 64-bit systems + msvcr = ctypes.CDLL(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'msvcr110.dll')) + else: + # load Microsoft Visual C++ 2010 runtime on 32-bit systems + msvcr = ctypes.CDLL(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'msvcr100.dll')) glfw = ctypes.CDLL(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'glfw3.dll')) except OSError: - glfw = None + pass + + # try conda's default location on Windows + if glfw is None: + try: + glfw = ctypes.CDLL(os.path.join(sys.prefix, 'Library', 'bin', 'glfw3.dll')) + except OSError: + pass else: glfw = _load_library(['glfw', 'glfw3'], ['.so', '.dylib'], _get_library_search_paths(), _glfw_get_version) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glfw-1.8.3/glfw.egg-info/PKG-INFO new/glfw-1.11.0/glfw.egg-info/PKG-INFO --- old/glfw-1.8.3/glfw.egg-info/PKG-INFO 2019-08-22 19:23:56.000000000 +0200 +++ new/glfw-1.11.0/glfw.egg-info/PKG-INFO 2020-02-21 16:18:54.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: glfw -Version: 1.8.3 +Version: 1.11.0 Summary: A ctypes-based wrapper for GLFW3. Home-page: https://github.com/FlorianRhiem/pyGLFW Author: Florian Rhiem @@ -26,7 +26,9 @@ - Gamma ramps use floats between 0.0 and 1.0 instead of unsigned shorts (use ``glfw.NORMALIZE_GAMMA_RAMPS=False`` to disable this) - GLFW errors are reported as ``glfw.GLFWError`` exceptions if no error - callback is set (use ``glfw.ERROR_REPORTING=False`` to disable this) + callback is set (use ``glfw.ERROR_REPORTING=False`` to disable this, + set it to 'warn' instead to issue warnings or set it to 'log' to log it + using the 'glfw' logger) - instead of a sequence for ``GLFWimage`` structs, PIL/pillow ``Image`` objects can be used @@ -42,24 +44,38 @@ Windows ~~~~~~~ - The GLFW shared library is included in the Python wheels for Windows, but the correct Microsoft Visual C++ Redistributable will be required: + The GLFW shared library and Visual C++ runtime are included in the Python wheels. - - `VC 2010 <https://www.microsoft.com/en-us/download/details.aspx?id=5555>`_ for 32-bit Python, or - - `VC 2012 <https://www.microsoft.com/en-us/download/details.aspx?id=30679>`_ for 64-bit Python. + To use a different GLFW library, you can set ``PYGLFW_LIBRARY`` to its location. - Alternatively, you can download a shared library built for a runtime already installed on your system from `glfw.org <http://www.glfw.org/download.html>`_. + macOS + ~~~~~ - Linux and macOS - ~~~~~~~~~~~~~~~ + The GLFW shared library for 64-bit is included in the Python wheels for macOS. - You will need to install the GLFW shared library yourself and should - `compile GLFW from source <http://www.glfw.org/docs/latest/compile.html>`__ + If you are using a 32-bit Python installation or otherwise cannot use the + library downloaded with the wheel, you can build and install it yourself by + `compiling GLFW from source <http://www.glfw.org/docs/latest/compile.html>`__ (use ``-DBUILD_SHARED_LIBS=ON``). pyGLFW will search for the library in a list of search paths (including those - in ``LD_LIBRARY_PATH`` on Linux and ``DYLD_LIBRARY_PATH`` on macOS). If you - want to use a specific library, you can set the ``PYGLFW_LIBRARY`` environment - variable to its path. + in ``DYLD_LIBRARY_PATH``). If you want to use a specific library, you can set + the ``PYGLFW_LIBRARY`` environment variable to its path. + + Linux + ~~~~~ + + The GLFW shared library is included in the Python wheels for Linux. + + If you cannot use these on your system, you can install the GLFW shared + library using a package management system (e.g. ``apt install libglfw3`` + on Debian or Ubuntu) or you can build and install it yourself by + `compiling GLFW from source <http://www.glfw.org/docs/latest/compile.html>`__ + (use ``-DBUILD_SHARED_LIBS=ON``). + + pyGLFW will search for the library in a list of search paths (including those + in ``LD_LIBRARY_PATH``). If you want to use a specific library, you can set + the ``PYGLFW_LIBRARY`` environment variable to its path. Example Code ------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glfw-1.8.3/setup.py new/glfw-1.11.0/setup.py --- old/glfw-1.8.3/setup.py 2019-08-22 19:23:26.000000000 +0200 +++ new/glfw-1.11.0/setup.py 2020-02-21 16:18:20.000000000 +0100 @@ -8,7 +8,7 @@ setup( name='glfw', - version='1.8.3', + version='1.11.0', description='A ctypes-based wrapper for GLFW3.', long_description=long_description, url='https://github.com/FlorianRhiem/pyGLFW', @@ -28,7 +28,15 @@ ], packages=['glfw'], package_data={ - # include GLFW shared library in wheel package - 'glfw': ['glfw3.dll'] + # include GLFW shared library and Visual C++ runtimes in wheel package + 'glfw': [ + 'glfw3.dll', + 'libglfw.3.dylib', + 'wayland/libglfw.so', + 'x11/libglfw.so', + 'libglfw.so', + 'msvcr100.dll', + 'msvcr110.dll', + ] } )
