From 540aa3b2a2569e40aa293126e61a3cb88b5bee7e Mon Sep 17 00:00:00 2001 From: Mathieu Bridon Date: Sep 10 2015 11:32:53 +0000 Subject: New snapshot from master The only difference with the previous build, is that the patches we had in Fedora have all been merged upstream. --- diff --git a/.gitignore b/.gitignore index e2ca9f6..a07efa8 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /pycanberra-git.65c3b3f.tar.xz +/pycanberra-0-88c53cd.tar.gz diff --git a/0001-Do-not-use-the-exceptions-module.patch b/0001-Do-not-use-the-exceptions-module.patch deleted file mode 100644 index e999c59..0000000 --- a/0001-Do-not-use-the-exceptions-module.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 2023730c6ece6edf6ddb8f73d80409230fc06089 Mon Sep 17 00:00:00 2001 -From: Mathieu Bridon -Date: Wed, 28 Nov 2012 23:44:39 +0800 -Subject: [PATCH 1/2] Do not use the exceptions module - -On Python 2, it is imported automatically, so there really isn't any -need to import it, it's classes can be used directly: - $ python2 - >>> e = Exception() - >>> import exceptions - >>> isinstance(e, exceptions.Exception) - True - -Also, it doesn't exist on Python 3, so removing it will make the port -easier. ---- - pycanberra.py | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) - -diff --git a/pycanberra.py b/pycanberra.py -index 6b1a064..a1bae5d 100644 ---- a/pycanberra.py -+++ b/pycanberra.py -@@ -4,7 +4,6 @@ - # License: LGPL 2.1 - ########################################################################## - from ctypes import * --import exceptions - import time - - # /** -@@ -519,16 +518,16 @@ def GetApi(): - # int ca_proplist_set(ca_proplist *p, const char *key, const void *data, size_t nbytes); - - --class CanberraException(exceptions.Exception): -+class CanberraException(Exception): - def __init__(self, err, *args, **kwargs): - self._err = err -- super(exceptions.Exception, self).__init__(*args, **kwargs) -+ super(Exception, self).__init__(*args, **kwargs) - - def get_error(self): - return self._err - - def __str__(self): -- return super(exceptions.Exception, self).__str__() + " (error %d)" % self._err -+ return super(Exception, self).__str__() + " (error %d)" % self._err - - - class Canberra(object): --- -1.8.1 - diff --git a/0002-Ensure-all-strings-passed-to-libcanberra-are-byte-st.patch b/0002-Ensure-all-strings-passed-to-libcanberra-are-byte-st.patch deleted file mode 100644 index 74348da..0000000 --- a/0002-Ensure-all-strings-passed-to-libcanberra-are-byte-st.patch +++ /dev/null @@ -1,78 +0,0 @@ -From e1104818d795bde79e203ba750ce37fbba9a8e90 Mon Sep 17 00:00:00 2001 -From: Mathieu Bridon -Date: Wed, 2 Jan 2013 19:26:23 +0800 -Subject: [PATCH 2/2] Ensure all strings passed to libcanberra are byte strings - -We need to pass byte strings to libcanberra, which is default with -Python 2 when defining a string as "foo". - -However, on Python 3, the same definition gives a unicode string, which -libcanberra can't handle. - -To avoid forcing applications to change the way they called pycanberra -on Python 2, pycanberra now quickly ensures that all strings it handles -are encoded to bytes, if they weren't already. ---- - pycanberra.py | 20 ++++++++++++++++++++ - 1 file changed, 20 insertions(+) - -diff --git a/pycanberra.py b/pycanberra.py -index a1bae5d..0d219ba 100644 ---- a/pycanberra.py -+++ b/pycanberra.py -@@ -6,6 +6,18 @@ - from ctypes import * - import time - -+# This is inspired by the six module: http://pypi.python.org/pypi/six -+import sys -+if sys.version_info.major == 3: -+ string_types = str, -+ def b(s): -+ return s.encode("latin-1") -+else: -+ string_types = basestring, -+ def b(s): -+ return s -+ -+ - # /** - # * CA_PROP_MEDIA_NAME: - # * -@@ -556,6 +568,8 @@ class Canberra(object): - raise CanberraException(res, "Failed to destroy context") - - def change_props(self, *args): -+ args = tuple(b(arg) if isinstance(arg, string_types) else arg -+ for arg in args) - res = GetApi().ca_context_change_props(self._handle, *args) - if res != CA_SUCCESS: - raise CanberraException(res, "Failed to change props") -@@ -573,11 +587,15 @@ class Canberra(object): - pass - - def play(self, playId, *args): -+ args = tuple(b(arg) if isinstance(arg, string_types) else arg -+ for arg in args) - res = GetApi().ca_context_play(self._handle, playId, *args) - if res != CA_SUCCESS: - raise CanberraException(res, "Failed to play!") - - def cache(self, *args): -+ args = tuple(b(arg) if isinstance(arg, string_types) else arg -+ for arg in args) - res = GetApi().ca_context_cache(self._handle, *args) - if res != CA_SUCCESS: - raise CanberraException(res, "Failed to cache") -@@ -596,6 +614,8 @@ class Canberra(object): - - def easy_play_sync(self, eventName): - """ play an event sound synchronously """ -+ if isinstance(eventName, string_types): -+ eventName = b(eventName) - self.play(1, - CA_PROP_EVENT_ID, eventName, - None) --- -1.8.1 - diff --git a/pycanberra.spec b/pycanberra.spec index 7ad2c87..2b7d8b2 100644 --- a/pycanberra.spec +++ b/pycanberra.spec @@ -1,28 +1,17 @@ -%global git_hash 65c3b3f +%global commit 88c53cd44a626ede3b07dab0b548f8bcfda42867 +%global shortcommit %(c=%{commit}; echo ${c:0:7}) Name: pycanberra Summary: A very basic (and incomplete) wrapper for libcanberra +URL: https://github.com/psykoyiko/pycanberra/ License: LGPLv2 # There's no versioning upstream, it's all about the Git hash Version: 0 -Release: 0.7.git%{git_hash}%{?dist} - -URL: https://github.com/psykoyiko/pycanberra/ - -# There aren't any release yet, I'm creating a git snapshot: -# $ git clone git://github.com/psykoyiko/pycanberra.git -# $ cd pycanberra -# $ GIT_HASH=$(git rev-parse --short HEAD) -# $ git archive --prefix=pycanberra-$GIT_HASH/ --format=tar HEAD | xz > pycanberra-git.$GIT_HASH.tar.xz -Source0: %{name}-git.%{git_hash}.tar.xz +Release: 0.8.git%{shortcommit}%{?dist} -# I submitted these patches upstream, but they haven't been accepted yet -# https://github.com/psykoyiko/pycanberra/pull/2 -# I'm pulling them in the package because other packages need pycanberra with -# Python 3 (e.g gnome-clocks) -Patch0: 0001-Do-not-use-the-exceptions-module.patch -Patch1: 0002-Ensure-all-strings-passed-to-libcanberra-are-byte-st.patch +# There aren't any release yet, I'm downloading straight from the last commit +Source0: https://github.com/psykoyiko/pycanberra/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz BuildArch: noarch @@ -44,10 +33,7 @@ A very basic (and incomplete) wrapper of libcanberra for Python 3. %prep -%setup -q -n pycanberra-%{git_hash} - -%patch0 -p1 -%patch1 -p1 +%setup -q -n pycanberra-%{commit} %build @@ -72,8 +58,10 @@ install -p -m 0644 pycanberra.py %{buildroot}%{python3_sitelib} %{python3_sitelib}/__pycache__/pycanberra.cpython-3?.py? - %changelog +* Thu Sep 10 2015 Mathieu Bridon - 0-0.8.git65c3b3f +- New snapshot from master. + * Thu Jun 18 2015 Fedora Release Engineering - 0-0.7.git65c3b3f - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild diff --git a/sources b/sources index 678396f..34b896a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -4399de2c2b53ce96185c080d94d0a4ec pycanberra-git.65c3b3f.tar.xz +6d30eaca86de4b1cd3dea0d3d36d5c67 pycanberra-0-88c53cd.tar.gz