diff options
Diffstat (limited to 'pkgs/development/python-modules/pyglet/default.nix')
-rw-r--r-- | pkgs/development/python-modules/pyglet/default.nix | 132 |
1 files changed, 67 insertions, 65 deletions
diff --git a/pkgs/development/python-modules/pyglet/default.nix b/pkgs/development/python-modules/pyglet/default.nix index 62c8598f59187..c9493e5c28857 100644 --- a/pkgs/development/python-modules/pyglet/default.nix +++ b/pkgs/development/python-modules/pyglet/default.nix @@ -1,20 +1,22 @@ -{ lib, stdenv -, buildPythonPackage -, fetchPypi -, unzip -, pythonOlder -, libGL -, libGLU -, xorg -, pytestCheckHook -, glibc -, gtk2-x11 -, gdk-pixbuf -, fontconfig -, freetype -, ffmpeg-full -, openal -, libpulseaudio +{ + lib, + stdenv, + buildPythonPackage, + fetchPypi, + unzip, + pythonOlder, + libGL, + libGLU, + xorg, + pytestCheckHook, + glibc, + gtk2-x11, + gdk-pixbuf, + fontconfig, + freetype, + ffmpeg-full, + openal, + libpulseaudio, }: buildPythonPackage rec { @@ -33,51 +35,53 @@ buildPythonPackage rec { # Even naively searching `LD_LIBRARY_PATH` won't work since `libc.so` is a linker script and # ctypes.cdll.LoadLibrary cannot deal with those. Therefore, just hardcode the paths to the # necessary libraries. - postPatch = let - ext = stdenv.hostPlatform.extensions.sharedLibrary; - in '' - cat > pyglet/lib.py <<EOF - import ctypes - def load_library(*names, **kwargs): - for name in names: - path = None - if name == 'GL': - path = '${libGL}/lib/libGL${ext}' - elif name == 'EGL': - path = '${libGL}/lib/libEGL${ext}' - elif name == 'GLU': - path = '${libGLU}/lib/libGLU${ext}' - elif name == 'c': - path = '${glibc}/lib/libc${ext}.6' - elif name == 'X11': - path = '${xorg.libX11}/lib/libX11${ext}' - elif name == 'gdk-x11-2.0': - path = '${gtk2-x11}/lib/libgdk-x11-2.0${ext}' - elif name == 'gdk_pixbuf-2.0': - path = '${gdk-pixbuf}/lib/libgdk_pixbuf-2.0${ext}' - elif name == 'Xext': - path = '${xorg.libXext}/lib/libXext${ext}' - elif name == 'fontconfig': - path = '${fontconfig.lib}/lib/libfontconfig${ext}' - elif name == 'freetype': - path = '${freetype}/lib/libfreetype${ext}' - elif name[0:2] == 'av' or name[0:2] == 'sw': - path = '${ffmpeg-full}/lib/lib' + name + '${ext}' - elif name == 'openal': - path = '${openal}/lib/libopenal${ext}' - elif name == 'pulse': - path = '${libpulseaudio}/lib/libpulse${ext}' - elif name == 'Xi': - path = '${xorg.libXi}/lib/libXi${ext}' - elif name == 'Xinerama': - path = '${xorg.libXinerama}/lib/libXinerama${ext}' - elif name == 'Xxf86vm': - path = '${xorg.libXxf86vm}/lib/libXxf86vm${ext}' - if path is not None: - return ctypes.cdll.LoadLibrary(path) - raise Exception("Could not load library {}".format(names)) - EOF - ''; + postPatch = + let + ext = stdenv.hostPlatform.extensions.sharedLibrary; + in + '' + cat > pyglet/lib.py <<EOF + import ctypes + def load_library(*names, **kwargs): + for name in names: + path = None + if name == 'GL': + path = '${libGL}/lib/libGL${ext}' + elif name == 'EGL': + path = '${libGL}/lib/libEGL${ext}' + elif name == 'GLU': + path = '${libGLU}/lib/libGLU${ext}' + elif name == 'c': + path = '${glibc}/lib/libc${ext}.6' + elif name == 'X11': + path = '${xorg.libX11}/lib/libX11${ext}' + elif name == 'gdk-x11-2.0': + path = '${gtk2-x11}/lib/libgdk-x11-2.0${ext}' + elif name == 'gdk_pixbuf-2.0': + path = '${gdk-pixbuf}/lib/libgdk_pixbuf-2.0${ext}' + elif name == 'Xext': + path = '${xorg.libXext}/lib/libXext${ext}' + elif name == 'fontconfig': + path = '${fontconfig.lib}/lib/libfontconfig${ext}' + elif name == 'freetype': + path = '${freetype}/lib/libfreetype${ext}' + elif name[0:2] == 'av' or name[0:2] == 'sw': + path = '${lib.getLib ffmpeg-full}/lib/lib' + name + '${ext}' + elif name == 'openal': + path = '${openal}/lib/libopenal${ext}' + elif name == 'pulse': + path = '${libpulseaudio}/lib/libpulse${ext}' + elif name == 'Xi': + path = '${xorg.libXi}/lib/libXi${ext}' + elif name == 'Xinerama': + path = '${xorg.libXinerama}/lib/libXinerama${ext}' + elif name == 'Xxf86vm': + path = '${xorg.libXxf86vm}/lib/libXxf86vm${ext}' + if path is not None: + return ctypes.cdll.LoadLibrary(path) + raise Exception("Could not load library {}".format(names)) + EOF + ''; nativeBuildInputs = [ unzip ]; @@ -85,9 +89,7 @@ buildPythonPackage rec { # tests do run and pass in nix-shell, however. doCheck = false; - nativeCheckInputs = [ - pytestCheckHook - ]; + nativeCheckInputs = [ pytestCheckHook ]; preCheck = '' export PYGLET_HEADLESS=True |