Merge branch 'issue138'

This commit is contained in:
John Evans 2013-10-29 10:15:47 -04:00
commit 3299c2e562
4 changed files with 17 additions and 4 deletions

View file

@ -1,3 +1,5 @@
Oct 29, 2013 - v0.5.9 Fixed bad library load on linux as a result of 0.5.8
Oct 29, 2013 - v0.5.8 Fixed unnecessary warnings when default locations for Oct 29, 2013 - v0.5.8 Fixed unnecessary warnings when default locations for
openjpeg libraries on mac do not specify the actual library. openjpeg libraries on mac do not specify the actual library.

View file

@ -78,7 +78,7 @@ copyright = u'2013, John Evans'
# The short X.Y version. # The short X.Y version.
version = '0.5' version = '0.5'
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = '0.5.8' release = '0.5.9'
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.

View file

@ -59,6 +59,7 @@ def load_openjpeg(path):
# If we could not find it, then look in some likely locations on mac # If we could not find it, then look in some likely locations on mac
# and win. # and win.
if path is None: if path is None:
# Could not find a library via ctypes
if platform.system() == 'Darwin': if platform.system() == 'Darwin':
# MacPorts # MacPorts
path = '/opt/local/lib/libopenjpeg.dylib' path = '/opt/local/lib/libopenjpeg.dylib'
@ -66,6 +67,10 @@ def load_openjpeg(path):
path = os.path.join('C:\\', 'Program files', 'OpenJPEG 1.5', path = os.path.join('C:\\', 'Program files', 'OpenJPEG 1.5',
'bin', 'openjpeg.dll') 'bin', 'openjpeg.dll')
if path is not None and not os.path.exists(path):
# the mac/win default location does not exist.
return None
return load_library_handle(path) return load_library_handle(path)
@ -73,10 +78,11 @@ def load_openjp2(path):
"""Load the openjp2 library, falling back on defaults if necessary. """Load the openjp2 library, falling back on defaults if necessary.
""" """
if path is None: if path is None:
# No help from the config file, try to find it ourselves. # No help from the config file, try to find it via ctypes.
path = find_library('openjp2') path = find_library('openjp2')
if path is None: if path is None:
# Could not find a library via ctypes
if platform.system() == 'Darwin': if platform.system() == 'Darwin':
# MacPorts # MacPorts
path = '/opt/local/lib/libopenjp2.dylib' path = '/opt/local/lib/libopenjp2.dylib'
@ -84,15 +90,20 @@ def load_openjp2(path):
path = os.path.join('C:\\', 'Program files', 'OpenJPEG 2.0', path = os.path.join('C:\\', 'Program files', 'OpenJPEG 2.0',
'bin', 'openjp2.dll') 'bin', 'openjp2.dll')
if path is not None and not os.path.exists(path):
# the mac/win default location does not exist.
return None
return load_library_handle(path) return load_library_handle(path)
def load_library_handle(path): def load_library_handle(path):
"""Load the library, return the ctypes handle.""" """Load the library, return the ctypes handle."""
if path is None or (path is not None and not os.path.exists(path)): if path is None:
# Either could not find a library via ctypes or user-configuration-file, # Either could not find a library via ctypes or user-configuration-file,
# or we could not find it in any of the default locations. # or we could not find it in any of the default locations.
# This is probably a very old linux.
return None return None
try: try:

View file

@ -15,7 +15,7 @@ from .lib import openjp2 as opj2
# Do not change the format of this next line! Doing so risks breaking # Do not change the format of this next line! Doing so risks breaking
# setup.py # setup.py
version = "0.5.8" version = "0.5.9"
_sv = LooseVersion(version) _sv = LooseVersion(version)
version_tuple = _sv.version version_tuple = _sv.version