paperwork: fix installing translations (#370379)
[NixPkgs.git] / pkgs / development / python-modules / pysdl2 / PySDL2-dll.patch
blob792c8bcd28e2dbdbe52f18ac8fa5c286add88af1
1 diff --git a/sdl2/dll.py b/sdl2/dll.py
2 index 2413329..f460bf6 100644
3 --- a/sdl2/dll.py
4 +++ b/sdl2/dll.py
5 @@ -235,7 +235,7 @@ class DLL(object):
6 """Function wrapper around the different DLL functions. Do not use or
7 instantiate this one directly from your user code.
8 """
9 - def __init__(self, libinfo, libnames, path=None):
10 + def __init__(self, libinfo, libfile):
11 self._dll = None
12 self._deps = None
13 self._libname = libinfo
14 @@ -247,11 +247,7 @@ class DLL(object):
15 "SDL2_image": (2, 0, 1),
16 "SDL2_gfx": (1, 0, 3)
18 - foundlibs = _findlib(libnames, path)
19 - dllmsg = "PYSDL2_DLL_PATH: %s" % (os.getenv("PYSDL2_DLL_PATH") or "unset")
20 - if len(foundlibs) == 0:
21 - raise RuntimeError("could not find any library for %s (%s)" %
22 - (libinfo, dllmsg))
23 + foundlibs = [ libfile ]
24 for libfile in foundlibs:
25 try:
26 self._dll = CDLL(libfile)
27 @@ -276,9 +272,6 @@ class DLL(object):
28 (foundlibs, libinfo))
29 if _using_ms_store_python():
30 self._deps = _preload_deps(libinfo, self._libfile)
31 - if path is not None and sys.platform in ("win32",) and \
32 - path in self._libfile:
33 - os.environ["PATH"] = "%s;%s" % (path, os.environ["PATH"])
35 def bind_function(self, funcname, args=None, returns=None, added=None):
36 """Binds the passed argument and return value types to the specified
37 @@ -359,7 +352,7 @@ class DLL(object):
38 # Once the DLL class is defined, try loading the main SDL2 library
40 try:
41 - dll = DLL("SDL2", ["SDL2", "SDL2-2.0", "SDL2-2.0.0"], os.getenv("PYSDL2_DLL_PATH"))
42 + dll = DLL("SDL2", "@SDL2@")
43 except RuntimeError as exc:
44 raise ImportError(exc)
46 diff --git a/sdl2/sdlgfx.py b/sdl2/sdlgfx.py
47 index 015eeaf..d6ce52f 100644
48 --- a/sdl2/sdlgfx.py
49 +++ b/sdl2/sdlgfx.py
50 @@ -27,8 +27,7 @@ __all__ = [
53 try:
54 - dll = DLL("SDL2_gfx", ["SDL2_gfx", "SDL2_gfx-1.0"],
55 - os.getenv("PYSDL2_DLL_PATH"))
56 + dll = DLL("SDL2_gfx", "@SDL2_gfx@")
57 except RuntimeError as exc:
58 raise ImportError(exc)
60 diff --git a/sdl2/sdlimage.py b/sdl2/sdlimage.py
61 index a702136..dcdea51 100644
62 --- a/sdl2/sdlimage.py
63 +++ b/sdl2/sdlimage.py
64 @@ -30,9 +30,7 @@ __all__ = [
67 try:
68 - dll = DLL(
69 - "SDL2_image", ["SDL2_image", "SDL2_image-2.0"], os.getenv("PYSDL2_DLL_PATH")
70 - )
71 + dll = DLL("SDL2_image", "@SDL2_image@")
72 except RuntimeError as exc:
73 raise ImportError(exc)
75 diff --git a/sdl2/sdlmixer.py b/sdl2/sdlmixer.py
76 index 5f2163c..23d95b0 100644
77 --- a/sdl2/sdlmixer.py
78 +++ b/sdl2/sdlmixer.py
79 @@ -50,8 +50,7 @@ __all__ = [
82 try:
83 - dll = DLL("SDL2_mixer", ["SDL2_mixer", "SDL2_mixer-2.0"],
84 - os.getenv("PYSDL2_DLL_PATH"))
85 + dll = DLL("SDL2_mixer", "@SDL2_mixer@")
86 except RuntimeError as exc:
87 raise ImportError(exc)
89 diff --git a/sdl2/sdlttf.py b/sdl2/sdlttf.py
90 index 7c5f7db..61814cd 100644
91 --- a/sdl2/sdlttf.py
92 +++ b/sdl2/sdlttf.py
93 @@ -41,8 +41,7 @@ __all__ = [
96 try:
97 - dll = DLL("SDL2_ttf", ["SDL2_ttf", "SDL2_ttf-2.0"],
98 - os.getenv("PYSDL2_DLL_PATH"))
99 + dll = DLL("SDL2_ttf", "@SDL2_ttf@")
100 except RuntimeError as exc:
101 raise ImportError(exc)