From 7828dc75e6683353cc6363d97c77bc4c61648887 Mon Sep 17 00:00:00 2001 From: jevans Date: Thu, 27 Feb 2014 19:44:05 -0500 Subject: [PATCH 1/3] Updated lxml requirements, checked on Raspbian. #176 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b1332d8..5b91590 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ kwargs = {'name': 'Glymur', 'license': 'MIT', 'test_suite': 'glymur.test'} -instllrqrs = ['numpy>=1.4.1'] +instllrqrs = ['numpy>=1.4.1', 'lxml>=2.3.2'] if sys.hexversion < 0x03030000: instllrqrs.append('contextlib2>=0.4') instllrqrs.append('mock>=1.0.1') From 892715e21d6dad688992de2e204b26ff784802f0 Mon Sep 17 00:00:00 2001 From: jevans Date: Thu, 27 Feb 2014 20:19:18 -0500 Subject: [PATCH 2/3] Updated docs for lxml requirement. #176 --- docs/source/changelog.rst | 1 + docs/source/detailed_installation.rst | 3 ++- docs/source/how_do_i.rst | 10 ++++------ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index ad4e40b..bbba98e 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -5,6 +5,7 @@ ChangeLog 0.6.0 (pending) =============== + * Added lxml requirement. * added set_printoptions, get_printoptions function * dropped support for Python 2.6, added support for Python 3.4 * dropped windows support diff --git a/docs/source/detailed_installation.rst b/docs/source/detailed_installation.rst index d1b3084..cfbb168 100644 --- a/docs/source/detailed_installation.rst +++ b/docs/source/detailed_installation.rst @@ -68,8 +68,8 @@ For python 3.3, you should install the following set of ports: * python33 * py33-numpy + * py33-lxml * py33-distribute - * py33-matplotlib (optional, for running certain tests) * py33-Pillow (optional, for running certain tests) MacPorts supplies both OpenJPEG 1.5.0 and OpenJPEG 2.0.0. @@ -85,6 +85,7 @@ packages may also need to be installed. Consult your package manager documentation or use pip. * setuptools + * python-lxml * matplotlib * pillow * contextlib2 (2.7 only) diff --git a/docs/source/how_do_i.rst b/docs/source/how_do_i.rst index fa8f098..4bde854 100644 --- a/docs/source/how_do_i.rst +++ b/docs/source/how_do_i.rst @@ -131,7 +131,6 @@ From within Python, it is as simple as printing the Jp2k object, i.e. :: - Contiguous Codestream Box (jp2c) @ (3223, 1132296) Main header: SOC marker segment @ (3231, 0) @@ -228,7 +227,6 @@ The :py:meth:`append` method can add an XML box as shown below:: >>> import shutil >>> import glymur >>> shutil.copyfile(glymur.data.nemo(), 'myfile.jp2') - >>> from xml.etree import cElementTree as ET >>> jp2 = glymur.Jp2k('myfile.jp2') >>> xmlbox = glymur.jp2box.XMLBox(filename='data.xml') >>> jp2.append(xmlbox) @@ -408,12 +406,12 @@ The example JP2 file shipped with glymur has an XMP UUID. :: . -Since the UUID data in this case is returned as an ElementTree instance, -one can use ElementTree from the standard library to access the data. -For example, to extract the **CreatorTool** attribute value, one could do the +Since the UUID data in this case is returned as an lxml ElementTree +instance, one can use lxml to access the data. For example, to +extract the **CreatorTool** attribute value, one could do the following - >>> xmp = j.box[3].data.packet + >>> xmp = j.box[3].data >>> rdf = '{http://www.w3.org/1999/02/22-rdf-syntax-ns#}' >>> ns2 = '{http://ns.adobe.com/xap/1.0/}' >>> name = '{0}RDF/{0}Description/{1}CreatorTool'.format(rdf, ns2) From 7be9e726388bb236e58b639aec82113384748698 Mon Sep 17 00:00:00 2001 From: jevans Date: Thu, 27 Feb 2014 20:43:57 -0500 Subject: [PATCH 3/3] refactored nemo xml #176 --- glymur/test/fixtures.py | 186 +++------------------------------------- 1 file changed, 10 insertions(+), 176 deletions(-) diff --git a/glymur/test/fixtures.py b/glymur/test/fixtures.py index e7c81a3..3914173 100644 --- a/glymur/test/fixtures.py +++ b/glymur/test/fixtures.py @@ -181,10 +181,7 @@ def read_pgx_header(pgx_file): header = header.rstrip() return header, pos -nemo_xmp_box = """UUID Box (uuid) @ (77, 3146) - UUID: be7acfcb-97a9-42e8-9c71-999491e3afac (XMP) - UUID Data: - +nemo_xml = """ @@ -270,6 +267,11 @@ nemo_xmp_box = """UUID Box (uuid) @ (77, 3146) """ +nemo_xmp_box = """UUID Box (uuid) @ (77, 3146) + UUID: be7acfcb-97a9-42e8-9c71-999491e3afac (XMP) + UUID Data: +{0}""".format(nemo_xml) + SimpleRDF = """ @@ -374,91 +376,7 @@ JP2 Header Box (jp2h) @ (32, 45) UUID Box (uuid) @ (77, 3146) UUID: be7acfcb-97a9-42e8-9c71-999491e3afac (XMP) UUID Data: - - - - - Google - 2013-02-09T14:47:53 - - - 1 - 72/1 - 72/1 - 2 - HTC - HTC Glacier - 2592 - 1456 - - - 8 - 8 - 8 - - - 2 - 3 - - - 1343036288/4294967295 - 1413044224/4294967295 - - - - - 2748779008/4294967295 - 1417339264/4294967295 - 1288490240/4294967295 - 2576980480/4294967295 - 644245120/4294967295 - 257698032/4294967295 - - - - - 1 - 2528 - 1424 - 353/100 - 0 - 0/1 - WGS-84 - 2013-02-09T14:47:53 - - - 76 - - - 0220 - 0100 - - - 1 - 2 - 3 - 0 - - - 42,20.56N - 71,5.29W - 2013-02-09T19:47:53Z - NETWORK - - - 2013-02-09T14:47:53 - - - - - Glymur - Python XMP Toolkit - - - - - - +{0} Contiguous Codestream Box (jp2c) @ (3223, 1132296) Main header: SOC marker segment @ (3231, 0) @@ -495,7 +413,7 @@ Contiguous Codestream Box (jp2c) @ (3223, 1132296) Quantization style: no quantization, 2 guard bits Step size: [(0, 8), (0, 9), (0, 9), (0, 10)] CME marker segment @ (3305, 37) - "Created by OpenJPEG version 2.0.0"''' + "Created by OpenJPEG version 2.0.0"'''.format(nemo_xml) nemo_dump_short = r"""JPEG 2000 Signature Box (jP ) @ (0, 12) File Type Box (ftyp) @ (12, 20) @@ -580,92 +498,8 @@ JP2 Header Box (jp2h) @ (32, 45) UUID Box (uuid) @ (77, 3146) UUID: be7acfcb-97a9-42e8-9c71-999491e3afac (XMP) UUID Data: - - - - - Google - 2013-02-09T14:47:53 - - - 1 - 72/1 - 72/1 - 2 - HTC - HTC Glacier - 2592 - 1456 - - - 8 - 8 - 8 - - - 2 - 3 - - - 1343036288/4294967295 - 1413044224/4294967295 - - - - - 2748779008/4294967295 - 1417339264/4294967295 - 1288490240/4294967295 - 2576980480/4294967295 - 644245120/4294967295 - 257698032/4294967295 - - - - - 1 - 2528 - 1424 - 353/100 - 0 - 0/1 - WGS-84 - 2013-02-09T14:47:53 - - - 76 - - - 0220 - 0100 - - - 1 - 2 - 3 - 0 - - - 42,20.56N - 71,5.29W - 2013-02-09T19:47:53Z - NETWORK - - - 2013-02-09T14:47:53 - - - - - Glymur - Python XMP Toolkit - - - - - - -Contiguous Codestream Box (jp2c) @ (3223, 1132296)""" +{0} +Contiguous Codestream Box (jp2c) @ (3223, 1132296)""".format(nemo_xml) nemo_dump_no_codestream_no_xml = r"""JPEG 2000 Signature Box (jP ) @ (0, 12) Signature: 0d0a870a