|
15 | 15 |
|
16 | 16 | __version__ = "2.3.3" |
17 | 17 |
|
18 | | -if sys.platform.startswith('win'): |
19 | | - # This only works for Anaconda / miniconda |
20 | | - # On other systems, logic needs to be added here. |
21 | | - libpath = os.path.join(os.path.split(sys.executable)[0], "Library", "bin") |
22 | | - |
23 | | - # UGLY kludge for Windows: load the libgd dll with ctypes so it can be used by the extension |
24 | | - # import ctypes |
25 | | - # # note: need to load up the dependencies, too |
26 | | - # # this is a serious kludge! |
27 | | - # try: |
28 | | - # libpng = ctypes.cdll.LoadLibrary(os.path.join(libpath,'libpng16.dll')) |
29 | | - # zlib = ctypes.cdll.LoadLibrary(os.path.join(libpath,'zlib.dll')) |
30 | | - # libgd = ctypes.cdll.LoadLibrary(os.path.join(libpath,'libgd.dll')) |
31 | | - # except WindowsError as err: |
32 | | - # raise WindowsError("Can't find dlls for libgd, libpng, and libz.\n" |
33 | | - # "This kludge is only written to support Anaconda installs") |
34 | | - |
35 | | - # alternative ugly kludge: add lib dir to PATH: |
36 | | - if (os.path.isfile(os.path.join(libpath, 'libpng16.dll')) and |
37 | | - os.path.isfile(os.path.join(libpath, 'zlib.dll')) and |
38 | | - os.path.isfile(os.path.join(libpath, 'libgd.dll'))): |
39 | | - os.environ['PATH'] = libpath + os.pathsep + os.environ['PATH'] |
40 | | - |
41 | | - # raise RuntimeError("Can't find dlls for libgd, libpng, and libz.\n" |
42 | | - # "This kludge is only written to support Anaconda installs\n", |
43 | | - # "you may need to add some logic for other library locations", |
44 | | - # ) |
45 | 18 | try: |
46 | 19 | from .py_gd import * # noqa: F401 |
47 | | - |
48 | 20 | except ImportError as err: |
49 | 21 | if str(err).startswith("DLL load failed:"): |
50 | | - if not (os.path.isfile(os.path.join(libpath, 'libpng16.dll')) and |
51 | | - os.path.isfile(os.path.join(libpath, 'zlib.dll')) and |
52 | | - os.path.isfile(os.path.join(libpath, 'libgd.dll'))): |
53 | | - raise RuntimeError("Can't find dlls for libgd, libpng, and libz.\n" |
54 | | - "This kludge is only written to support Anaconda installs\n", |
55 | | - "you may need to add some logic for other library locations", |
56 | | - ) |
57 | | - else: |
58 | | - raise |
| 22 | + raise RuntimeError("Can't find dlls for libgd, libpng, and/or libz.\n" |
| 23 | + "This kludge is only written to support Anaconda installs\n", |
| 24 | + "you may need to add some logic for other library locations", |
| 25 | + ) from err |
59 | 26 | else: |
60 | 27 | raise |
61 | | - print(err.args) |
0 commit comments