Merge branch 'issue176' of https://github.com/quintusdias/glymur into issue176

Conflicts:
	glymur/test/fixtures.py
This commit is contained in:
John Evans 2014-03-01 12:31:02 -05:00
commit 5bfe7d7b95
6 changed files with 13 additions and 11 deletions

View file

@ -5,6 +5,7 @@ ChangeLog
0.6.0 (pending) 0.6.0 (pending)
=============== ===============
* Added lxml requirement.
* added set_printoptions, get_printoptions function * added set_printoptions, get_printoptions function
* dropped support for Python 2.6, added support for Python 3.4 * dropped support for Python 2.6, added support for Python 3.4
* dropped windows support * dropped windows support

View file

@ -68,8 +68,8 @@ For python 3.3, you should install the following set of ports:
* python33 * python33
* py33-numpy * py33-numpy
* py33-lxml
* py33-distribute * py33-distribute
* py33-matplotlib (optional, for running certain tests)
* py33-Pillow (optional, for running certain tests) * py33-Pillow (optional, for running certain tests)
MacPorts supplies both OpenJPEG 1.5.0 and OpenJPEG 2.0.0. 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. documentation or use pip.
* setuptools * setuptools
* python-lxml
* matplotlib * matplotlib
* pillow * pillow
* contextlib2 (2.7 only) * contextlib2 (2.7 only)

View file

@ -131,7 +131,6 @@ From within Python, it is as simple as printing the Jp2k object, i.e. ::
</rdf:Description> </rdf:Description>
</rdf:RDF> </rdf:RDF>
</ns0:xmpmeta> </ns0:xmpmeta>
Contiguous Codestream Box (jp2c) @ (3223, 1132296) Contiguous Codestream Box (jp2c) @ (3223, 1132296)
Main header: Main header:
SOC marker segment @ (3231, 0) 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 shutil
>>> import glymur >>> import glymur
>>> shutil.copyfile(glymur.data.nemo(), 'myfile.jp2') >>> shutil.copyfile(glymur.data.nemo(), 'myfile.jp2')
>>> from xml.etree import cElementTree as ET
>>> jp2 = glymur.Jp2k('myfile.jp2') >>> jp2 = glymur.Jp2k('myfile.jp2')
>>> xmlbox = glymur.jp2box.XMLBox(filename='data.xml') >>> xmlbox = glymur.jp2box.XMLBox(filename='data.xml')
>>> jp2.append(xmlbox) >>> jp2.append(xmlbox)
@ -408,12 +406,12 @@ The example JP2 file shipped with glymur has an XMP UUID. ::
. .
</ns0:xmpmeta> </ns0:xmpmeta>
Since the UUID data in this case is returned as an ElementTree instance, Since the UUID data in this case is returned as an lxml ElementTree
one can use ElementTree from the standard library to access the data. instance, one can use lxml to access the data. For example, to
For example, to extract the **CreatorTool** attribute value, one could do the extract the **CreatorTool** attribute value, one could do the
following following
>>> xmp = j.box[3].data.packet >>> xmp = j.box[3].data
>>> rdf = '{http://www.w3.org/1999/02/22-rdf-syntax-ns#}' >>> rdf = '{http://www.w3.org/1999/02/22-rdf-syntax-ns#}'
>>> ns2 = '{http://ns.adobe.com/xap/1.0/}' >>> ns2 = '{http://ns.adobe.com/xap/1.0/}'
>>> name = '{0}RDF/{0}Description/{1}CreatorTool'.format(rdf, ns2) >>> name = '{0}RDF/{0}Description/{1}CreatorTool'.format(rdf, ns2)

View file

@ -272,6 +272,11 @@ nemo_xmp_box = """UUID Box (uuid) @ (77, 3146)
UUID Data: UUID Data:
{0}""".format(textwrap.indent(nemo_xmp, ' ')) {0}""".format(textwrap.indent(nemo_xmp, ' '))
nemo_xmp_box = """UUID Box (uuid) @ (77, 3146)
UUID: be7acfcb-97a9-42e8-9c71-999491e3afac (XMP)
UUID Data:
{0}""".format(textwrap.indent(nemo_xmp, ' '))
SimpleRDF = """<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'> SimpleRDF = """<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<rdf:Description rdf:about='Test:XMPCoreCoverage/kSimpleRDF' <rdf:Description rdf:about='Test:XMPCoreCoverage/kSimpleRDF'
xmlns:ns1='ns:test1/' xmlns:ns2='ns:test2/'> xmlns:ns1='ns:test1/' xmlns:ns2='ns:test2/'>

View file

@ -119,7 +119,6 @@ class TestPrinting(unittest.TestCase):
lst = actual.split('\n') lst = actual.split('\n')
lst = lst[1:] lst = lst[1:]
actual = '\n'.join(lst) actual = '\n'.join(lst)
self.maxDiff = None
self.assertEqual(actual, fixtures.nemo_dump_no_codestream) self.assertEqual(actual, fixtures.nemo_dump_no_codestream)
def test_printoptions_no_xml(self): def test_printoptions_no_xml(self):
@ -211,7 +210,6 @@ class TestPrinting(unittest.TestCase):
lst = actual.split('\n') lst = actual.split('\n')
lst = lst[1:] lst = lst[1:]
actual = '\n'.join(lst) actual = '\n'.join(lst)
self.maxDiff = None
self.assertEqual(actual, fixtures.nemo_dump_full) self.assertEqual(actual, fixtures.nemo_dump_full)
def test_entire_file(self): def test_entire_file(self):
@ -631,7 +629,6 @@ class TestPrinting(unittest.TestCase):
with patch('sys.stdout', new=StringIO()) as fake_out: with patch('sys.stdout', new=StringIO()) as fake_out:
print(j.box[2]) print(j.box[2])
actual = fake_out.getvalue().strip() actual = fake_out.getvalue().strip()
self.maxDiff = None
self.assertEqual(actual, fixtures.file1_xml) self.assertEqual(actual, fixtures.file1_xml)
@unittest.skipIf(sys.hexversion < 0x03000000, @unittest.skipIf(sys.hexversion < 0x03000000,

View file

@ -16,7 +16,7 @@ kwargs = {'name': 'Glymur',
'license': 'MIT', 'license': 'MIT',
'test_suite': 'glymur.test'} 'test_suite': 'glymur.test'}
instllrqrs = ['lxml>=3.2.3', 'numpy>=1.4.1'] instllrqrs = ['numpy>=1.4.1', 'lxml>=2.3.2']
if sys.hexversion < 0x03030000: if sys.hexversion < 0x03030000:
instllrqrs.append('contextlib2>=0.4') instllrqrs.append('contextlib2>=0.4')
instllrqrs.append('mock>=1.0.1') instllrqrs.append('mock>=1.0.1')