From a79e234f8a0be109ea5e2b28cd171b1ae62e1ef7 Mon Sep 17 00:00:00 2001 From: John Evans Date: Sat, 10 May 2014 15:54:28 -0400 Subject: [PATCH 1/4] Removed apparently unreachable XML code for 2.6. --- glymur/jp2box.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/glymur/jp2box.py b/glymur/jp2box.py index 316f059..851ae3b 100644 --- a/glymur/jp2box.py +++ b/glymur/jp2box.py @@ -2740,12 +2740,7 @@ class XMLBox(Jp2kBox): def write(self, fptr): """Write an XML box to file. """ - try: - read_buffer = ET.tostring(self.xml, encoding='utf-8') - except (AttributeError, AssertionError): - # AssertionError on 2.6 - read_buffer = ET.tostring(self.xml.getroot(), encoding='utf-8') - + read_buffer = ET.tostring(self.xml, encoding='utf-8') fptr.write(struct.pack('>I4s', len(read_buffer) + 8, b'xml ')) fptr.write(read_buffer) From bf65a00f28b3acec2f7706c4dda5605b9974003b Mon Sep 17 00:00:00 2001 From: John Evans Date: Sat, 10 May 2014 15:58:57 -0400 Subject: [PATCH 2/4] Improved warning message when brand is not proper. #232 --- glymur/jp2box.py | 6 ++++-- glymur/test/test_jp2k.py | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/glymur/jp2box.py b/glymur/jp2box.py index 851ae3b..b2986ae 100644 --- a/glymur/jp2box.py +++ b/glymur/jp2box.py @@ -1241,8 +1241,10 @@ class FileTypeBox(Jp2kBox): def _validate(self, writing=False): """Validate the box before writing to file.""" if self.brand not in ['jp2 ', 'jpx ']: - msg = "The file type brand must be either 'jp2 ' or 'jpx '." - self._dispatch_validation_error(msg, writing=writing) + msg = "The file type brand was '{0}'. " + msg += "It should be either 'jp2 ' or 'jpx '." + self._dispatch_validation_error(msg.format(self.brand), + writing=writing) valid_cls = ['jp2 ', 'jpx ', 'jpxb'] for item in self.compatibility_list: if item not in valid_cls: diff --git a/glymur/test/test_jp2k.py b/glymur/test/test_jp2k.py index 05d4ccc..aba1463 100644 --- a/glymur/test/test_jp2k.py +++ b/glymur/test/test_jp2k.py @@ -814,9 +814,9 @@ class TestJp2kOpjDataRootWarnings(unittest.TestCase): """Should warn in case of bad ftyp brand.""" filename = opj_data_file('input/nonregression/edf_c2_1000290.jp2') with warnings.catch_warnings(record=True) as w: - warnings.simplefilter('always') - jp2 = Jp2k(filename) - self.assertTrue(issubclass(w[0].category, UserWarning)) + warnings.simplefilter('always') + jp2 = Jp2k(filename) + self.assertTrue(issubclass(w[0].category, UserWarning)) def test_invalid_approximation(self): """Should warn in case of invalid approximation.""" From 0a4bb217e33bc781d505a33f4e354e0a1097f093 Mon Sep 17 00:00:00 2001 From: John Evans Date: Sat, 10 May 2014 16:02:35 -0400 Subject: [PATCH 3/4] Removed two tests that we chose not to run because of stderr issues. They produce too much output on stderr, it would make interpreting test results difficult. --- glymur/test/test_opj_suite.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/glymur/test/test_opj_suite.py b/glymur/test/test_opj_suite.py index c8dbad4..88669ce 100644 --- a/glymur/test/test_opj_suite.py +++ b/glymur/test/test_opj_suite.py @@ -299,19 +299,6 @@ class TestSuite(unittest.TestCase): jp2.read() self.assertTrue(True) - @unittest.skip("fprintf stderr output in r2343.") - def test_NR_DEC_123_j2c_3_decode(self): - jfile = opj_data_file('input/nonregression/123.j2c') - jp2 = Jp2k(jfile) - jp2.read() - self.assertTrue(True) - - @unittest.skip("fprintf stderr output in r2343.") - def test_NR_DEC_bug_j2c_8_decode(self): - jfile = opj_data_file('input/nonregression/bug.j2c') - Jp2k(jfile).read() - self.assertTrue(True) - def test_NR_DEC_buxI_j2k_9_decode(self): jfile = opj_data_file('input/nonregression/buxI.j2k') Jp2k(jfile).read() From 2750aced14c51a6fddb707513e4ff6dc1cd24c4a Mon Sep 17 00:00:00 2001 From: John Evans Date: Sat, 10 May 2014 16:10:58 -0400 Subject: [PATCH 4/4] Updated versioning for pending 0.6.0 release. Removed documentation cruft. --- docs/source/changelog.rst | 6 +-- docs/source/conf.py | 4 +- docs/source/detailed_installation.rst | 70 +-------------------------- glymur/version.py | 2 +- 4 files changed, 8 insertions(+), 74 deletions(-) diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index c3eae6c..a24d1e8 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -2,14 +2,14 @@ ChangeLog --------- -0.6.0 (pending) -=============== +0.6.0 +===== + * Added support for OpenJPEG 2.1.0, dropped support for 1.3 and 1.4. * Added Cinema2K, Cinema4K write support. * Added lxml requirement. * added set_printoptions, get_printoptions function * dropped support for Python 2.6, added support for Python 3.4 - * dropped support for OpenJPEG versions 1.3 and 1.4 * dropped windows support (it might work, it might not, I don't much care) * added write support for JP2 UUID, dataEntryURL, palette, and component mapping boxes * added read/write support for JPX free, number list, and data reference boxes diff --git a/docs/source/conf.py b/docs/source/conf.py index 4b0eb14..3e6b26e 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.5' +version = '0.6' # The full version, including alpha/beta/rc tags. -release = '0.5.10' +release = '0.6.0' # 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 67c230a..e919681 100644 --- a/docs/source/detailed_installation.rst +++ b/docs/source/detailed_installation.rst @@ -1,7 +1,6 @@ ---------------------------------- Advanced Installation Instructions ---------------------------------- -Most users won't need to read this! You've been warned... '''''''''''''''''''''' Glymur Configuration @@ -9,11 +8,8 @@ Glymur Configuration The default glymur installation process relies upon OpenJPEG being properly installed on your system. If you have version 1.5 you can -both read and write JPEG 2000 files, but you may wish to install version 2.0 -or the 2.0+ version from OpenJPEG's development trunk for better performance. -If you do that, you should compile it as a shared library (named *openjp2* -instead of *openjpeg*) from the developmental source that you can retrieve -via subversion. As of this time of writing, svn revision r2691 works. +both read and write JPEG 2000 files, but version 2.1 is recommended. +If you compile OpenJPEG yourself, please compile it as a shared library. You should also download the test data for the purpose of configuring and running OpenJPEG's test suite, check their instructions for all this. You should set the **OPJ_DATA_ROOT** environment variable for the purpose @@ -51,60 +47,6 @@ installed in a non-standard place, i.e. :: [library] openjpeg: /not/the/usual/location/lib/libopenjpeg.so -'''''''''''''''''''''''''''''' -Package Management Suggestions -'''''''''''''''''''''''''''''' - -You only need to read this section if you want detailed -platform-specific instructions on running as many tests as possible or wish to -use your system's package manager to install as many required -packages/RPMs/ports/whatever without going through pip. - - -Mac OS X --------- -All the necessary packages are available to use glymur with MacPorts. -For python 3.3, you should install the following set of ports: - - * python33 - * py33-numpy - * py33-lxml - * py33-distribute - * py33-Pillow (optional, for running certain tests) - -MacPorts supplies both OpenJPEG 1.5.0 and OpenJPEG 2.0.0. - -Linux ------ -For the most part, you only need python and numpy to run glymur, so on -just about all distributions you are already set to go (and you don't -need to mess around with a configuration file, as the openjpeg shared -libraries are found in the usual places thanks to your package manager). -In order to run as many tests as possible, however, the following Python -packages may also need to be installed. Consult your package manager -documentation or use pip. - - * setuptools - * python-lxml - * matplotlib - * pillow - * contextlib2 (2.7 only) - * mock (2.7 only) - -Glymur 0.6 been tested on the following linux platforms without any unexpected -difficulties: - - * OpenSUSE 13.1 - * Fedora 19 - * Raspian - * Travis CI (currently Ubuntu 12.04?) - -Windows -------- -The 0.6.x series of Glymur is untested on windows and I make no promises here. -I suggest that windows users check the 0.5.x series. - - ''''''' Testing ''''''' @@ -128,11 +70,3 @@ or from the command line. :: $ cd /to/where/you/unpacked/glymur $ python -m unittest discover - -Quite a few tests are currently skipped. These include tests whose -OpenJPEG counterparts are already failing, and others which do pass but -still produce heaps of output on stderr. Rather than let this swamp -the signal (that most of those tests are actually passing), they've been -filtered out for now. There are also more skipped tests on Python 2.7 -than on Python3. The important part is whether or not any test -errors are reported at the end. diff --git a/glymur/version.py b/glymur/version.py index 409db9a..8ffd80f 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.5.10" +version = "0.6.0" _sv = LooseVersion(version) version_tuple = _sv.version