From 57ad32dac153931f3a9211f99514b92fcd070d9d Mon Sep 17 00:00:00 2001 From: John Evans Date: Wed, 24 Jul 2013 17:33:23 -0400 Subject: [PATCH 1/9] Split into two boxes, enables more tests where openjp2 not present. Closes #85 --- glymur/test/test_jp2box.py | 71 ++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/glymur/test/test_jp2box.py b/glymur/test/test_jp2box.py index 8fdd3c3..a2aa9d6 100644 --- a/glymur/test/test_jp2box.py +++ b/glymur/test/test_jp2box.py @@ -472,7 +472,7 @@ class TestColourSpecificationBox(unittest.TestCase): @unittest.skipIf(glymur.lib.openjp2.OPENJP2 is None, "Missing openjp2 library.") -class TestJp2Boxes(unittest.TestCase): +class TestWrap(unittest.TestCase): def setUp(self): self.j2kfile = glymur.data.goodstuff() @@ -481,39 +481,6 @@ class TestJp2Boxes(unittest.TestCase): def tearDown(self): pass - def test_default_JPEG2000SignatureBox(self): - # Should be able to instantiate a JPEG2000SignatureBox - b = glymur.jp2box.JPEG2000SignatureBox() - self.assertEqual(b.signature, (13, 10, 135, 10)) - - def test_default_FileTypeBox(self): - # Should be able to instantiate a FileTypeBox - b = glymur.jp2box.FileTypeBox() - self.assertEqual(b.brand, 'jp2 ') - self.assertEqual(b.minor_version, 0) - self.assertEqual(b.compatibility_list, ['jp2 ']) - - def test_default_ImageHeaderBox(self): - # Should be able to instantiate an image header box. - b = glymur.jp2box.ImageHeaderBox(height=512, width=256, - num_components=3) - self.assertEqual(b.height, 512) - self.assertEqual(b.width, 256) - self.assertEqual(b.num_components, 3) - self.assertEqual(b.bits_per_component, 8) - self.assertFalse(b.signed) - self.assertFalse(b.colorspace_unknown) - - def test_default_JP2HeaderBox(self): - b1 = JP2HeaderBox() - b1.box = [ImageHeaderBox(height=512, width=256), - ColourSpecificationBox(colorspace=glymur.core.GREYSCALE)] - - def test_default_ContiguousCodestreamBox(self): - b = ContiguousCodestreamBox() - self.assertEqual(b.box_id, 'jp2c') - self.assertIsNone(b.main_header) - def verify_wrapped_raw(self, jp2file): # Shared method by at least two tests. jp2 = Jp2k(jp2file) @@ -679,6 +646,42 @@ class TestJp2Boxes(unittest.TestCase): j2k.wrap(tfile.name, boxes=boxes) +class TestJp2Boxes(unittest.TestCase): + + def test_default_JPEG2000SignatureBox(self): + # Should be able to instantiate a JPEG2000SignatureBox + b = glymur.jp2box.JPEG2000SignatureBox() + self.assertEqual(b.signature, (13, 10, 135, 10)) + + def test_default_FileTypeBox(self): + # Should be able to instantiate a FileTypeBox + b = glymur.jp2box.FileTypeBox() + self.assertEqual(b.brand, 'jp2 ') + self.assertEqual(b.minor_version, 0) + self.assertEqual(b.compatibility_list, ['jp2 ']) + + def test_default_ImageHeaderBox(self): + # Should be able to instantiate an image header box. + b = glymur.jp2box.ImageHeaderBox(height=512, width=256, + num_components=3) + self.assertEqual(b.height, 512) + self.assertEqual(b.width, 256) + self.assertEqual(b.num_components, 3) + self.assertEqual(b.bits_per_component, 8) + self.assertFalse(b.signed) + self.assertFalse(b.colorspace_unknown) + + def test_default_JP2HeaderBox(self): + b1 = JP2HeaderBox() + b1.box = [ImageHeaderBox(height=512, width=256), + ColourSpecificationBox(colorspace=glymur.core.GREYSCALE)] + + def test_default_ContiguousCodestreamBox(self): + b = ContiguousCodestreamBox() + self.assertEqual(b.box_id, 'jp2c') + self.assertIsNone(b.main_header) + + class TestJpxBoxes(unittest.TestCase): def setUp(self): From 6b1eae5c4693122aba364f2fc4a118985eaa7d1a Mon Sep 17 00:00:00 2001 From: John Evans Date: Wed, 24 Jul 2013 17:41:10 -0400 Subject: [PATCH 2/9] Removed warning when configuration file does not exist. #86 --- glymur/lib/config.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/glymur/lib/config.py b/glymur/lib/config.py index 7e9e2a9..c29579c 100644 --- a/glymur/lib/config.py +++ b/glymur/lib/config.py @@ -35,9 +35,6 @@ def glymurrc_fname(): fname = os.path.join(confdir, 'glymurrc') if os.path.exists(fname): return fname - else: - msg = "Configuration directory '{0}' does not exist.".format(fname) - warnings.warn(msg) # didn't find a configuration file. return None From dcf529d25b3b03341052aa47bcd07d8e5c99531a Mon Sep 17 00:00:00 2001 From: John Evans Date: Wed, 24 Jul 2013 18:34:30 -0400 Subject: [PATCH 3/9] Added warning if neither library is found. #86 --- glymur/lib/config.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/glymur/lib/config.py b/glymur/lib/config.py index c29579c..d814b89 100644 --- a/glymur/lib/config.py +++ b/glymur/lib/config.py @@ -124,6 +124,9 @@ 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 openjp2 nor openjpeg could not be loaded.' + warnings.warn(msg, UserWarning) return libopenjp2_handle, libopenjpeg_handle From ece145699e73e98a0de91ac4ed3116566b969660 Mon Sep 17 00:00:00 2001 From: John Evans Date: Wed, 24 Jul 2013 19:01:36 -0400 Subject: [PATCH 4/9] Removed warning if libraries not found; we error out first. #86 --- glymur/lib/config.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/glymur/lib/config.py b/glymur/lib/config.py index d814b89..c29579c 100644 --- a/glymur/lib/config.py +++ b/glymur/lib/config.py @@ -124,9 +124,6 @@ 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 openjp2 nor openjpeg could not be loaded.' - warnings.warn(msg, UserWarning) return libopenjp2_handle, libopenjpeg_handle From 0a81c88c4bb4ebca9932a0bb090668cadf74a61f Mon Sep 17 00:00:00 2001 From: John Evans Date: Wed, 24 Jul 2013 19:02:08 -0400 Subject: [PATCH 5/9] Removed tests for warnings if config file not found. Warnings in this situation are no longer desirable. Closes #86. --- glymur/test/test_config.py | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/glymur/test/test_config.py b/glymur/test/test_config.py index 09370e0..7833865 100644 --- a/glymur/test/test_config.py +++ b/glymur/test/test_config.py @@ -81,40 +81,5 @@ class TestSuite(unittest.TestCase): with self.assertWarns(UserWarning) as cw: imp.reload(glymur.lib.openjp2) - def test_missing_config_file_via_environ(self): - # Verify that we error out properly if the configuration file - # specified via environment variable is not found. - with tempfile.TemporaryDirectory() as tdir: - with patch.dict('os.environ', {'XDG_CONFIG_HOME': tdir}): - # Misconfigured new configuration file should - # be rejected. - with self.assertWarns(UserWarning) as cw: - imp.reload(glymur.lib.openjp2) - - def test_home_dir_missing_config_dir(self): - # Verify no exception is raised if $HOME is missing .config directory. - with tempfile.TemporaryDirectory() as tdir: - with patch.dict('os.environ', {'HOME': tdir}): - # Misconfigured new configuration file should - # be rejected. - with self.assertWarns(UserWarning) as cw: - imp.reload(glymur.lib.openjp2) - - def test_home_dir_missing_glymur_rc_dir(self): - # Should warn but not error if $HOME/.config but no glymurrc dir. - with tempfile.TemporaryDirectory() as tdir: - # We need the subdirectory to be specifically named as ".config" - # in order for this test to work. A specifically-named temporary - # directory does not seem to be possible, so try to symlink it. - # Supposedly the symlink gets cleaned up with tdir gets cleaned up. - with tempfile.TemporaryDirectory(suffix=".config", dir=tdir) \ - as tdir_config: - os.symlink(tdir_config, os.path.join(tdir, '.config')) - with patch.dict('os.environ', {'HOME': tdir}): - # Misconfigured new configuration file should - # be rejected. - with self.assertWarns(UserWarning) as cw: - imp.reload(glymur.lib.openjp2) - if __name__ == "__main__": unittest.main() From 2ea129c81c14d4961e8609a8c130a5dee4115f30 Mon Sep 17 00:00:00 2001 From: John Evans Date: Wed, 24 Jul 2013 19:19:53 -0400 Subject: [PATCH 6/9] Prepping for 0.2.6 release. --- CHANGES.txt | 4 ++++ docs/source/conf.py | 4 ++-- release.txt | 6 +++--- setup.py | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 410f243..bf961a2 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,7 @@ +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. + Jul 23, 2013 - v0.2.5 Fixed inconsistency in XML handling, now all instances are always ElementTree objects (issue82). diff --git a/docs/source/conf.py b/docs/source/conf.py index d9f833e..26157b1 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -76,9 +76,9 @@ copyright = u'2013, John Evans' # built documents. # # The short X.Y version. -version = '0.1' +version = '0.2' # The full version, including alpha/beta/rc tags. -release = '0.2.5' +release = '0.2.6' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/release.txt b/release.txt index f41ecb4..30494c4 100644 --- a/release.txt +++ b/release.txt @@ -6,15 +6,15 @@ | | | | | pass. | +-----------+--------+--------+--------+--------------------------------------+ | Mac | X | | | MacPorts with both OpenJPEG 1.5.1 | -| 10.6.8 | | | | and OpenJPEG svn. 352 of 450 tests | +| 10.6.8 | | | | and OpenJPEG svn. 354 of 455 tests | | | | | | should pass. | +-----------+--------+--------+--------+--------------------------------------+ | Mac | | X | | MacPorts with both OpenJPEG 1.5.1 | -| 10.6.8 | | | | and OpenJPEG svn. 377 of 455 tests | +| 10.6.8 | | | | and OpenJPEG svn. 379 of 460 tests | | | | | | should pass. | +-----------+--------+--------+--------+--------------------------------------+ | Mac | | | X | MacPorts with both OpenJPEG 1.5.1 | -| 10.6.8 | | | | and OpenJPEG svn. 402 of 455 | +| 10.6.8 | | | | and OpenJPEG svn. 407 of 460 | | | | | | tests should pass. | +-----------+--------+--------+-----------------------------------------------+ | Fedora 19 | | | X | Ships with 1.5.1, openjp2 built too. | diff --git a/setup.py b/setup.py index 8d88a3a..4f33418 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages import sys kwargs = {'name': 'Glymur', - 'version': '0.2.5', + 'version': '0.2.5rc1', 'description': 'Tools for accessing JPEG2000 files', 'long_description': open('README.md').read(), 'author': 'John Evans', From 29967870810c63e9ace9649f810b65a65b4fcde7 Mon Sep 17 00:00:00 2001 From: John Evans Date: Wed, 24 Jul 2013 19:22:29 -0400 Subject: [PATCH 7/9] Validated on CentOS --- release.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.txt b/release.txt index 30494c4..6831c1f 100644 --- a/release.txt +++ b/release.txt @@ -26,7 +26,7 @@ | Fedora 17 | | X | | Ships with 1.4.0. 166 of 450 tests | | | | | | should pass. | +-----------+--------+--------+--------+--------------------------------------+ -| CentOS | X | | | Ships with 1.3.0. 164 of 450 tests | +| CentOS | X | | | Ships with 1.3.0. 169 of 455 tests | | 6.3 | | | | should pass. | +-----------+--------+--------+--------+--------------------------------------+ | Raspberry | | X | | Ships with 1.3.0. 166 of 450 tests | From 0f7e326e3c55cd0bfd3de43f535981ef5f1471a0 Mon Sep 17 00:00:00 2001 From: John Evans Date: Wed, 24 Jul 2013 20:15:08 -0400 Subject: [PATCH 8/9] qualified raspberry pi --- release.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.txt b/release.txt index 6831c1f..7504f7f 100644 --- a/release.txt +++ b/release.txt @@ -29,7 +29,7 @@ | CentOS | X | | | Ships with 1.3.0. 169 of 455 tests | | 6.3 | | | | should pass. | +-----------+--------+--------+--------+--------------------------------------+ -| Raspberry | | X | | Ships with 1.3.0. 166 of 450 tests | +| Raspberry | | X | | Ships with 1.3.0. 171 of 455 tests | | Pi | | | | should pass. | | Debian 7 | | | | | +-----------+--------+--------+--------+--------------------------------------+ From c74ca93f441506634b1bebf9d57ea3c4a49dae9e Mon Sep 17 00:00:00 2001 From: jevans Date: Wed, 24 Jul 2013 20:40:36 -0400 Subject: [PATCH 9/9] Finalizing 0.2.6 release. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4f33418..098a726 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages import sys kwargs = {'name': 'Glymur', - 'version': '0.2.5rc1', + 'version': '0.2.6', 'description': 'Tools for accessing JPEG2000 files', 'long_description': open('README.md').read(), 'author': 'John Evans',