at 22.05-pre 4.5 kB view raw
1diff --git a/sdl2/dll.py b/sdl2/dll.py 2index 6e30259..12e1f7d 100644 3--- a/sdl2/dll.py 4+++ b/sdl2/dll.py 5@@ -145,7 +145,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@@ -157,11 +157,12 @@ class DLL(object): 15 "SDL2_image": 2001, 16 "SDL2_gfx": 1003 17 } 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 = _findlib(libnames, path) 24+ #dllmsg = "PYSDL2_DLL_PATH: %s" % (os.getenv("PYSDL2_DLL_PATH") or "unset") 25+ #if len(foundlibs) == 0: 26+ # raise RuntimeError("could not find any library for %s (%s)" % 27+ # (libinfo, dllmsg)) 28+ foundlibs = [ libfile ] 29 for libfile in foundlibs: 30 try: 31 self._dll = CDLL(libfile) 32@@ -185,19 +186,19 @@ class DLL(object): 33 (foundlibs, libinfo)) 34 if _using_ms_store_python(): 35 self._deps = _preload_deps(libinfo, self._libfile) 36- if path is not None and sys.platform in ("win32",) and \ 37- path in self._libfile: 38- os.environ["PATH"] = "%s;%s" % (path, os.environ["PATH"]) 39+ #if path is not None and sys.platform in ("win32",) and \ 40+ # path in self._libfile: 41+ # os.environ["PATH"] = "%s;%s" % (path, os.environ["PATH"]) 42 43 def bind_function(self, funcname, args=None, returns=None, added=None): 44 """Binds the passed argument and return value types to the specified 45 function. If the version of the loaded library is older than the 46 version where the function was added, an informative exception will 47 be raised if the bound function is called. 48 49 Args: 50 funcname (str): The name of the function to bind. 51 args (List or None, optional): The data types of the C function's 52 arguments. Should be 'None' if function takes no arguments. 53 returns (optional): The return type of the bound C function. Should 54 be 'None' if function returns 'void'. 55@@ -288,7 +289,7 @@ def nullfunc(*args): 56 return 57 58 try: 59- dll = DLL("SDL2", ["SDL2", "SDL2-2.0", "SDL2-2.0.0"], os.getenv("PYSDL2_DLL_PATH")) 60+ dll = DLL("SDL2", "@sdl2@") 61 except RuntimeError as exc: 62 raise ImportError(exc) 63 64diff --git a/sdl2/sdlgfx.py b/sdl2/sdlgfx.py 65index 090752e..a8a7488 100644 66--- a/sdl2/sdlgfx.py 67+++ b/sdl2/sdlgfx.py 68@@ -50,8 +50,7 @@ __all__ = [ 69 70 71 try: 72- dll = DLL("SDL2_gfx", ["SDL2_gfx", "SDL2_gfx-1.0"], 73- os.getenv("PYSDL2_DLL_PATH")) 74+ dll = DLL("SDL2_gfx", "@sdl2_gfx@") 75 except RuntimeError as exc: 76 raise ImportError(exc) 77 78diff --git a/sdl2/sdlimage.py b/sdl2/sdlimage.py 79index a6884e8..95d96df 100644 80--- a/sdl2/sdlimage.py 81+++ b/sdl2/sdlimage.py 82@@ -32,15 +32,14 @@ __all__ = [ 83 "IMG_LoadXCF_RW", "IMG_LoadWEBP_RW", "IMG_LoadXPM_RW", 84 "IMG_LoadXV_RW", "IMG_ReadXPMFromArray", 85 "IMG_GetError", "IMG_SetError", "IMG_SaveJPG", "IMG_SaveJPG_RW", 86- 87+ 88 # Python Functions 89 "get_dll_file" 90 ] 91 92 93 try: 94- dll = DLL("SDL2_image", ["SDL2_image", "SDL2_image-2.0"], 95- os.getenv("PYSDL2_DLL_PATH")) 96+ dll = DLL("SDL2_image", "@sdl2_image@") 97 except RuntimeError as exc: 98 raise ImportError(exc) 99 100diff --git a/sdl2/sdlmixer.py b/sdl2/sdlmixer.py 101index 9ad9b85..1c36289 100644 102--- a/sdl2/sdlmixer.py 103+++ b/sdl2/sdlmixer.py 104@@ -76,8 +76,7 @@ __all__ = [ 105 ] 106 107 try: 108- dll = DLL("SDL2_mixer", ["SDL2_mixer", "SDL2_mixer-2.0"], 109- os.getenv("PYSDL2_DLL_PATH")) 110+ dll = DLL("SDL2_mixer", "@sdl2_mixer@") 111 except RuntimeError as exc: 112 raise ImportError(exc) 113 114diff --git a/sdl2/sdlttf.py b/sdl2/sdlttf.py 115index 9c2d951..bd5a16a 100644 116--- a/sdl2/sdlttf.py 117+++ b/sdl2/sdlttf.py 118@@ -54,8 +54,7 @@ __all__ = [ 119 120 121 try: 122- dll = DLL("SDL2_ttf", ["SDL2_ttf", "SDL2_ttf-2.0"], 123- os.getenv("PYSDL2_DLL_PATH")) 124+ dll = DLL("SDL2_ttf", "@sdl2_ttf@") 125 except RuntimeError as exc: 126 raise ImportError(exc) 127