Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-glfw for openSUSE:Factory checked in at 2022-09-29 18:14:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-glfw (Old) and /work/SRC/openSUSE:Factory/.python-glfw.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-glfw" Thu Sep 29 18:14:15 2022 rev:9 rq:1006896 version:2.5.4 Changes: -------- --- /work/SRC/openSUSE:Factory/python-glfw/python-glfw.changes 2020-07-08 19:20:16.108451203 +0200 +++ /work/SRC/openSUSE:Factory/.python-glfw.new.2275/python-glfw.changes 2022-09-29 18:15:06.555460928 +0200 @@ -1,0 +2,33 @@ +Wed Sep 28 21:23:41 UTC 2022 - Yogalakshmi Arunachalam <[email protected]> + +- [2.5.5] - 2022-09-07 + Added wrappers for unreleased macros + Fixed set_monitor_user_pointer and get_monitor_user_pointer +- [2.5.4] - 2022-07-23 + Updated to GLFW 3.3.8 +- [2.5.3] - 2022-04-09 + Updated to GLFW 3.3.7 +- [2.5.2] - 2022-04-01 + Fixed swapped HAT_DOWN and HAT_RIGHT constants +- [2.5.1] - 2022-02-27 + Updated to GLFW 3.3.6 +- [2.5.0] - 2021-12-18 + Added /usr/lib/arm-linux-gnueabihf to library search paths +- [2.4.0] - 2021-11-07 + Added macOS wheels for arm64 + Added wrappers for unreleased macros and functions + Updated to GLFW 3.3.5 +- [2.3.0] - 2021-10-01 + Added /opt/homebrew/lib to library search paths +- [2.2.0] - 2021-09-09 + Added Linux wheels for aarch64 + Updated to GLFW 3.3.4 +- [2.1.0] - 2021-02-28 + Updated to GLFW 3.3.3 +- [2.0.0] - 2020-10-04 + Changed default error reporting method to warn + Allow dict for ERROR_REPORTING +- [1.12.0] - 2020-07-10 + Added support for CFFI pointers for Vulkan objects + +------------------------------------------------------------------- Old: ---- glfw-1.11.2.tar.gz New: ---- glfw-2.5.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-glfw.spec ++++++ --- /var/tmp/diff_new_pack.3EcSth/_old 2022-09-29 18:15:07.087461971 +0200 +++ /var/tmp/diff_new_pack.3EcSth/_new 2022-09-29 18:15:07.091461979 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-glfw # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2022 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.11.2 +Version: 2.5.4 Release: 0 Summary: A ctypes-based wrapper for GLFW3 License: MIT ++++++ glfw-1.11.2.tar.gz -> glfw-2.5.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glfw-1.11.2/CHANGELOG.md new/glfw-2.5.4/CHANGELOG.md --- old/glfw-1.11.2/CHANGELOG.md 2020-06-03 07:06:17.000000000 +0200 +++ new/glfw-2.5.4/CHANGELOG.md 2022-07-23 07:25:44.000000000 +0200 @@ -4,6 +4,44 @@ For information on changes in GLFW itself, see the [GLFW version history](https://www.glfw.org/changelog.html). + +## [2.5.3] - 2022-07-23 +- Updated to GLFW 3.3.8 + +## [2.5.3] - 2022-04-09 +- Updated to GLFW 3.3.7 + +## [2.5.2] - 2022-04-01 +- Fixed swapped HAT_DOWN and HAT_RIGHT constants + +## [2.5.1] - 2022-02-27 +- Updated to GLFW 3.3.6 + +## [2.5.0] - 2021-12-18 +- Added /usr/lib/arm-linux-gnueabihf to library search paths + +## [2.4.0] - 2021-11-07 +- Added macOS wheels for arm64 +- Added wrappers for unreleased macros and functions +- Updated to GLFW 3.3.5 + +## [2.3.0] - 2021-10-01 +- Added /opt/homebrew/lib to library search paths + +## [2.2.0] - 2021-09-09 +- Added Linux wheels for aarch64 +- Updated to GLFW 3.3.4 + +## [2.1.0] - 2021-02-28 +- Updated to GLFW 3.3.3 + +## [2.0.0] - 2020-10-04 +- Changed default error reporting method to warn +- Allow dict for ERROR_REPORTING + +## [1.12.0] - 2020-07-10 +- Added support for CFFI pointers for Vulkan objects + ## [1.11.2] - 2020-06-03 - Fixed missing parameter in set_window_opacity - Replaced non-ASCII whitespace diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glfw-1.11.2/PKG-INFO new/glfw-2.5.4/PKG-INFO --- old/glfw-1.11.2/PKG-INFO 2020-06-03 07:06:36.000000000 +0200 +++ new/glfw-2.5.4/PKG-INFO 2022-07-23 07:25:58.786930600 +0200 @@ -1,121 +1,11 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: glfw -Version: 1.11.2 +Version: 2.5.4 Summary: A ctypes-based wrapper for GLFW3. Home-page: https://github.com/FlorianRhiem/pyGLFW Author: Florian Rhiem Author-email: [email protected] License: MIT -Description: pyGLFW - ====== - - This module provides Python bindings for `GLFW <http://www.glfw.org/>`__ - (on GitHub: `glfw/glfw <http://github.com/glfw/glfw>`__). It is a - ``ctypes`` wrapper which keeps very close to the original GLFW API, - except for: - - - function names use the pythonic ``words_with_underscores`` notation - instead of ``camelCase`` - - ``GLFW_`` and ``glfw`` prefixes have been removed, as their function - is replaced by the module namespace - (you can use ``from glfw.GLFW import *`` if you prefer the naming - convention used by the GLFW C API) - - structs have been replaced with Python sequences and namedtuples - - functions like ``glfwGetMonitors`` return a list instead of a pointer - and an object count - - 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, - 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 - - Installation - ------------ - - pyGLFW can be installed using pip: - - .. code:: sh - - pip install glfw - - Windows - ~~~~~~~ - - The GLFW shared library and Visual C++ runtime are included in the Python wheels. - - To use a different GLFW library, you can set ``PYGLFW_LIBRARY`` to its location. - - macOS - ~~~~~ - - The GLFW shared library for 64-bit is included in the Python wheels for macOS. - - 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 ``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 - ------------ - - The example from the `GLFW - documentation <http://www.glfw.org/documentation.html>`__ ported to - pyGLFW: - - .. code:: python - - import glfw - - def main(): - # Initialize the library - if not glfw.init(): - return - # Create a windowed mode window and its OpenGL context - window = glfw.create_window(640, 480, "Hello World", None, None) - if not window: - glfw.terminate() - return - - # Make the window's context current - glfw.make_context_current(window) - - # Loop until the user closes the window - while not glfw.window_should_close(window): - # Render here, e.g. using pyOpenGL - - # Swap front and back buffers - glfw.swap_buffers(window) - - # Poll for and process events - glfw.poll_events() - - glfw.terminate() - - if __name__ == "__main__": - main() - Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: MacOS X @@ -126,3 +16,133 @@ Classifier: Programming Language :: Python :: 3 Classifier: Topic :: Multimedia :: Graphics Classifier: Topic :: Scientific/Engineering :: Visualization +Provides-Extra: preview +License-File: LICENSE.txt + +pyGLFW +====== + +This module provides Python bindings for `GLFW <http://www.glfw.org/>`__ +(on GitHub: `glfw/glfw <http://github.com/glfw/glfw>`__). It is a +``ctypes`` wrapper which keeps very close to the original GLFW API, +except for: + +- function names use the pythonic ``words_with_underscores`` notation + instead of ``camelCase`` +- ``GLFW_`` and ``glfw`` prefixes have been removed, as their function + is replaced by the module namespace + (you can use ``from glfw.GLFW import *`` if you prefer the naming + convention used by the GLFW C API) +- structs have been replaced with Python sequences and namedtuples +- functions like ``glfwGetMonitors`` return a list instead of a pointer + and an object count +- 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`` warnings if no error + callback is set (use ``glfw.ERROR_REPORTING=False`` to disable this, + set it to 'warn' instead to issue warnings, set it to 'log' to log it + using the 'glfw' logger or set it to a dict to define the behavior for + specific error codes) +- instead of a sequence for ``GLFWimage`` structs, PIL/pillow ``Image`` + objects can be used + +Installation +------------ + +pyGLFW can be installed using pip: + +.. code:: sh + + pip install glfw + +Windows +~~~~~~~ + +The GLFW shared library and Visual C++ runtime are included in the Python wheels. + +To use a different GLFW library, you can set ``PYGLFW_LIBRARY`` to its location. + +macOS +~~~~~ + +The GLFW shared library for 64-bit is included in the Python wheels for macOS. + +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 ``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. + +Development Version +~~~~~~~~~~~~~~~~~~~ + +If you are using the development version of GLFW and would like to use wrappers +for currently unreleased macros and functions, you can instead install: + +.. code:: sh + + pip install glfw[preview] + +or set the ``PYGLFW_PREVIEW`` environment variable. + +Note, however, that there will be a slight delay between the development +version of GLFW and the wrappers provided by this package. + +Example Code +------------ + +The example from the `GLFW +documentation <http://www.glfw.org/documentation.html>`__ ported to +pyGLFW: + +.. code:: python + + import glfw + + def main(): + # Initialize the library + if not glfw.init(): + return + # Create a windowed mode window and its OpenGL context + window = glfw.create_window(640, 480, "Hello World", None, None) + if not window: + glfw.terminate() + return + + # Make the window's context current + glfw.make_context_current(window) + + # Loop until the user closes the window + while not glfw.window_should_close(window): + # Render here, e.g. using pyOpenGL + + # Swap front and back buffers + glfw.swap_buffers(window) + + # Poll for and process events + glfw.poll_events() + + glfw.terminate() + + if __name__ == "__main__": + main() + + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glfw-1.11.2/README.rst new/glfw-2.5.4/README.rst --- old/glfw-1.11.2/README.rst 2020-06-03 07:06:17.000000000 +0200 +++ new/glfw-2.5.4/README.rst 2022-07-23 07:25:44.000000000 +0200 @@ -17,10 +17,11 @@ and an object count - 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 +- GLFW errors are reported as ``glfw.GLFWError`` warnings if no error 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) + set it to 'warn' instead to issue warnings, set it to 'log' to log it + using the 'glfw' logger or set it to a dict to define the behavior for + specific error codes) - instead of a sequence for ``GLFWimage`` structs, PIL/pillow ``Image`` objects can be used @@ -69,6 +70,21 @@ in ``LD_LIBRARY_PATH``). If you want to use a specific library, you can set the ``PYGLFW_LIBRARY`` environment variable to its path. +Development Version +~~~~~~~~~~~~~~~~~~~ + +If you are using the development version of GLFW and would like to use wrappers +for currently unreleased macros and functions, you can instead install: + +.. code:: sh + + pip install glfw[preview] + +or set the ``PYGLFW_PREVIEW`` environment variable. + +Note, however, that there will be a slight delay between the development +version of GLFW and the wrappers provided by this package. + Example Code ------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glfw-1.11.2/glfw/GLFW.py new/glfw-2.5.4/glfw/GLFW.py --- old/glfw-1.11.2/glfw/GLFW.py 2020-06-03 07:06:17.000000000 +0200 +++ new/glfw-2.5.4/glfw/GLFW.py 2022-07-23 07:25:44.000000000 +0200 @@ -414,3 +414,42 @@ window_hint_string as glfwWindowHintString, window_should_close as glfwWindowShouldClose, ) + +from . import _PREVIEW +if _PREVIEW: + from . import ( + ANGLE_PLATFORM_TYPE as GLFW_ANGLE_PLATFORM_TYPE, + ANGLE_PLATFORM_TYPE_D3D11 as GLFW_ANGLE_PLATFORM_TYPE_D3D11, + ANGLE_PLATFORM_TYPE_D3D9 as GLFW_ANGLE_PLATFORM_TYPE_D3D9, + ANGLE_PLATFORM_TYPE_METAL as GLFW_ANGLE_PLATFORM_TYPE_METAL, + ANGLE_PLATFORM_TYPE_NONE as GLFW_ANGLE_PLATFORM_TYPE_NONE, + ANGLE_PLATFORM_TYPE_OPENGL as GLFW_ANGLE_PLATFORM_TYPE_OPENGL, + ANGLE_PLATFORM_TYPE_OPENGLES as GLFW_ANGLE_PLATFORM_TYPE_OPENGLES, + ANGLE_PLATFORM_TYPE_VULKAN as GLFW_ANGLE_PLATFORM_TYPE_VULKAN, + ANY_PLATFORM as GLFW_ANY_PLATFORM, + CONTEXT_DEBUG as GLFW_CONTEXT_DEBUG, + CURSOR_UNAVAILABLE as GLFW_CURSOR_UNAVAILABLE, + FEATURE_UNAVAILABLE as GLFW_FEATURE_UNAVAILABLE, + FEATURE_UNIMPLEMENTED as GLFW_FEATURE_UNIMPLEMENTED, + MOUSE_PASSTHROUGH as GLFW_MOUSE_PASSTHROUGH, + NOT_ALLOWED_CURSOR as GLFW_NOT_ALLOWED_CURSOR, + PLATFORM as GLFW_PLATFORM, + PLATFORM_COCOA as GLFW_PLATFORM_COCOA, + PLATFORM_NULL as GLFW_PLATFORM_NULL, + PLATFORM_UNAVAILABLE as GLFW_PLATFORM_UNAVAILABLE, + PLATFORM_WAYLAND as GLFW_PLATFORM_WAYLAND, + PLATFORM_WIN32 as GLFW_PLATFORM_WIN32, + PLATFORM_X11 as GLFW_PLATFORM_X11, + POINTING_HAND_CURSOR as GLFW_POINTING_HAND_CURSOR, + RESIZE_ALL_CURSOR as GLFW_RESIZE_ALL_CURSOR, + RESIZE_EW_CURSOR as GLFW_RESIZE_EW_CURSOR, + RESIZE_NESW_CURSOR as GLFW_RESIZE_NESW_CURSOR, + RESIZE_NS_CURSOR as GLFW_RESIZE_NS_CURSOR, + RESIZE_NWSE_CURSOR as GLFW_RESIZE_NWSE_CURSOR, + WIN32_KEYBOARD_MENU as GLFW_WIN32_KEYBOARD_MENU, + X11_XCB_VULKAN_SURFACE as GLFW_X11_XCB_VULKAN_SURFACE, + init_allocator as glfwInitAllocator, + init_vulkan_loader as glfwInitVulkanLoader, + get_platform as glfwGetPlatform, + platform_supported as glfwPlatformSupported, + ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glfw-1.11.2/glfw/__init__.py new/glfw-2.5.4/glfw/__init__.py --- old/glfw-1.11.2/glfw/__init__.py 2020-06-03 07:06:17.000000000 +0200 +++ new/glfw-2.5.4/glfw/__init__.py 2022-07-23 07:25:44.000000000 +0200 @@ -7,9 +7,9 @@ from __future__ import unicode_literals __author__ = 'Florian Rhiem ([email protected])' -__copyright__ = 'Copyright (c) 2013-2019 Florian Rhiem' +__copyright__ = 'Copyright (c) 2013-2021 Florian Rhiem' __license__ = 'MIT' -__version__ = '1.11.2' +__version__ = '2.5.4' # By default, GLFW errors will be handled by a pre-defined error callback. # Depending on the value of ERROR_REPORTING, this callback will: @@ -18,8 +18,10 @@ # - 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. +# If ERROR_REPORTING is a dict containing the specific error code or None as a +#??key, the corresponding value will be used. # Alternatively, you can set a custom error callback using set_error_callback. -ERROR_REPORTING = True +ERROR_REPORTING = 'warn' # By default (NORMALIZE_GAMMA_RAMPS = True), gamma ramps are expected to # contain values between 0 and 1, and the conversion to unsigned shorts will @@ -40,6 +42,22 @@ if _glfw is None: raise ImportError("Failed to load GLFW3 shared library.") +# By default, pyGLFW will only provide functionality from released GLFW +# versions, as using the development version may lead to changing behavior or +# missing functions. If the environment variable PYGLFW_PREVIEW is set or the +# glfw_preview package can be imported, macros and functions from the current +# developtment version of GLFW will be provided. Note that there will still be +# a delay between them getting added to GLFW and being wrapped by pyGLFW, and +# further delay until they are included in a pyGLFW release. +_PREVIEW = os.environ.get('PYGLFW_PREVIEW') +if _PREVIEW is None: + try: + import glfw_preview + _PREVIEW = True + except: + _PREVIEW = False +else: + _PREVIEW = bool(_PREVIEW) # Python 3 compatibility: try: @@ -56,13 +74,27 @@ # wrapped in exec, as python 3 does not support this variant of raise exec("raise exception, None, traceback") +# support for CFFI pointers for Vulkan objects +try: + from cffi import FFI +except ImportError: + _cffi_to_ctypes_void_p = lambda ptr: ptr +else: + ffi = FFI() + def _cffi_to_ctypes_void_p(ptr): + if isinstance(ptr, ffi.CData): + return ctypes.cast(int(ffi.cast('uintptr_t', ptr)), ctypes.c_void_p) + return ptr + class GLFWError(UserWarning): """ Exception class used for reporting GLFW errors. """ - def __init__(self, message): + def __init__(self, message, error_code=None): super(GLFWError, self).__init__(message) + self.error_code = error_code + _callback_repositories = [] @@ -290,7 +322,7 @@ VERSION_MAJOR = 3 VERSION_MINOR = 3 -VERSION_REVISION = 0 +VERSION_REVISION = 4 TRUE = 1 FALSE = 0 RELEASE = 0 @@ -298,8 +330,8 @@ REPEAT = 2 HAT_CENTERED = 0 HAT_UP = 1 -HAT_DOWN = 2 -HAT_RIGHT = 4 +HAT_RIGHT = 2 +HAT_DOWN = 4 HAT_LEFT = 8 HAT_RIGHT_UP = HAT_RIGHT | HAT_UP HAT_RIGHT_DOWN = HAT_RIGHT | HAT_DOWN @@ -581,6 +613,39 @@ COCOA_MENUBAR = 0x00051002 DONT_CARE = -1 + +if _PREVIEW: + ANGLE_PLATFORM_TYPE = 0x00050002 + ANGLE_PLATFORM_TYPE_NONE = 0x00037001 + ANGLE_PLATFORM_TYPE_OPENGL = 0x00037002 + ANGLE_PLATFORM_TYPE_OPENGLES = 0x00037003 + ANGLE_PLATFORM_TYPE_D3D9 = 0x00037004 + ANGLE_PLATFORM_TYPE_D3D11 = 0x00037005 + ANGLE_PLATFORM_TYPE_VULKAN = 0x00037007 + ANGLE_PLATFORM_TYPE_METAL = 0x00037008 + ANY_PLATFORM = 0x00060000 + CONTEXT_DEBUG = 0x00022007 + CURSOR_UNAVAILABLE = 0x0001000B + FEATURE_UNAVAILABLE = 0x0001000C + FEATURE_UNIMPLEMENTED = 0x0001000D + MOUSE_PASSTHROUGH = 0x0002000D + NOT_ALLOWED_CURSOR = 0x0003600A + PLATFORM = 0x00050003 + PLATFORM_COCOA = 0x00060002 + PLATFORM_NULL = 0x00060005 + PLATFORM_UNAVAILABLE = 0x0001000E + PLATFORM_WAYLAND = 0x00060003 + PLATFORM_WIN32 = 0x00060001 + PLATFORM_X11 = 0x00060004 + POINTING_HAND_CURSOR = 0x00036004 + RESIZE_ALL_CURSOR = 0x00036009 + RESIZE_EW_CURSOR = 0x00036005 + RESIZE_NESW_CURSOR = 0x00036008 + RESIZE_NS_CURSOR = 0x00036006 + RESIZE_NWSE_CURSOR = 0x00036007 + WIN32_KEYBOARD_MENU = 0x00025001 + X11_XCB_VULKAN_SURFACE = 0x00052001 + _exc_info_from_callback = None def _callback_exception_decorator(func): @functools.wraps(func) @@ -700,6 +765,29 @@ ctypes.c_int, ctypes.c_int) +if _PREVIEW: + _GLFWallocatefun = ctypes.CFUNCTYPE(ctypes.c_void_p, + ctypes.c_size_t, + ctypes.c_void_p) + _GLFWreallocatefun = ctypes.CFUNCTYPE(ctypes.c_void_p, + ctypes.c_void_p, + ctypes.c_size_t, + ctypes.c_void_p) + _GLFWdeallocatefun = ctypes.CFUNCTYPE(None, + ctypes.c_void_p, + ctypes.c_void_p) + + class _GLFWallocator(ctypes.Structure): + """ + Wrapper for: + typedef struct GLFWallocator GLFWallocator; + """ + _fields_ = [ + ("allocate", _GLFWallocatefun), + ("reallocate", _GLFWreallocatefun), + ("deallocate", _GLFWdeallocatefun), + ] + _glfw.glfwInit.restype = ctypes.c_int _glfw.glfwInit.argtypes = [] @@ -804,13 +892,21 @@ """ global ERROR_REPORTING message = "(%d) %s" % (error_code, description) - if ERROR_REPORTING in ('raise', 'exception', True): - raise GLFWError(message) - elif ERROR_REPORTING in ('warn', 'warning'): + error_reporting = ERROR_REPORTING + if isinstance(error_reporting, dict): + if error_code in error_reporting: + error_reporting = error_reporting[error_code] + elif None in error_reporting: + error_reporting = error_reporting[None] + else: + error_reporting = None + if error_reporting in ('raise', 'exception', True): + raise GLFWError(message, error_code=error_code) + elif error_reporting in ('warn', 'warning'): warnings.warn(message, GLFWError) - elif ERROR_REPORTING in ('log',): + elif error_reporting in ('log',): logging.getLogger('glfw').debug(message) - elif ERROR_REPORTING in ('ignore', False): + elif error_reporting in ('ignore', False): pass else: raise ValueError('Invalid value of ERROR_REPORTING while handling GLFW error:\n' + message) @@ -2558,6 +2654,9 @@ Wrapper for: VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); """ + instance = _cffi_to_ctypes_void_p(instance) + surface = _cffi_to_ctypes_void_p(surface) + allocator = _cffi_to_ctypes_void_p(allocator) return _glfw.glfwCreateWindowSurface(instance, window, allocator, surface) if hasattr(_glfw, 'glfwGetPhysicalDevicePresentationSupport'): @@ -2572,6 +2671,8 @@ Wrapper for: int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); """ + instance = _cffi_to_ctypes_void_p(instance) + device = _cffi_to_ctypes_void_p(device) return _glfw.glfwGetPhysicalDevicePresentationSupport(instance, device, queuefamily) if hasattr(_glfw, 'glfwGetInstanceProcAddress'): @@ -2585,6 +2686,7 @@ Wrapper for: GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* procname); """ + instance = _cffi_to_ctypes_void_p(instance) return _glfw.glfwGetInstanceProcAddress(instance, procname) if hasattr(_glfw, 'glfwSetWindowIcon'): @@ -3080,4 +3182,87 @@ """ return _glfw.glfwGetOSMesaContext(window) +if _PREVIEW: + if hasattr(_glfw, 'glfwInitAllocator'): + _allocate_callback = None + _reallocate_callback = None + _deallocate_callback = None + _glfw.glfwInitAllocator.restype = None + _glfw.glfwInitAllocator.argtypes = [ctypes.POINTER(_GLFWallocator)] + def init_allocator(allocate, reallocate, deallocate): + """ + Sets the init allocator to the desired value. + + Wrapper for: + void glfwInitAllocator(const GLFWallocator* allocator); + """ + global _allocate_callback + global _reallocate_callback + global _deallocate_callback + if allocate is None and reallocate is None and deallocate is None: + allocator_ptr = ctypes.POINTER(_GLFWallocator)(0) + else: + if allocate is None: + allocate = 0 + c_allocate = _GLFWallocatefun(allocate) + _allocate_callback = (allocate, c_allocate) + if reallocate is None: + reallocate = 0 + c_reallocate = _GLFWreallocatefun(reallocate) + _reallocate_callback = (reallocate, c_reallocate) + if deallocate is None: + deallocate = 0 + c_deallocate = _GLFWdeallocatefun(deallocate) + _deallocate_callback = (deallocate, c_deallocate) + allocator = _GLFWallocator() + allocator.allocate = c_allocate + allocator.reallocate = c_reallocate + allocator.deallocate = c_deallocate + allocator_ptr = ctypes.byref(allocator) + _glfw.glfwInitAllocator(allocator_ptr) + + if hasattr(_glfw, 'glfwInitVulkanLoader'): + _loader_callback = None + _loader_callback_type = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_char_p) + _glfw.glfwInitVulkanLoader.restype = None + _glfw.glfwInitVulkanLoader.argtypes = [_loader_callback_type] + def init_vulkan_loader(loader): + """ + Sets the desired Vulkan `vkGetInstanceProcAddr` function. + + Wrapper for: + void glfwInitVulkanLoader(PFN_vkGetInstanceProcAddr loader); + """ + global _loader_callback + if loader is None: + loader = 0 + c_loader = _loader_callback_type(loader) + _loader_callback = (loader, c_loader) + _glfw.glfwInitVulkanLoader(c_loader) + + if hasattr(_glfw, 'glfwGetPlatform'): + _glfw.glfwGetPlatform.restype = ctypes.c_int + _glfw.glfwGetPlatform.argtypes = [] + def get_platform(): + """ + Returns the currently selected platform. + + Wrapper for: + int glfwGetPlatform(void); + """ + return _glfw.glfwGetPlatform() + + if hasattr(_glfw, 'glfwPlatformSupported'): + _glfw.glfwPlatformSupported.restype = ctypes.c_int + _glfw.glfwPlatformSupported.argtypes = [ctypes.c_int] + def platform_supported(platform): + """ + Returns whether the library includes support for the specified platform. + + Wrapper for: + int glfwPlatformSupported(int platform); + """ + return _glfw.glfwPlatformSupported(platform) + + _prepare_errcheck() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glfw-1.11.2/glfw/library.py new/glfw-2.5.4/glfw/library.py --- old/glfw-1.11.2/glfw/library.py 2020-06-03 07:06:17.000000000 +0200 +++ new/glfw-2.5.4/glfw/library.py 2022-07-23 07:25:44.000000000 +0200 @@ -133,9 +133,11 @@ '/usr/lib64', '/usr/local/lib64', '/usr/lib', '/usr/local/lib', + '/opt/homebrew/lib', '/run/current-system/sw/lib', '/usr/lib/x86_64-linux-gnu/', '/usr/lib/aarch64-linux-gnu/', + '/usr/lib/arm-linux-gnueabihf', ] if sys.platform != 'darwin': diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glfw-1.11.2/glfw.egg-info/PKG-INFO new/glfw-2.5.4/glfw.egg-info/PKG-INFO --- old/glfw-1.11.2/glfw.egg-info/PKG-INFO 2020-06-03 07:06:35.000000000 +0200 +++ new/glfw-2.5.4/glfw.egg-info/PKG-INFO 2022-07-23 07:25:58.000000000 +0200 @@ -1,121 +1,11 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: glfw -Version: 1.11.2 +Version: 2.5.4 Summary: A ctypes-based wrapper for GLFW3. Home-page: https://github.com/FlorianRhiem/pyGLFW Author: Florian Rhiem Author-email: [email protected] License: MIT -Description: pyGLFW - ====== - - This module provides Python bindings for `GLFW <http://www.glfw.org/>`__ - (on GitHub: `glfw/glfw <http://github.com/glfw/glfw>`__). It is a - ``ctypes`` wrapper which keeps very close to the original GLFW API, - except for: - - - function names use the pythonic ``words_with_underscores`` notation - instead of ``camelCase`` - - ``GLFW_`` and ``glfw`` prefixes have been removed, as their function - is replaced by the module namespace - (you can use ``from glfw.GLFW import *`` if you prefer the naming - convention used by the GLFW C API) - - structs have been replaced with Python sequences and namedtuples - - functions like ``glfwGetMonitors`` return a list instead of a pointer - and an object count - - 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, - 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 - - Installation - ------------ - - pyGLFW can be installed using pip: - - .. code:: sh - - pip install glfw - - Windows - ~~~~~~~ - - The GLFW shared library and Visual C++ runtime are included in the Python wheels. - - To use a different GLFW library, you can set ``PYGLFW_LIBRARY`` to its location. - - macOS - ~~~~~ - - The GLFW shared library for 64-bit is included in the Python wheels for macOS. - - 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 ``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 - ------------ - - The example from the `GLFW - documentation <http://www.glfw.org/documentation.html>`__ ported to - pyGLFW: - - .. code:: python - - import glfw - - def main(): - # Initialize the library - if not glfw.init(): - return - # Create a windowed mode window and its OpenGL context - window = glfw.create_window(640, 480, "Hello World", None, None) - if not window: - glfw.terminate() - return - - # Make the window's context current - glfw.make_context_current(window) - - # Loop until the user closes the window - while not glfw.window_should_close(window): - # Render here, e.g. using pyOpenGL - - # Swap front and back buffers - glfw.swap_buffers(window) - - # Poll for and process events - glfw.poll_events() - - glfw.terminate() - - if __name__ == "__main__": - main() - Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: MacOS X @@ -126,3 +16,133 @@ Classifier: Programming Language :: Python :: 3 Classifier: Topic :: Multimedia :: Graphics Classifier: Topic :: Scientific/Engineering :: Visualization +Provides-Extra: preview +License-File: LICENSE.txt + +pyGLFW +====== + +This module provides Python bindings for `GLFW <http://www.glfw.org/>`__ +(on GitHub: `glfw/glfw <http://github.com/glfw/glfw>`__). It is a +``ctypes`` wrapper which keeps very close to the original GLFW API, +except for: + +- function names use the pythonic ``words_with_underscores`` notation + instead of ``camelCase`` +- ``GLFW_`` and ``glfw`` prefixes have been removed, as their function + is replaced by the module namespace + (you can use ``from glfw.GLFW import *`` if you prefer the naming + convention used by the GLFW C API) +- structs have been replaced with Python sequences and namedtuples +- functions like ``glfwGetMonitors`` return a list instead of a pointer + and an object count +- 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`` warnings if no error + callback is set (use ``glfw.ERROR_REPORTING=False`` to disable this, + set it to 'warn' instead to issue warnings, set it to 'log' to log it + using the 'glfw' logger or set it to a dict to define the behavior for + specific error codes) +- instead of a sequence for ``GLFWimage`` structs, PIL/pillow ``Image`` + objects can be used + +Installation +------------ + +pyGLFW can be installed using pip: + +.. code:: sh + + pip install glfw + +Windows +~~~~~~~ + +The GLFW shared library and Visual C++ runtime are included in the Python wheels. + +To use a different GLFW library, you can set ``PYGLFW_LIBRARY`` to its location. + +macOS +~~~~~ + +The GLFW shared library for 64-bit is included in the Python wheels for macOS. + +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 ``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. + +Development Version +~~~~~~~~~~~~~~~~~~~ + +If you are using the development version of GLFW and would like to use wrappers +for currently unreleased macros and functions, you can instead install: + +.. code:: sh + + pip install glfw[preview] + +or set the ``PYGLFW_PREVIEW`` environment variable. + +Note, however, that there will be a slight delay between the development +version of GLFW and the wrappers provided by this package. + +Example Code +------------ + +The example from the `GLFW +documentation <http://www.glfw.org/documentation.html>`__ ported to +pyGLFW: + +.. code:: python + + import glfw + + def main(): + # Initialize the library + if not glfw.init(): + return + # Create a windowed mode window and its OpenGL context + window = glfw.create_window(640, 480, "Hello World", None, None) + if not window: + glfw.terminate() + return + + # Make the window's context current + glfw.make_context_current(window) + + # Loop until the user closes the window + while not glfw.window_should_close(window): + # Render here, e.g. using pyOpenGL + + # Swap front and back buffers + glfw.swap_buffers(window) + + # Poll for and process events + glfw.poll_events() + + glfw.terminate() + + if __name__ == "__main__": + main() + + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glfw-1.11.2/glfw.egg-info/SOURCES.txt new/glfw-2.5.4/glfw.egg-info/SOURCES.txt --- old/glfw-1.11.2/glfw.egg-info/SOURCES.txt 2020-06-03 07:06:36.000000000 +0200 +++ new/glfw-2.5.4/glfw.egg-info/SOURCES.txt 2022-07-23 07:25:58.000000000 +0200 @@ -9,4 +9,5 @@ glfw.egg-info/PKG-INFO glfw.egg-info/SOURCES.txt glfw.egg-info/dependency_links.txt +glfw.egg-info/requires.txt glfw.egg-info/top_level.txt \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glfw-1.11.2/glfw.egg-info/requires.txt new/glfw-2.5.4/glfw.egg-info/requires.txt --- old/glfw-1.11.2/glfw.egg-info/requires.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/glfw-2.5.4/glfw.egg-info/requires.txt 2022-07-23 07:25:58.000000000 +0200 @@ -0,0 +1,3 @@ + +[preview] +glfw_preview diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glfw-1.11.2/setup.py new/glfw-2.5.4/setup.py --- old/glfw-1.11.2/setup.py 2020-06-03 07:06:17.000000000 +0200 +++ new/glfw-2.5.4/setup.py 2022-07-23 07:25:44.000000000 +0200 @@ -8,7 +8,7 @@ setup( name='glfw', - version='1.11.2', + version='2.5.4', description='A ctypes-based wrapper for GLFW3.', long_description=long_description, url='https://github.com/FlorianRhiem/pyGLFW', @@ -38,5 +38,8 @@ 'msvcr100.dll', 'msvcr110.dll', ] + }, + extras_require={ + 'preview': ['glfw_preview'] } )
