17 buildPythonPackage rec {
22 inherit pname version;
23 sha256 = "1dxxrl4nc7xh3aai1clgzvk48bvd35r7ksirsddz0mwhx7jmm8px";
26 # find_library doesn't reliably work with nix (https://github.com/NixOS/nixpkgs/issues/7307).
27 # Even naively searching `LD_LIBRARY_PATH` won't work since `libc.so` is a linker script and
28 # ctypes.cdll.LoadLibrary cannot deal with those. Therefore, just hardcode the paths to the
29 # necessary libraries.
31 ext = stdenv.hostPlatform.extensions.sharedLibrary;
33 cat > pyglet/lib.py <<EOF
35 def load_library(*names, **kwargs):
39 path = '${libGL}/lib/libGL${ext}'
41 path = '${libGLU}/lib/libGLU${ext}'
43 path = '${glibc}/lib/libc${ext}.6'
45 path = '${xorg.libX11}/lib/libX11${ext}'
46 elif name == 'gdk-x11-2.0':
47 path = '${gtk2-x11}/lib/libgdk-x11-2.0${ext}'
48 elif name == 'gdk_pixbuf-2.0':
49 path = '${gdk-pixbuf}/lib/libgdk_pixbuf-2.0${ext}'
51 path = '${xorg.libXext}/lib/libXext${ext}'
52 elif name == 'fontconfig':
53 path = '${fontconfig.lib}/lib/libfontconfig${ext}'
54 elif name == 'freetype':
55 path = '${freetype}/lib/libfreetype${ext}'
56 elif name[0:2] == 'av' or name[0:2] == 'sw':
57 path = '${ffmpeg-full}/lib/lib' + name + '${ext}'
59 return ctypes.cdll.LoadLibrary(path)
60 raise Exception("Could not load library {}".format(names))
64 propagatedBuildInputs = [ future ];
66 # needs an X server. Keep an eye on
67 # https://bitbucket.org/pyglet/pyglet/issues/219/egl-support-headless-rendering
75 py.test tests/unit tests/integration
79 homepage = "http://www.pyglet.org/";
80 description = "A cross-platform windowing and multimedia library";
81 license = licenses.bsd3;
82 platforms = platforms.mesaPlatforms;