Merge branch 'issue91' into devel
This commit is contained in:
commit
8f37579ffc
13 changed files with 62 additions and 31 deletions
|
|
@ -1,3 +1,6 @@
|
|||
Jul 25, 2013 - v0.2.7 Warns but no longer errors out when neither library is
|
||||
found (issue89).
|
||||
|
||||
Jul 24, 2013 - v0.2.6 No longer warning when configuration file not found.
|
||||
Added read support for jpch, jplh boxes. Added testing of files in
|
||||
format-corpus repository.
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ copyright = u'2013, John Evans'
|
|||
# The short X.Y version.
|
||||
version = '0.2'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '0.2.6'
|
||||
release = '0.2.7'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
----------------------------------
|
||||
Detailed Installation Instructions
|
||||
Advanced Installation Instructions
|
||||
----------------------------------
|
||||
|
||||
''''''''''''''''''''''
|
||||
|
|
@ -30,8 +30,22 @@ configparser module, i.e. ::
|
|||
openjp2: /opt/openjp2-svn/lib/libopenjp2.so
|
||||
|
||||
This assumes, of course, that you've installed OpenJPEG into
|
||||
/opt/openjp2-svn on a linux system. You may also substitute
|
||||
**$XDG_CONFIG_HOME** for **$HOME/.config**.
|
||||
/opt/openjp2-svn on a linux system. The location of the configuration file
|
||||
is platform-dependent (of course). If you use either linux or mac, the path
|
||||
to the configuration file would normally be ::
|
||||
|
||||
$HOME/.config/glymur/glymurrc
|
||||
|
||||
but if you have **$XDG_CONFIG_HOME** defined, the path will be ::
|
||||
|
||||
$XDG_CONFIG_HOME/glymur/glymurrc
|
||||
|
||||
On windows, the path to the configuration file can be determined by starting up Python
|
||||
and typing ::
|
||||
|
||||
import os
|
||||
os.path.join(os.path.expanduser('~'), 'glymur', 'glymurrc')
|
||||
|
||||
|
||||
You may also include a line for the version 1.x openjpeg library if you have it
|
||||
installed in a non-standard place, i.e. ::
|
||||
|
|
@ -124,12 +138,11 @@ In addition, you must install contextlib2 and Pillow via pip. ::
|
|||
|
||||
Windows
|
||||
-------
|
||||
The only configuration I've tested is Python(xy), which uses Python 2.7.
|
||||
Python(xy) already comes with numpy, but you will have to install pip and then
|
||||
contextlib2 and mock as well. Glymur seems to work with both 1.5.1 and the
|
||||
svn development versions of openjpeg.
|
||||
I would recommend using WinPython, but Python(xy) also seems to work. WinPython 3.3
|
||||
should work with no additional installations required, but 2.7 versions still require
|
||||
contextlib2 and mock to be installed via pip.
|
||||
|
||||
Glymur has been tested **far less** extensively on Windows than on the other
|
||||
Glymur has been tested far less extensively on Windows than on the other
|
||||
platforms.
|
||||
|
||||
|
||||
|
|
@ -141,7 +154,7 @@ There are two environment variables you may wish to set before running the
|
|||
tests.
|
||||
|
||||
* **OPJ_DATA_ROOT** - points to directory for OpenJPEG test data
|
||||
* **FORMAT_CORPUS_ROOT** - points to directory for format-corpus repository (see https://github.com/openplanets/format-corpus)
|
||||
* **FORMAT_CORPUS_ROOT** - points to directory for format-corpus repository (see https://github.com/openplanets/format-corpus if you wish, but you really don't need to bother with this)
|
||||
|
||||
Setting these two environment variables is not required, as any tests using
|
||||
either of them will be skipped.
|
||||
|
|
|
|||
|
|
@ -140,7 +140,6 @@ class Codestream(object):
|
|||
|
||||
fptr.seek(self._tile_offset[-1] + self._tile_length[-1])
|
||||
|
||||
|
||||
def _process_marker_segment(self, fptr, marker_id):
|
||||
"""Process and return a segment from the codestream.
|
||||
"""
|
||||
|
|
@ -207,7 +206,8 @@ class Codestream(object):
|
|||
segment = _parse_sot_segment(fptr)
|
||||
self._tile_offset.append(segment.offset)
|
||||
if segment.psot == 0:
|
||||
tile_part_length = self.offset + self.length - segment.offset - 2
|
||||
tile_part_length = (self.offset + self.length -
|
||||
segment.offset - 2)
|
||||
else:
|
||||
tile_part_length = segment.psot
|
||||
self._tile_length.append(tile_part_length)
|
||||
|
|
|
|||
|
|
@ -571,7 +571,7 @@ class CodestreamHeaderBox(Jp2kBox):
|
|||
"""
|
||||
box = CodestreamHeaderBox(length=length, offset=offset)
|
||||
|
||||
# The codestream header box is a superbox, so go ahead and parse its
|
||||
# The codestream header box is a superbox, so go ahead and parse its
|
||||
# child boxes.
|
||||
box.box = box.parse_superbox(fptr)
|
||||
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ class Jp2k(Jp2kBox):
|
|||
if ftyp.brand == 'jp2 ':
|
||||
jp2h = [box for box in self.box if box.box_id == 'jp2h'][0]
|
||||
colrs = [box for box in jp2h.box if box.box_id == 'colr']
|
||||
for colr in colrs:
|
||||
for colr in colrs:
|
||||
if colr.method not in (ENUMERATED_COLORSPACE,
|
||||
RESTRICTED_ICC_PROFILE):
|
||||
msg = "Color Specification box method must specify either "
|
||||
|
|
@ -178,7 +178,6 @@ class Jp2k(Jp2kBox):
|
|||
msg += "profile if the file type box brand is 'jp2 '."
|
||||
warnings.warn(msg)
|
||||
|
||||
|
||||
# pylint: disable-msg=W0221
|
||||
def write(self, img_array, cratios=None, eph=False, psnr=None, numres=None,
|
||||
cbsize=None, psizes=None, grid_offset=None, sop=False,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
"""This package organizes individual libraries employed by glymur."""
|
||||
from . import openjp2 as _openjp2
|
||||
from . import openjpeg as _openjpeg
|
||||
#from . import test
|
||||
|
|
|
|||
|
|
@ -58,6 +58,9 @@ def load_openjpeg(libopenjpeg_path):
|
|||
'bin', 'openjpeg.dll')
|
||||
if os.path.exists(path):
|
||||
libopenjpeg_path = path
|
||||
else:
|
||||
# No sense trying further on Linux
|
||||
return None
|
||||
|
||||
try:
|
||||
if os.name == "nt":
|
||||
|
|
@ -124,6 +127,10 @@ def glymur_config():
|
|||
libs = read_config_file()
|
||||
libopenjp2_handle = load_openjp2(libs['openjp2'])
|
||||
libopenjpeg_handle = load_openjpeg(libs['openjpeg'])
|
||||
if libopenjp2_handle is None and libopenjpeg_handle is None:
|
||||
msg = "Neither the openjp2 nor the openjpeg library could be loaded. "
|
||||
msg += "Operating in severely degraded mode."
|
||||
warnings.warn(msg, UserWarning)
|
||||
return libopenjp2_handle, libopenjpeg_handle
|
||||
|
||||
|
||||
|
|
@ -136,10 +143,11 @@ def get_configdir():
|
|||
if 'XDG_CONFIG_HOME' in os.environ:
|
||||
return os.path.join(os.environ['XDG_CONFIG_HOME'], 'glymur')
|
||||
|
||||
if 'HOME' in os.environ:
|
||||
if 'HOME' in os.environ and os.name != 'nt':
|
||||
# HOME is set by WinPython to something unusual, so we don't
|
||||
# want that.
|
||||
return os.path.join(os.environ['HOME'], '.config', 'glymur')
|
||||
|
||||
if 'USERPROFILE' in os.environ:
|
||||
# Windows?
|
||||
return os.path.join(os.environ['USERPROFILE'], 'Application Data',
|
||||
'glymur')
|
||||
if os.name == 'nt':
|
||||
# Windows.
|
||||
return os.path.join(os.path.expanduser('~'), 'glymur')
|
||||
|
|
|
|||
|
|
@ -22,8 +22,15 @@ def version():
|
|||
return library_version
|
||||
|
||||
# Need to get the minor version, make sure we are at least at 1.4.x
|
||||
#import pdb; pdb.set_trace()
|
||||
_MINOR = version().split('.')[1]
|
||||
if OPENJPEG is not None:
|
||||
_MINOR = version().split('.')[1]
|
||||
else:
|
||||
# Does not really matter. But version should not be called if there is no
|
||||
# OpenJPEG library found.
|
||||
_MINOR = 0
|
||||
# Redefine version so that we can use it.
|
||||
def version():
|
||||
return '0.0.0'
|
||||
|
||||
|
||||
class EventMgrType(ctypes.Structure):
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class TestSuiteFormatCorpus(unittest.TestCase):
|
|||
j2k = Jp2k(jfile)
|
||||
with self.assertWarns(UserWarning):
|
||||
c = j2k.get_codestream(header_only=False)
|
||||
|
||||
|
||||
# The last segment is truncated, so there should not be an EOC marker.
|
||||
self.assertNotEqual(c.segment[-1].marker_id, 'EOC')
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ class TestSuiteFormatCorpus(unittest.TestCase):
|
|||
j2k = Jp2k(jfile)
|
||||
with self.assertWarns(UserWarning):
|
||||
c = j2k.get_codestream(header_only=False)
|
||||
|
||||
|
||||
# The last segment is truncated, so there should not be an EOC marker.
|
||||
self.assertNotEqual(c.segment[-1].marker_id, 'EOC')
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ class TestSuiteFormatCorpus(unittest.TestCase):
|
|||
j2k = Jp2k(jfile)
|
||||
with self.assertWarns(UserWarning):
|
||||
c = j2k.get_codestream(header_only=False)
|
||||
|
||||
|
||||
# The last segment is truncated, so there should not be an EOC marker.
|
||||
self.assertNotEqual(c.segment[-1].marker_id, 'EOC')
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ class TestSuiteFormatCorpus(unittest.TestCase):
|
|||
'balloon_eciRGBv2_ps_adobeplugin.jpf')
|
||||
with self.assertWarns(UserWarning):
|
||||
j2k = Jp2k(jfile)
|
||||
|
||||
|
||||
def test_jp2_brand_vs_any_icc_profile_multiple_colr(self):
|
||||
# Has colr box, one that conforms, one that does not.
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ class TestSuiteFormatCorpus(unittest.TestCase):
|
|||
jfile = os.path.join(*lst)
|
||||
with self.assertWarns(UserWarning):
|
||||
j2k = Jp2k(jfile)
|
||||
|
||||
|
||||
|
||||
@unittest.skipIf(opj_data_root is None,
|
||||
"OPJ_DATA_ROOT environment variable not set")
|
||||
|
|
@ -124,6 +124,6 @@ class TestSuiteOpj(unittest.TestCase):
|
|||
'input/nonregression/text_GBR.jp2')
|
||||
with self.assertWarns(UserWarning):
|
||||
j2k = Jp2k(filename)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
|||
|
|
@ -47,6 +47,9 @@ def load_tests(loader, tests, ignore):
|
|||
return tests
|
||||
|
||||
|
||||
@unittest.skipIf(glymur.lib.openjp2.OPENJP2 is None and
|
||||
glymur.lib.openjpeg.OPENJPEG is None,
|
||||
"Missing openjp2 library.")
|
||||
class TestConfig(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
|||
|
|
@ -832,7 +832,6 @@ class TestSuite(unittest.TestCase):
|
|||
data = Jp2k(jfile).read()
|
||||
self.assertTrue(True)
|
||||
|
||||
|
||||
@unittest.skipIf(sys.hexversion < 0x03020000,
|
||||
"Uses features introduced in 3.2.")
|
||||
def test_NR_DEC_broken3_jp2_6_decode(self):
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|||
import sys
|
||||
|
||||
kwargs = {'name': 'Glymur',
|
||||
'version': '0.2.6',
|
||||
'version': '0.2.7',
|
||||
'description': 'Tools for accessing JPEG2000 files',
|
||||
'long_description': open('README.md').read(),
|
||||
'author': 'John Evans',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue