[pitivi] Fix rhbz 712700

Hicham HAOUARI hicham at fedoraproject.org
Tue Jun 14 16:03:31 UTC 2011


commit 273322333145d938deeaffe3761ad5ccb0757b16
Author: Hicham HAOUARI <hicham.haouari at gmail.com>
Date:   Tue Jun 14 17:03:05 2011 +0100

    Fix rhbz 712700

 ....0-Lower-pygtk2-minimum-version-to-2.17.0.patch |   25 +++
 ...0.14.0-allow-using-default-as-preset-name.patch |  205 ++++++++++++++++++++
 pitivi.spec                                        |   24 ++-
 3 files changed, 251 insertions(+), 3 deletions(-)
---
diff --git a/pitivi-0.14.0-Lower-pygtk2-minimum-version-to-2.17.0.patch b/pitivi-0.14.0-Lower-pygtk2-minimum-version-to-2.17.0.patch
new file mode 100644
index 0000000..a05be9f
--- /dev/null
+++ b/pitivi-0.14.0-Lower-pygtk2-minimum-version-to-2.17.0.patch
@@ -0,0 +1,25 @@
+From ae411113c790999eda8dfab25e846bc996b6a41a Mon Sep 17 00:00:00 2001
+From: Hicham HAOUARI <hicham.haouari at gmail.com>
+Date: Tue, 14 Jun 2011 15:54:35 +0100
+Subject: [PATCH] Lower pygtk2 minimum version to 2.17.0
+
+---
+ configure.ac |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index aade2d6..b0034ac 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -31,7 +31,7 @@ dnl
+ dnl For a more exhaustive list of checks, you can have a look at
+ dnl the runtime checks in pitivi/check.py
+ 
+-AC_SUBST(PYGTK_REQ, 2.18.0)
++AC_SUBST(PYGTK_REQ, 2.17.0)
+ AC_SUBST(PYGST_REQ, 0.10.19)
+ AC_SUBST(GST_REQ, 0.10.28)
+ AC_SUBST(GNONLIN_REQ, 0.10.16)
+-- 
+1.7.5.4
+
diff --git a/pitivi-0.14.0-allow-using-default-as-preset-name.patch b/pitivi-0.14.0-allow-using-default-as-preset-name.patch
new file mode 100644
index 0000000..40f7f30
--- /dev/null
+++ b/pitivi-0.14.0-allow-using-default-as-preset-name.patch
@@ -0,0 +1,205 @@
+diff --git a/pitivi/ui/preset.py b/pitivi/ui/preset.py
+index 888957e..5a8f99f 100644
+--- a/pitivi/ui/preset.py
++++ b/pitivi/ui/preset.py
+@@ -1,6 +1,6 @@
+ # PiTiVi , Non-linear video editor
+ #
+-#       pitivi/ui/controller.py
++#       pitivi/ui/preset.py
+ #
+ # Copyright (c) 2010, Brandon Lewis <brandon_lewis at berkeley.edu>
+ #
+@@ -19,54 +19,104 @@
+ # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ # Boston, MA 02110-1301, USA.
+ 
+-from pitivi.settings import xdg_data_home
+-from ConfigParser import SafeConfigParser
+-from pitivi.ui.dynamic import DynamicWidget
+-from pitivi.ui.common import set_combo_value, get_combo_value
++import ConfigParser
+ import os.path
+-import gtk
+ import gst
++import gtk
++
++from pitivi.settings import xdg_data_home
++
+ 
+ class PresetManager(object):
++    """Abstract class for storing a list of presets.
++
++    Subclasses must provide a filename attribute.
++
++    @cvar filename: The name of the file where the presets will be stored.
++    @type filename: str
++    """
+ 
+     def __init__(self):
+-        self.path = os.path.join(xdg_data_home(), "pitivi", self.filename)
+         self.presets = {}
+         self.widget_map = {}
+         self.ordered = gtk.ListStore(str, object)
+         self.cur_preset = None
+         self.ignore = False
+ 
++    def _getFilename(self):
++        return os.path.join(xdg_data_home(), "pitivi", self.filename)
++
+     def load(self):
+-        try:
+-            fin = open(self.path, "r")
+-            parser = SafeConfigParser()
+-            parser.readfp(fin)
+-            self._load(parser)
+-        except IOError:
+-            pass
++        parser = ConfigParser.SafeConfigParser()
++        if not parser.read(self._getFilename()):
++            # The file probably does not exist yet.
++            return
++        self._loadPresetsFromParser(parser)
+ 
+     def save(self):
+-        fout = open(self.path, "w")
+-        parser = SafeConfigParser()
+-        self._save(parser)
++        parser = ConfigParser.SafeConfigParser()
++        self._savePresetsToParser(parser)
++        fout = open(self._getFilename(), "w")
+         parser.write(fout)
++        fout.close()
+ 
+-    def _load(self, parser):
++    def _loadPresetsFromParser(self, parser):
+         for section in sorted(parser.sections()):
+-            self.loadSection(parser, section)
++            values = self._loadPreset(parser, section)
++            preset = self._convertSectionNameToPresetName(section)
++            self.addPreset(preset, values)
++
++    def _savePresetsToParser(self, parser):
++        for preset, properties in self.ordered:
++            values = self.presets[preset]
++            section = self._convertPresetNameToSectionName(preset)
++            self._savePreset(parser, section, values)
++
++    def _loadPreset(self, parser, section):
++        """Load the specified section from the specified config parser.
++
++        @param parser: The config parser from which the section will be loaded.
++        @type parser: ConfigParser
++        @param section: The name of the section to be loaded.
++        @type section: str
++        @return: A dict representing a preset.
++        """
++        raise NotImplemented
+ 
+-    def _save(self, parser):
+-        for name, properties in self.ordered:
+-            self.saveSection(parser, name)
++    def _savePreset(self, parser, section, values):
++        """Create the specified section into the specified config parser.
+ 
+-    def loadSection(self, parser, section):
++        @param parser: The config parser in which the section will be created.
++        @type parser: ConfigParser
++        @param section: The name of the section to be created.
++        @type section: str
++        @param values: The values of a preset.
++        @type values: dict
++        """
+         raise NotImplemented
+ 
+-    def saveSection(self, parser, section):
+-        raise NotImplemented
++    def _convertSectionNameToPresetName(self, section):
++        assert section != "default"
++        if section.rstrip("_").lower() == "default":
++            return section[:-1]
++        else:
++            return section
++
++    def _convertPresetNameToSectionName(self, preset):
++        if preset.rstrip("_").lower() == "default":
++            # We add an _ to allow the user to have a preset named "default".
++            return "%s_" % preset
++        else:
++            return preset
+ 
+     def addPreset(self, name, values):
++        """Add a new preset.
++
++        @param name: The name of the new preset.
++        @type name: str
++        @param values: The values of the new preset.
++        @type values: dict
++        """
+         self.presets[name] = values
+         self.ordered.append((name, values))
+ 
+@@ -123,11 +173,12 @@ class PresetManager(object):
+         return any((values[field] != getter() for field, (setter, getter)
+             in self.widget_map.iteritems()))
+ 
++
+ class VideoPresetManager(PresetManager):
+ 
+     filename = "video_presets"
+ 
+-    def loadSection(self, parser, section):
++    def _loadPreset(self, parser, section):
+         width = parser.getint(section, "width")
+         height = parser.getint(section, "height")
+ 
+@@ -139,15 +190,13 @@ class VideoPresetManager(PresetManager):
+         par_denom = parser.getint(section, "par-denom")
+         par = gst.Fraction(par_num, par_denom)
+ 
+-        self.addPreset(section, {
++        return {
+             "width": width,
+             "height": height,
+             "frame-rate": rate,
+-            "par": par,
+-        })
++            "par": par}
+ 
+-    def saveSection(self, parser, section):
+-        values = self.presets[section]
++    def _savePreset(self, parser, section, values):
+         parser.add_section(section)
+         parser.set(section, "width", str(values["width"]))
+         parser.set(section, "height", str(values["height"]))
+@@ -160,25 +209,23 @@ class VideoPresetManager(PresetManager):
+         parser.set(section, "par-denom",
+             str(int(values["par"].denom)))
+ 
++
+ class AudioPresetManager(PresetManager):
+ 
+     filename = "audio_presets"
+ 
+-    def loadSection(self, parser, section):
++    def _loadPreset(self, parser, section):
+         channels = parser.getint(section, "channels")
+         depth = parser.getint(section, "depth")
+         rate = parser.getint(section, "sample-rate")
+ 
+-        self.addPreset(section, {
++        return {
+             "channels": channels,
+             "depth": depth,
+-            "sample-rate": rate,
+-        })
++            "sample-rate": rate}
+ 
+-    def saveSection(self, parser, section):
+-        values = self.presets[section]
++    def _savePreset(self, parser, section, values):
+         parser.add_section(section)
+         parser.set(section, "channels", str(values["channels"]))
+         parser.set(section, "depth", str(values["depth"]))
+         parser.set(section, "sample-rate", str(values["sample-rate"]))
+-
diff --git a/pitivi.spec b/pitivi.spec
index c959821..06aa14c 100644
--- a/pitivi.spec
+++ b/pitivi.spec
@@ -4,10 +4,10 @@
 %define gnonlin_req 0.10.16
 %define gst_req 0.10.28
 %define pygst_req 0.10.19
-%define pygtk_req 2.18.0
+%define pygtk_req 2.17.0
 Name:		pitivi
 Version:	%{major}.%{minor}
-Release:	1%{?dist}
+Release:	2%{?dist}
 Summary:	Non-linear video editor
 Group:		Applications/Multimedia
 License:	LGPLv2+
@@ -22,6 +22,8 @@ BuildRequires:	gnonlin >= %{gnonlin_req}
 BuildRequires:	gstreamer-plugins-good
 BuildRequires:	gstreamer >= %{gst_req}
 BuildRequires:	pyxdg
+BuildRequires:  autoconf >= 2.52
+BuildRequires:  automake
 
 Requires:	gstreamer >= %{gst_req}
 Requires:	gnonlin >= %{gnonlin_req}
@@ -45,7 +47,15 @@ Patch1:		0001-Fix-typo-in-license.patch
 Patch2:		0002-Update-fsf-address.patch
 
 # https://bugzilla.gnome.org/show_bug.cgi?id=651898
-Patch3:		0003-Remove-unneeded-shebang.patch  
+Patch3:		0003-Remove-unneeded-shebang.patch
+
+# https://bugzilla.redhat.com/show_bug.cgi?id=712700
+# https://bugzilla.gnome.org/show_bug.cgi?id=652397
+# https://github.com/aleb/pitivi/commit/cd27e9a0d9e3e09e268c951af1da893df7a12cc4
+Patch4:		pitivi-0.14.0-allow-using-default-as-preset-name.patch
+
+# https://bugzilla.gnome.org/show_bug.cgi?id=652567
+Patch5:         pitivi-0.14.0-Lower-pygtk2-minimum-version-to-2.17.0.patch
 
 %description
 Pitivi is an application using the GStreamer multimedia framework to
@@ -61,12 +71,16 @@ program.
 %patch1 -p1 -b .fix-typo-in-license
 %patch2 -p1 -b .update-fsf-address
 %patch3 -p1 -b .remove-unneeded-shebang
+%patch4 -p1 -b .allow-using-default-as-preset-name
+%patch5 -p1 -b .lower-pygtk-min-version
 
 # Since DISPLAY is unset, don't import Pitivi in tests/test_binary_search.py 
 # and don't run tests/test_basic.py and tests/test_timeline_undo.py
 sed -i '/from pitivi.application import Pitivi/d' tests/test_binary_search.py
 rm -f tests/test_{basic,timeline_undo}.py
 
+autoreconf -if
+
 %build
 %configure --libdir=%{_datadir}
 
@@ -109,6 +123,10 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
 %{_mandir}/man1/%{name}.1.gz
 
 %changelog
+* Sun Jun 12 2011 Hicham HAOUARI <hicham.haouari at gmail.com> - 0.14.0-2
+- Allow using "Default" as preset name, fixes rhbz #712700
+- Lower pygtk2 min version to 2.17.0 so that we can push 0.14.0 to f14
+
 * Thu Jun 02 2011 Hicham HAOUARI <hicham.haouari at gmail.com> - 0.14.0-1
 - Update to 0.14
 - Drop backported patches


More information about the scm-commits mailing list