diff --git a/pkgs/development/python-modules/glfw/default.nix b/pkgs/development/python-modules/glfw/default.nix new file mode 100644 index 000000000000..107f7afb9690 --- /dev/null +++ b/pkgs/development/python-modules/glfw/default.nix @@ -0,0 +1,31 @@ +{ lib, buildPythonPackage, fetchFromGitHub, glfw3 }: + +buildPythonPackage rec { + pname = "glfw"; + version = "2.2.0"; + + src = fetchFromGitHub { + owner = "FlorianRhiem"; + repo = "pyGLFW"; + rev = "v${version}"; + sha256 = "1ygcwnh0x07yi87wkxykw566g74vfi8n0w2rzypidhdss14x3pvf"; + }; + + # Patch path to GLFW shared object + patches = [ ./search-path.patch ]; + postPatch = '' + substituteInPlace glfw/library.py --replace "@GLFW@" '${glfw3}/lib' + ''; + propagatedBuildInputs = [ glfw3 ]; + + # Project has no tests + doCheck = false; + pythonImportsCheck = [ "glfw" ]; + + meta = with lib; { + description = "Python bindings for GLFW"; + homepage = "https://github.com/FlorianRhiem/pyGLFW"; + license = licenses.mit; + maintainers = [ maintainers.McSinyx ]; + }; +} diff --git a/pkgs/development/python-modules/glfw/search-path.patch b/pkgs/development/python-modules/glfw/search-path.patch new file mode 100644 index 000000000000..0c4a42ceb362 --- /dev/null +++ b/pkgs/development/python-modules/glfw/search-path.patch @@ -0,0 +1,11 @@ +diff --git a/glfw/library.py b/glfw/library.py +index 20387e1..9bdd62a 100644 +--- a/glfw/library.py ++++ b/glfw/library.py +@@ -189,5 +189,4 @@ elif sys.platform == 'win32': + except OSError: + pass + else: +- glfw = _load_library(['glfw', 'glfw3'], ['.so', '.dylib'], +- _get_library_search_paths(), _glfw_get_version) ++ glfw = _load_library(['glfw', 'glfw3'], ['.so', '.dylib'], ['@GLFW@'], _glfw_get_version) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index d73e12678613..22d654a489fe 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2961,6 +2961,8 @@ in { glcontext = callPackage ../development/python-modules/glcontext { }; + glfw = callPackage ../development/python-modules/glfw { }; + glob2 = callPackage ../development/python-modules/glob2 { }; globre = callPackage ../development/python-modules/globre { };