Loading pkgs/development/python-modules/pysdl3/default.nix 0 → 100644 +102 −0 Original line number Diff line number Diff line { stdenv, lib, fetchurl, fetchFromGitHub, python, buildPythonPackage, setuptools-scm, packaging, aiohttp, requests, # native dependencies sdl3, sdl3-ttf, sdl3-image, }: let dochash = if stdenv.hostPlatform.isLinux then "sha256-+1zLd308zL+m68kLMeOWWxT0wYDgCd6g9cc2hEtaeUs=" else if stdenv.hostPlatform.isDarwin then "sha256-2uB9+ABgv5O376LyHb0ShGjM4LHYzMRMxk/k+1LBmv0=" else if stdenv.hostPlatform.isWindows then "sha256-46bQSPYctycizf2GXichd5V74LjxwIAPhBmklXAJ/Jg=" else throw "PySDL3 does not support ${stdenv.hostPlatform.uname.system}"; lib_ext = stdenv.hostPlatform.extensions.sharedLibrary; in buildPythonPackage rec { pname = "pysdl3"; version = "0.9.8b1"; pyproject = true; pythonImportsCheck = [ "sdl3" ]; src = fetchFromGitHub { owner = "Aermoss"; repo = "PySDL3"; tag = "v${version}"; hash = "sha256-FVUCcqKTq6qdNkYHTYFiUxt2HIaNC5LK0BEUfz8Mue8="; }; docfile = fetchurl { url = "https://github.com/Aermoss/PySDL3/releases/download/v${version}/${stdenv.hostPlatform.uname.system}-Docs.py"; hash = "${dochash}"; }; postUnpack = '' cp ${docfile} source/sdl3/__doc__.py ''; postInstall = '' mkdir $out/${python.sitePackages}/sdl3/bin ln -s ${sdl3}/lib/libSDL3${lib_ext} -t $out/${python.sitePackages}/sdl3/bin ln -s ${sdl3-ttf}/lib/libSDL3_ttf${lib_ext} -t $out/${python.sitePackages}/sdl3/bin ln -s ${sdl3-image}/lib/libSDL3_image${lib_ext} -t $out/${python.sitePackages}/sdl3/bin ''; build-system = [ setuptools-scm ]; buildInputs = [ sdl3 sdl3-ttf sdl3-image ]; dependencies = [ packaging aiohttp requests ]; # PySDL3 tries to update both itself and SDL binaries at runtime. This hook # sets some env variables to tell it not to do that. setupHook = ./setup-hook.sh; env = { SDL_VIDEODRIVER = "dummy"; SDL_AUDIODRIVER = "dummy"; SDL_RENDER_DRIVER = "software"; PYTHONFAULTHANDLER = "1"; }; meta = { description = "Pure Python wrapper for SDL3"; homepage = "https://github.com/Aermoss/PySDL3"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ jansol ]; platforms = [ "aarch64-linux" "x86_64-linux" "aarch64-windows" "x86_64-windows" "aarch64-darwin" "x86_64-darwin" ]; }; } pkgs/development/python-modules/pysdl3/setup-hook.sh 0 → 100644 +10 −0 Original line number Diff line number Diff line # See also # https://pysdl3.readthedocs.io/en/latest/install.html#the-environment-variable-method # Don't check Pypi for new PySDL3 releases at runtime export SDL_CHECK_VERSION=0 # Don't try to download SDL binaries at runtime export SDL_DOWNLOAD_BINARIES=0 # Nixpkgs does not provide a metadata.json. Instead we want PySDL3 to find the # SDL libraries we symlink into its site-packages export SDL_DISABLE_METADATA=1 pkgs/top-level/python-packages.nix +2 −0 Original line number Diff line number Diff line Loading @@ -13333,6 +13333,8 @@ self: super: with self; { pysdl2 = callPackage ../development/python-modules/pysdl2 { }; pysdl3 = callPackage ../development/python-modules/pysdl3 { }; pysearpc = toPythonModule (pkgs.libsearpc.override { python3 = self.python; }); pysecretsocks = callPackage ../development/python-modules/pysecretsocks { }; Loading Loading
pkgs/development/python-modules/pysdl3/default.nix 0 → 100644 +102 −0 Original line number Diff line number Diff line { stdenv, lib, fetchurl, fetchFromGitHub, python, buildPythonPackage, setuptools-scm, packaging, aiohttp, requests, # native dependencies sdl3, sdl3-ttf, sdl3-image, }: let dochash = if stdenv.hostPlatform.isLinux then "sha256-+1zLd308zL+m68kLMeOWWxT0wYDgCd6g9cc2hEtaeUs=" else if stdenv.hostPlatform.isDarwin then "sha256-2uB9+ABgv5O376LyHb0ShGjM4LHYzMRMxk/k+1LBmv0=" else if stdenv.hostPlatform.isWindows then "sha256-46bQSPYctycizf2GXichd5V74LjxwIAPhBmklXAJ/Jg=" else throw "PySDL3 does not support ${stdenv.hostPlatform.uname.system}"; lib_ext = stdenv.hostPlatform.extensions.sharedLibrary; in buildPythonPackage rec { pname = "pysdl3"; version = "0.9.8b1"; pyproject = true; pythonImportsCheck = [ "sdl3" ]; src = fetchFromGitHub { owner = "Aermoss"; repo = "PySDL3"; tag = "v${version}"; hash = "sha256-FVUCcqKTq6qdNkYHTYFiUxt2HIaNC5LK0BEUfz8Mue8="; }; docfile = fetchurl { url = "https://github.com/Aermoss/PySDL3/releases/download/v${version}/${stdenv.hostPlatform.uname.system}-Docs.py"; hash = "${dochash}"; }; postUnpack = '' cp ${docfile} source/sdl3/__doc__.py ''; postInstall = '' mkdir $out/${python.sitePackages}/sdl3/bin ln -s ${sdl3}/lib/libSDL3${lib_ext} -t $out/${python.sitePackages}/sdl3/bin ln -s ${sdl3-ttf}/lib/libSDL3_ttf${lib_ext} -t $out/${python.sitePackages}/sdl3/bin ln -s ${sdl3-image}/lib/libSDL3_image${lib_ext} -t $out/${python.sitePackages}/sdl3/bin ''; build-system = [ setuptools-scm ]; buildInputs = [ sdl3 sdl3-ttf sdl3-image ]; dependencies = [ packaging aiohttp requests ]; # PySDL3 tries to update both itself and SDL binaries at runtime. This hook # sets some env variables to tell it not to do that. setupHook = ./setup-hook.sh; env = { SDL_VIDEODRIVER = "dummy"; SDL_AUDIODRIVER = "dummy"; SDL_RENDER_DRIVER = "software"; PYTHONFAULTHANDLER = "1"; }; meta = { description = "Pure Python wrapper for SDL3"; homepage = "https://github.com/Aermoss/PySDL3"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ jansol ]; platforms = [ "aarch64-linux" "x86_64-linux" "aarch64-windows" "x86_64-windows" "aarch64-darwin" "x86_64-darwin" ]; }; }
pkgs/development/python-modules/pysdl3/setup-hook.sh 0 → 100644 +10 −0 Original line number Diff line number Diff line # See also # https://pysdl3.readthedocs.io/en/latest/install.html#the-environment-variable-method # Don't check Pypi for new PySDL3 releases at runtime export SDL_CHECK_VERSION=0 # Don't try to download SDL binaries at runtime export SDL_DOWNLOAD_BINARIES=0 # Nixpkgs does not provide a metadata.json. Instead we want PySDL3 to find the # SDL libraries we symlink into its site-packages export SDL_DISABLE_METADATA=1
pkgs/top-level/python-packages.nix +2 −0 Original line number Diff line number Diff line Loading @@ -13333,6 +13333,8 @@ self: super: with self; { pysdl2 = callPackage ../development/python-modules/pysdl2 { }; pysdl3 = callPackage ../development/python-modules/pysdl3 { }; pysearpc = toPythonModule (pkgs.libsearpc.override { python3 = self.python; }); pysecretsocks = callPackage ../development/python-modules/pysecretsocks { }; Loading