diff --git a/CHANGES.txt b/CHANGES.txt index 758941b..a3179f6 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,6 @@ +Nov 18, 2014 - v0.7.3 Added read support back for metadata when the + library is not installed. + Oct 06, 2014 - v0.7.2 Added ellipsis support in array-style slicing. Oct 02, 2014 - v0.7.1 Fixed README to mention Python 3.4 diff --git a/docs/source/conf.py b/docs/source/conf.py index 8a87a64..9704a89 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -78,7 +78,7 @@ copyright = u'2013, John Evans' # The short X.Y version. version = '0.7' # The full version, including alpha/beta/rc tags. -release = '0.7.2' +release = '0.7.3' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/source/detailed_installation.rst b/docs/source/detailed_installation.rst index 1a9281c..2401048 100644 --- a/docs/source/detailed_installation.rst +++ b/docs/source/detailed_installation.rst @@ -6,7 +6,7 @@ Advanced Installation Instructions Glymur Configuration '''''''''''''''''''''' -The default glymur installation process relies upon OpenJPEG being +The default glymur installation process expects OpenJPEG to be properly installed on your system as a shared library. If you have OpenJPEG installed through your system’s package manager on linux or if you use MacPorts on the mac, you are probably already set to @@ -50,6 +50,9 @@ installed in a non-standard place, i.e. :: [library] openjpeg: /somewhere/lib/libopenjpeg.so +If your platform is windows, it is strongly recommended that you compile the +2.1.0 version of the openjpeg library from source. + ''''''' Testing ''''''' diff --git a/docs/source/roadmap.rst b/docs/source/roadmap.rst index 503fbc4..f0d7017 100644 --- a/docs/source/roadmap.rst +++ b/docs/source/roadmap.rst @@ -1,12 +1,3 @@ -------------------------------------- -Platforms Tested (0.7.0 release only) -------------------------------------- - * Linux Mint 17 / Python 3.4.0 and 2.7.6 / OpenJPEG 2.1.0 and 1.3.0 - * MacOS 10.6.8 / MacPorts Python 3.4.1, 3.3.5,and 2.7.8 / OpenJPEG 2.1.0 - * CentOS 6.5 / Anaconda Python 3.4.1 / OpenJPEG 1.3.0 - * Fedora 20 i386 / Python 2.7.5 and 3.3.2 / OpenJPEG 1.5.1 - * Windows 7 32bit / Anaconda Python 2.7.6 and 3.4.1 / OpenJPEG 2.1.0 - ------------ Known Issues ------------ diff --git a/docs/source/whatsnew/0.7.rst b/docs/source/whatsnew/0.7.rst index 0a21d9b..e3a541d 100644 --- a/docs/source/whatsnew/0.7.rst +++ b/docs/source/whatsnew/0.7.rst @@ -2,10 +2,22 @@ Changes in glymur 0.7 ===================== +Changes in 0.7.3 +================= + * added read support back for metadata only when the OpenJPEG library is not installed + +Changes in 0.7.2 +================= + * added ellipsis support in array-style slicing + +Changes in 0.7.1 +================= + * fixed release notes regarding Python 3.4 + Changes in 0.7.0 ================= - * implemented :py:meth:`__getitem__`, :py:meth:`__setitem__` support + * implemented array-style slicing * added back windows support * box_id and longname are class attributes now instead of instance - attributes (see issue 248) + attributes diff --git a/docs/source/whatsnew/index.rst b/docs/source/whatsnew/index.rst index 2d69949..38d0435 100644 --- a/docs/source/whatsnew/index.rst +++ b/docs/source/whatsnew/index.rst @@ -8,6 +8,6 @@ These document the changes between minor (or major) versions of glymur. .. toctree:: - 0.5 - 0.6 0.7 + 0.6 + 0.5 diff --git a/glymur/jp2k.py b/glymur/jp2k.py index d460ea6..e4a1a01 100644 --- a/glymur/jp2k.py +++ b/glymur/jp2k.py @@ -937,10 +937,8 @@ class Jp2k(Jp2kBox): elif opj.OPENJPEG is not None: img = self._read_openjpeg(**kwargs) else: - raise LibraryNotFoundError("You must have either a recent version " - "of OpenJPEG or the development " - "version of OpenJP2 installed before " - "using this functionality.") + raise LibraryNotFoundError("You must have OpenJPEG installed " + "before reading a JPEG2000 image.") return img def _subsampling_sanity_check(self): @@ -1235,8 +1233,8 @@ class Jp2k(Jp2kBox): """ if version.openjpeg_version_tuple[0] < 2: raise LibraryNotFoundError("You must have at least version 2.0.0 " - "of OpenJP2 installed before using " - "this functionality.") + "of OpenJPEG installed before using " + "read_bands.") dparam = self._populate_dparam(rlevel, ignore_pclr_cmap_cdef, layer=layer, tile=tile, area=area) diff --git a/glymur/lib/config.py b/glymur/lib/config.py index 04aece2..dc8ab29 100644 --- a/glymur/lib/config.py +++ b/glymur/lib/config.py @@ -146,7 +146,7 @@ def glymur_config(): 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. " - raise IOError(msg) + warnings.warn(msg, UserWarning) return libopenjp2_handle, libopenjpeg_handle diff --git a/glymur/test/fixtures.py b/glymur/test/fixtures.py index 838756a..417797f 100644 --- a/glymur/test/fixtures.py +++ b/glymur/test/fixtures.py @@ -13,6 +13,15 @@ import six import glymur +# If openjpeg is not installed, many tests cannot be run. +if glymur.version.openjpeg_version == "0.0.0": + OPENJPEG_NOT_AVAILABLE = True + OPENJPEG_NOT_AVAILABLE_MSG = "OpenJPEG library not installed" +else: + OPENJPEG_NOT_AVAILABLE = False + OPENJPEG_NOT_AVAILABLE_MSG = None + + # Some versions of "six" on python3 cause problems when verifying warnings. # Only use when the version is 1.7 or higher. # And moreover, we only test using the 3.x infrastructure, never on 2.x. diff --git a/glymur/test/test_jp2box.py b/glymur/test/test_jp2box.py index 061ad23..bf10900 100644 --- a/glymur/test/test_jp2box.py +++ b/glymur/test/test_jp2box.py @@ -34,6 +34,7 @@ from glymur.jp2box import FileTypeBox, ImageHeaderBox, JP2HeaderBox from glymur.jp2box import JPEG2000SignatureBox from glymur.core import COLOR, OPACITY from glymur.core import RED, GREEN, BLUE, GREY, WHOLE_IMAGE +from glymur.version import openjpeg_version from .fixtures import ( WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG, @@ -54,6 +55,8 @@ def load_tests(loader, tests, ignore): tests.addTests(doctest.DocTestSuite('glymur.jp2box')) return tests +@unittest.skipIf(re.match('0|1.[0-2]', openjpeg_version) is not None, + "Not supported with OpenJPEG {0}".format(openjpeg_version)) @unittest.skipIf(os.name == "nt", "Temporary file issue on window.") class TestDataEntryURL(unittest.TestCase): """Test suite for DataEntryURL boxes.""" @@ -119,7 +122,7 @@ class TestDataEntryURL(unittest.TestCase): self.assertEqual(url + chr(0), read_url) -@unittest.skipIf(re.match(r'''(1|2.0.0)''', +@unittest.skipIf(re.match(r'''0|1|2.0.0''', glymur.version.openjpeg_version) is not None, "Not supported until 2.1") @unittest.skipIf(os.name == "nt", "Temporary file issue on window.") diff --git a/glymur/test/test_jp2k.py b/glymur/test/test_jp2k.py index 042a681..02e850a 100644 --- a/glymur/test/test_jp2k.py +++ b/glymur/test/test_jp2k.py @@ -54,6 +54,8 @@ def load_tests(loader, tests, ignore): return tests +@unittest.skipIf(fixtures.OPENJPEG_NOT_AVAILABLE, + fixtures.OPENJPEG_NOT_AVAILABLE_MSG) class SliceProtocolBase(unittest.TestCase): """ Test slice protocol, i.e. when using [ ] to read image data. @@ -309,6 +311,8 @@ class TestSliceProtocolRead(SliceProtocolBase): expected = self.j2k.read(area=(5, 27, 533, 423), rlevel=5) np.testing.assert_array_equal(actual, expected) +@unittest.skipIf(fixtures.OPENJPEG_NOT_AVAILABLE, + fixtures.OPENJPEG_NOT_AVAILABLE_MSG) @unittest.skipIf(OPJ_DATA_ROOT is None, "OPJ_DATA_ROOT environment variable not set") class TestSliceProtocolOpjData(unittest.TestCase): @@ -460,6 +464,8 @@ class TestSliceProtocolOpjData(unittest.TestCase): expected = self.j2k_quarter_data[5:13, 38:50] np.testing.assert_array_equal(actual, expected) +@unittest.skipIf(fixtures.OPENJPEG_NOT_AVAILABLE, + fixtures.OPENJPEG_NOT_AVAILABLE_MSG) class TestJp2k(unittest.TestCase): """These tests should be run by just about all configuration.""" @@ -488,7 +494,7 @@ class TestJp2k(unittest.TestCase): actdata = j2.read() self.assertTrue(fixtures.mse(actdata[0], expdata[0]) < 0.38) - @unittest.skipIf(re.match('1.[0-4]', openjpeg_version) is not None, + @unittest.skipIf(re.match('0|1.[0-4]', openjpeg_version) is not None, "Not supported with OpenJPEG {0}".format(openjpeg_version)) @unittest.skipIf(re.match('1.5.(1|2)', openjpeg_version) is not None, "Mysteriously fails in 1.5.1 and 1.5.2") @@ -820,7 +826,7 @@ class TestJp2k(unittest.TestCase): self.assertEqual(data.shape, (1024, 1024, 3)) -@unittest.skipIf(re.match('1.[0-4]', openjpeg_version) is not None, +@unittest.skipIf(re.match('0|1.[0-4]', openjpeg_version) is not None, "Not supported with OpenJPEG {0}".format(openjpeg_version)) @unittest.skipIf(os.name == "nt", "NamedTemporaryFile issue on windows") class TestJp2k_write(unittest.TestCase): @@ -966,6 +972,8 @@ class TestJp2k_write(unittest.TestCase): self.assertEqual(codestream.segment[2].spcod[0], glymur.core.CPRL) +@unittest.skipIf(fixtures.OPENJPEG_NOT_AVAILABLE, + fixtures.OPENJPEG_NOT_AVAILABLE_MSG) @unittest.skipIf(glymur.version.openjpeg_version_tuple[0] >= 2, "Negative tests only for version 1.x") class TestJp2k_1_x(unittest.TestCase): @@ -1092,7 +1100,7 @@ class TestJp2k_2_0(unittest.TestCase): self.assertEqual(jasoc.box[3].box[1].box_id, 'xml ') -@unittest.skipIf(re.match(r'''(1|2.0.0)''', +@unittest.skipIf(re.match(r'''0|1|2.0.0''', glymur.version.openjpeg_version) is not None, "Not to be run until unless 2.0.1 or higher is present") class TestJp2k_2_1(unittest.TestCase): @@ -1290,6 +1298,8 @@ class TestJp2kOpjDataRoot(unittest.TestCase): rgb_from_idx[r, c] = palette[idx[r, c]] np.testing.assert_array_equal(rgb, rgb_from_idx) + @unittest.skipIf(fixtures.OPENJPEG_NOT_AVAILABLE, + fixtures.OPENJPEG_NOT_AVAILABLE_MSG) def test_read_differing_subsamples(self): """should error out with read used on differently subsampled images""" # Verify that we error out appropriately if we use the read method diff --git a/glymur/test/test_opj_suite.py b/glymur/test/test_opj_suite.py index a033aae..8eb5956 100644 --- a/glymur/test/test_opj_suite.py +++ b/glymur/test/test_opj_suite.py @@ -37,6 +37,7 @@ import glymur from glymur import Jp2k from glymur.jp2box import FileTypeBox, ImageHeaderBox, ColourSpecificationBox +from . import fixtures from .fixtures import ( OPJ_DATA_ROOT, MetadataBase, WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG, @@ -44,6 +45,8 @@ from .fixtures import ( ) +@unittest.skipIf(fixtures.OPENJPEG_NOT_AVAILABLE, + fixtures.OPENJPEG_NOT_AVAILABLE_MSG) @unittest.skipIf(OPJ_DATA_ROOT is None, "OPJ_DATA_ROOT environment variable not set") class TestSuite(unittest.TestCase): @@ -479,6 +482,8 @@ class TestSuiteWarns(MetadataBase): self.assertTrue(True) +@unittest.skipIf(fixtures.OPENJPEG_NOT_AVAILABLE, + fixtures.OPENJPEG_NOT_AVAILABLE_MSG) @unittest.skipIf(OPJ_DATA_ROOT is None, "OPJ_DATA_ROOT environment variable not set") @unittest.skipIf(glymur.version.openjpeg_version_tuple[0] == 1, @@ -574,6 +579,8 @@ class TestSuiteBands(unittest.TestCase): self.assertTrue(True) +@unittest.skipIf(fixtures.OPENJPEG_NOT_AVAILABLE, + fixtures.OPENJPEG_NOT_AVAILABLE_MSG) @unittest.skipIf(OPJ_DATA_ROOT is None, "OPJ_DATA_ROOT environment variable not set") @unittest.skipIf(glymur.version.openjpeg_version_tuple[0] == 1, diff --git a/glymur/test/test_opj_suite_2p1.py b/glymur/test/test_opj_suite_2p1.py index addc48b..4977a6e 100644 --- a/glymur/test/test_opj_suite_2p1.py +++ b/glymur/test/test_opj_suite_2p1.py @@ -36,11 +36,14 @@ import numpy as np from glymur import Jp2k import glymur +from . import fixtures from .fixtures import OPJ_DATA_ROOT from .fixtures import WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG from .fixtures import mse, peak_tolerance, read_pgx, opj_data_file +@unittest.skipIf(fixtures.OPENJPEG_NOT_AVAILABLE, + fixtures.OPENJPEG_NOT_AVAILABLE_MSG) @unittest.skipIf(OPJ_DATA_ROOT is None, "OPJ_DATA_ROOT environment variable not set") @unittest.skipIf(re.match(r'''(1|2.0.0)''', @@ -163,6 +166,8 @@ class TestSuite2point1(unittest.TestCase): with self.assertRaises(IOError): j.read() +@unittest.skipIf(fixtures.OPENJPEG_NOT_AVAILABLE, + fixtures.OPENJPEG_NOT_AVAILABLE_MSG) @unittest.skipIf(OPJ_DATA_ROOT is None, "OPJ_DATA_ROOT environment variable not set") @unittest.skipIf(re.match(r'''(1|2.0.0)''', diff --git a/glymur/test/test_printing.py b/glymur/test/test_printing.py index 49bbe6d..187a15b 100644 --- a/glymur/test/test_printing.py +++ b/glymur/test/test_printing.py @@ -31,6 +31,8 @@ import lxml.etree as ET import glymur from glymur import Jp2k, command_line +from glymur.version import openjpeg_version + from . import fixtures from .fixtures import OPJ_DATA_ROOT, opj_data_file from .fixtures import WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG @@ -106,6 +108,8 @@ class TestPrinting(unittest.TestCase): with self.assertRaises(TypeError): glymur.set_printoptions(hi='low') + @unittest.skipIf(re.match('0|1.[0-4]', openjpeg_version) is not None, + "Not supported with OpenJPEG {0}".format(openjpeg_version)) def test_asoc_label_box(self): """verify printing of asoc, label boxes""" # Construct a fake file with an asoc and a label box, as diff --git a/glymur/version.py b/glymur/version.py index 8509980..1c1279f 100644 --- a/glymur/version.py +++ b/glymur/version.py @@ -19,7 +19,7 @@ from .lib import openjp2 as opj2 # Do not change the format of this next line! Doing so risks breaking # setup.py -version = "0.7.2" +version = "0.7.3" _sv = LooseVersion(version) version_tuple = _sv.version