Merge branch 'issue265' into devel
This commit is contained in:
commit
6035517831
2 changed files with 11 additions and 15 deletions
|
|
@ -73,7 +73,6 @@ def load_openjpeg(path):
|
||||||
|
|
||||||
return load_library_handle(path)
|
return load_library_handle(path)
|
||||||
|
|
||||||
|
|
||||||
def load_openjp2(path):
|
def load_openjp2(path):
|
||||||
"""Load the openjp2 library, falling back on defaults if necessary.
|
"""Load the openjp2 library, falling back on defaults if necessary.
|
||||||
"""
|
"""
|
||||||
|
|
@ -100,7 +99,7 @@ def load_openjp2(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:
|
if path is None or path in ['None', '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.
|
# This is probably a very old linux.
|
||||||
|
|
@ -130,14 +129,11 @@ def read_config_file():
|
||||||
# Read the configuration file for the library location.
|
# Read the configuration file for the library location.
|
||||||
parser = ConfigParser()
|
parser = ConfigParser()
|
||||||
parser.read(filename)
|
parser.read(filename)
|
||||||
try:
|
for name in ['openjp2', 'openjpeg']:
|
||||||
lib['openjp2'] = parser.get('library', 'openjp2')
|
try:
|
||||||
except NoOptionError:
|
lib[name] = parser.get('library', name)
|
||||||
pass
|
except NoOptionError:
|
||||||
try:
|
pass
|
||||||
lib['openjpeg'] = parser.get('library', 'openjpeg')
|
|
||||||
except NoOptionError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return lib
|
return lib
|
||||||
|
|
||||||
|
|
@ -150,8 +146,7 @@ def glymur_config():
|
||||||
libopenjpeg_handle = load_openjpeg(libs['openjpeg'])
|
libopenjpeg_handle = load_openjpeg(libs['openjpeg'])
|
||||||
if libopenjp2_handle is None and libopenjpeg_handle is None:
|
if libopenjp2_handle is None and libopenjpeg_handle is None:
|
||||||
msg = "Neither the openjp2 nor the openjpeg library could be loaded. "
|
msg = "Neither the openjp2 nor the openjpeg library could be loaded. "
|
||||||
msg += "Operating in severely degraded mode."
|
raise IOError(msg)
|
||||||
warnings.warn(msg, UserWarning)
|
|
||||||
return libopenjp2_handle, libopenjpeg_handle
|
return libopenjp2_handle, libopenjpeg_handle
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,9 @@ from .fixtures import opj_data_file
|
||||||
from .fixtures import WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG
|
from .fixtures import WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG
|
||||||
from . import fixtures
|
from . import fixtures
|
||||||
|
|
||||||
from glymur import Jp2k
|
|
||||||
import glymur
|
import glymur
|
||||||
|
from glymur import Jp2k
|
||||||
|
from glymur.codestream import SIZsegment
|
||||||
|
|
||||||
class CinemaBase(fixtures.MetadataBase):
|
class CinemaBase(fixtures.MetadataBase):
|
||||||
|
|
||||||
|
|
@ -45,7 +46,7 @@ class CinemaBase(fixtures.MetadataBase):
|
||||||
'xytsiz': image_size, 'xytosiz': (0, 0),
|
'xytsiz': image_size, 'xytosiz': (0, 0),
|
||||||
'bitdepth': (12, 12, 12), 'signed': (False, False, False),
|
'bitdepth': (12, 12, 12), 'signed': (False, False, False),
|
||||||
'xyrsiz': [(1, 1, 1), (1, 1, 1)]}
|
'xyrsiz': [(1, 1, 1), (1, 1, 1)]}
|
||||||
self.verifySizSegment(c.segment[1], glymur.codestream.SIZsegment(**kwargs))
|
self.verifySizSegment(codestream.segment[1], SIZsegment(**kwargs))
|
||||||
|
|
||||||
self.verify_cinema_cod(codestream.segment[2])
|
self.verify_cinema_cod(codestream.segment[2])
|
||||||
|
|
||||||
|
|
@ -55,7 +56,7 @@ class CinemaBase(fixtures.MetadataBase):
|
||||||
'xytsiz': image_size, 'xytosiz': (0, 0),
|
'xytsiz': image_size, 'xytosiz': (0, 0),
|
||||||
'bitdepth': (12, 12, 12), 'signed': (False, False, False),
|
'bitdepth': (12, 12, 12), 'signed': (False, False, False),
|
||||||
'xyrsiz': [(1, 1, 1), (1, 1, 1)]}
|
'xyrsiz': [(1, 1, 1), (1, 1, 1)]}
|
||||||
self.verifySizSegment(c.segment[1], glymur.codestream.SIZsegment(**kwargs))
|
self.verifySizSegment(codestream.segment[1], SIZsegment(**kwargs))
|
||||||
|
|
||||||
self.verify_cinema_cod(codestream.segment[2])
|
self.verify_cinema_cod(codestream.segment[2])
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue