[pyexiv2] First attempt to upgrade to pyexiv2 0.3.1
Matej Cepl
mcepl at fedoraproject.org
Mon Oct 24 09:53:20 UTC 2011
commit f5cd8a21f18cfdd3b7b68f08ace2d56ae0d492f5
Author: Matěj Cepl <mcepl at redhat.com>
Date: Mon Oct 24 11:53:59 2011 +0200
First attempt to upgrade to pyexiv2 0.3.1
.gitignore | 1 +
pyexiv2-python26-compatible.patch | 98 +++++++++++++++++++++++++++++++++++++
pyexiv2.spec | 13 +++--
sources | 2 +-
4 files changed, 109 insertions(+), 5 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index b2c74d6..45921fe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
pyexiv2-0.1.3.tar.bz2
/pyexiv2-0.2.2.tar.bz2
/pyexiv2-0.3.0.tar.bz2
+/pyexiv2-0.3.1.tar.bz2
diff --git a/pyexiv2-python26-compatible.patch b/pyexiv2-python26-compatible.patch
new file mode 100644
index 0000000..5644678
--- /dev/null
+++ b/pyexiv2-python26-compatible.patch
@@ -0,0 +1,98 @@
+diff --git a/src/pyexiv2/utils.py b/src/pyexiv2/utils.py
+index 9473aff..0325699 100644
+--- a/src/pyexiv2/utils.py
++++ b/src/pyexiv2/utils.py
+@@ -28,6 +28,9 @@
+ Utilitary classes and functions.
+ """
+
++# Enable true division.
++from __future__ import division
++
+ import datetime
+ import re
+
+@@ -601,7 +604,10 @@ class DateTimeFormatter(object):
+ ``±%H:%M``
+ :rtype: string
+ """
+- seconds = t.total_seconds()
++ # timedelta.total_seconds() is only available starting with Python 2.7
++ # (http://docs.python.org/library/datetime.html#datetime.timedelta.total_seconds)
++ #seconds = t.total_seconds()
++ seconds = (t.microseconds + (t.seconds + t.days * 24 * 3600) * 10**6) / 10**6
+ hours = int(seconds / 3600)
+ minutes = abs(int((seconds - hours * 3600) / 60))
+ return '%+03d:%02d' % (hours, minutes)
+diff --git a/test/iptc.py b/test/iptc.py
+index 872990a..9b715af 100644
+--- a/test/iptc.py
++++ b/test/iptc.py
+@@ -182,8 +182,13 @@ class TestIptcTag(unittest.TestCase):
+ # Invalid values
+ self.failUnlessRaises(IptcValueError, tag._convert_to_string, 'invalid')
+
+- @unittest.skipIf(pytz is None, 'install python-tz to run this test')
+ def test_convert_to_string_time_with_real_timezones(self):
++ if pytz is None:
++ # Poor man’s test skipping. Starting with Python 2.7, decorators are
++ # available to implement this in a cleaner fashion
++ # (http://docs.python.org/library/unittest.html#unittest-skipping).
++ print 'Install python-tz to run this test. Skipping.'
++ return
+ tag = IptcTag('Iptc.Envelope.TimeSent')
+ self.assertEqual(tag.type, 'Time')
+ t = pytz.timezone('UTC').localize(datetime.datetime(2011, 2, 2, 10, 52, 4))
+@@ -214,23 +219,23 @@ class TestIptcTag(unittest.TestCase):
+
+ def test_set_single_value_raises(self):
+ tag = IptcTag('Iptc.Application2.City', ['Seattle'])
+- self.failUnlessRaises(TypeError, setattr, tag, 'values', 'Barcelona')
++ self.failUnlessRaises(TypeError, setattr, tag, 'value', 'Barcelona')
+
+- def test_set_values(self):
++ def test_set_value(self):
+ tag = IptcTag('Iptc.Application2.City', ['Seattle'])
+- old_values = tag.value
++ old_value = tag.value
+ tag.value = ['Barcelona']
+- self.failIfEqual(tag.value, old_values)
++ self.failIfEqual(tag.value, old_value)
+
+- def test_set_raw_values_invalid(self):
++ def test_set_raw_value_invalid(self):
+ tag = IptcTag('Iptc.Envelope.DateSent')
+- values = ['foo']
+- self.failUnlessRaises(ValueError, setattr, tag, 'raw_values', values)
++ value = ['foo']
++ self.failUnlessRaises(ValueError, setattr, tag, 'raw_value', value)
+
+- def test_set_values_non_repeatable(self):
++ def test_set_value_non_repeatable(self):
+ tag = IptcTag('Iptc.Application2.ReleaseDate')
+- values = [datetime.date.today(), datetime.date.today()]
+- self.failUnlessRaises(KeyError, setattr, tag, 'values', values)
++ value = [datetime.date.today(), datetime.date.today()]
++ self.failUnlessRaises(KeyError, setattr, tag, 'value', value)
+
+ def test_deprecated_properties(self):
+ # The .raw_values and .values properties are deprecated in favour of
+diff --git a/test/xmp.py b/test/xmp.py
+index ba5b0b6..70e0980 100644
+--- a/test/xmp.py
++++ b/test/xmp.py
+@@ -184,8 +184,13 @@ class TestXmpTag(unittest.TestCase):
+ self.failUnlessRaises(XmpValueError, tag._convert_to_string, 'invalid', 'Date')
+ self.failUnlessRaises(XmpValueError, tag._convert_to_string, None, 'Date')
+
+- @unittest.skipIf(pytz is None, 'install python-tz to run this test')
+ def test_convert_to_string_date_with_real_timezones(self):
++ if pytz is None:
++ # Poor man’s test skipping. Starting with Python 2.7, decorators are
++ # available to implement this in a cleaner fashion
++ # (http://docs.python.org/library/unittest.html#unittest-skipping).
++ print 'Install python-tz to run this test. Skipping.'
++ return
+ tag = XmpTag('Xmp.xmp.CreateDate')
+ self.assertEqual(tag.type, 'Date')
+ t = pytz.timezone('UTC').localize(datetime.datetime(2011, 2, 2, 10, 52, 4))
diff --git a/pyexiv2.spec b/pyexiv2.spec
index 3b43c74..05163b8 100644
--- a/pyexiv2.spec
+++ b/pyexiv2.spec
@@ -2,15 +2,16 @@
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
Name: pyexiv2
-Version: 0.3.0
-Release: 6%{?dist}
+Version: 0.3.1
+Release: 1%{?dist}
Summary: Python binding to exiv2
Group: Development/Languages
License: GPLv2+
URL: http://tilloy.net/dev/pyexiv2/
-Source0: http://launchpad.net/pyexiv2/0.3.x/0.3/+download/pyexiv2-%{version}.tar.bz2
-
+Source0: http://launchpad.net/pyexiv2/0.3.x/%{version}/+download/pyexiv2-%{version}.tar.bz2
+# Upstream patch from https://bugs.launchpad.net/pyexiv2/+bug/880659
+Patch0: pyexiv2-python26-compatible.patch
BuildRequires: python-devel exiv2-devel boost-devel scons
%description
@@ -21,6 +22,7 @@ embedded in image files (JPEG, TIFF, ...).
%prep
%setup -q
+%patch0 -p1
%build
# Remove CFLAGS=... for noarch packages (unneeded)
@@ -51,6 +53,9 @@ popd
%changelog
+* Mon Oct 24 2011 'Matěj Cepl <mcepl at redhat.com>' - 0.3.1-1
+-
+
* Fri Oct 14 2011 Rex Dieter <rdieter at fedoraproject.org> - 0.3.0-6
- rebuild (exiv2)
diff --git a/sources b/sources
index 4836cc6..43f6793 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-fd737da99f1e5cf04823ab9915136a9c pyexiv2-0.3.0.tar.bz2
+e9c868dd6f46ea4b8091d651b8e1fda7 pyexiv2-0.3.1.tar.bz2
More information about the scm-commits
mailing list