Bug#678354: libpeas: Build a Python 3 loader

2012-06-22 Thread Dmitrijs Ledkovs
Dear all,

Here is an improvement on top of Barry's patch:

* clean up and remove ubuntu-specific bits
* build one language loader per 'flavor'

This allows easily enabling/disabling flavors.

What about gjs? Was there a reason why that one was not built?
I added debian/rules support for it, but didn't enable nor added
additional dependencies.

-- 
Regards,
Dmitrijs.
=== modified file 'debian/changelog'
--- debian/changelog2012-06-21 23:01:31 +
+++ debian/changelog2012-06-22 08:44:42 +
@@ -1,3 +1,15 @@
+libpeas (1.4.0-2.1) unstable; urgency=low
+
+  [ Barry Warsaw ]
+  * Build the Python 3 plugin, and enable it to exist next to the Python 2
+plugin (though only one can be used by an application at a time).  Add
+Python 3 support to peas-demo.
+
+  [ Dmitrijs Ledkovs ]
+  * Build one language loader per flavor. There is no vala loader, as it's C.
+
+ -- Dmitrijs Ledkovs   Fri, 22 Jun 2012 00:07:26 
+0100
+
 libpeas (1.4.0-2) unstable; urgency=low
 
   * Don't enable the seed plugin on ia64 and mips since seed is not available

=== modified file 'debian/control'
--- debian/control  2012-06-21 23:01:31 +
+++ debian/control  2012-06-21 23:06:07 +
@@ -9,6 +9,7 @@
 Uploaders: Martin Pitt , Michael Biebl , 
Sjoerd Simons 
 Build-Depends: cdbs (>= 0.4.90),
debhelper (>= 8),
+   autoconf,
gnome-pkg-tools,
intltool (>= 0.40),
gtk-doc-tools (>= 1.11),
@@ -20,6 +21,7 @@
libseed-gtk3-dev (>= 2.91.91) [!ia64 !mips],
python-dev (>= 2.5.2),
python-gi-dev (>= 3.0.0),
+   python3-dev,
valac-0.14,
gnome-icon-theme
 Standards-Version: 3.9.3

=== modified file 'debian/control.in'
--- debian/control.in   2012-06-21 23:01:31 +
+++ debian/control.in   2012-06-21 23:05:45 +
@@ -4,6 +4,7 @@
 Uploaders: @GNOME_TEAM@
 Build-Depends: cdbs (>= 0.4.90),
debhelper (>= 8),
+   autoconf,
gnome-pkg-tools,
intltool (>= 0.40),
gtk-doc-tools (>= 1.11),
@@ -15,6 +16,7 @@
libseed-gtk3-dev (>= 2.91.91) [!ia64 !mips],
python-dev (>= 2.5.2),
python-gi-dev (>= 3.0.0),
+   python3-dev,
valac-0.14,
gnome-icon-theme
 Standards-Version: 3.9.3

=== added directory 'debian/patches'
=== added file 'debian/patches/python3-demo.patch'
--- debian/patches/python3-demo.patch   1970-01-01 00:00:00 +
+++ debian/patches/python3-demo.patch   2012-06-21 23:01:50 +
@@ -0,0 +1,154 @@
+Description: Add Python 3 demo.
+ This patch mostly just copies the existing Python plugin demo, but tweaks the
+ visible strings to show how a Python 2 or Python 3 (but not both) plugin can
+ be used in a single application.
+Author: Barry Warsaw 
+Forwarded: no
+
+--- a/peas-demo/peas-demo.c
 b/peas-demo/peas-demo.c
+@@ -126,6 +126,7 @@
+ 
+   peas_engine_enable_loader (engine, "gjs");
+   peas_engine_enable_loader (engine, "python");
++  peas_engine_enable_loader (engine, "python3");
+   peas_engine_enable_loader (engine, "seed");
+ 
+   if (run_from_build_dir)
+--- /dev/null
 b/peas-demo/plugins/python3hello/Makefile.am
+@@ -0,0 +1,8 @@
++plugindir = $(libdir)/peas-demo/plugins/python3hello
++
++plugin_PYTHON = \
++  python3hello.py
++
++plugin_DATA = python3hello.plugin
++
++EXTRA_DIST = $(plugin_DATA)
+--- /dev/null
 b/peas-demo/plugins/python3hello/python3hello.plugin
+@@ -0,0 +1,13 @@
++[Plugin]
++Module=python3hello
++Loader=python3
++IAge=2
++Name=Python 3 Says Hello
++Description=Inserts a box containing "Python 3 Says Hello" in every windows.
++Authors=Steve Frécinaux 
++Copyright=Copyright © 2009 Steve Frécinaux
++Website=http://code.istique.net/
++Help=http://git.gnome.org/browse/error
++Help-Windows=http://git.gnome.org/browse/libpeas
++Help-MacOS-X=http://git.gnome.org/browse/libpeas
++Help-GNOME=http://git.gnome.org/browse/libpeas
+--- /dev/null
 b/peas-demo/plugins/python3hello/python3hello.py
+@@ -0,0 +1,61 @@
++# -*- coding: utf-8 -*-
++# ex:set ts=4 et sw=4 ai:
++
++##
++# python3hello.py
++# This file is part of libpeas
++#
++# Copyright (C) 2009-2010 Steve Frécinaux
++#
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU Library General Public License as published by
++# the Free Software Foundation; either version 2 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU Library General Public License for more details.
++#
++# You should have received a copy of the GNU Library General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 51 Frankli

Bug#678354: libpeas: Build a Python 3 loader

2012-06-20 Thread Barry Warsaw
Package: libpeas
Version: 1.4.0-2
Severity: normal

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Dear Maintainer,

Upstream libpeas supports both Python 2 and Python 3.  As part of our effort
in Ubuntu to promote Python 3, we'd like to be able to load Python 3 libpeas
plugins.

Enabling Python 3 plugins is a fairly simple matter of recompiling the libpeas
with $PYTHON=python3.  We want to prevent using both Python 2 and Python 3
plugins in the same application, but of course we want to continue to allow
different applications on the same system to use either Python 2 or Python 3.
Fortunately, we can do this without any changes to the code.

The approach taken here is to essentially build libpeas twice, into two
separatre build directories.  The first build is the normal one, which builds
the Python 2 version.  The second build builds into tmp-py3, but the only
thing we need from the second build is the libpythonloader.so, which must be
renamed to libpython3loader.so.  This allows an application to enable both the
Python 2 and Python 3 loader, but the first one loaded wins.  You can see how
this works by running the peas-demo program.  After loading either the Python
2 or Python 3 plugin, the second one will properly fail to load, without
causing any other problems.

Hopefully the changes in the debdiff make sense.  Thanks to Dmitrij Ledkovs
for helping figure out the cdbs flavors magic.


- -- System Information:
Debian Release: wheezy/sid
  APT prefers precise-updates
  APT policy: (500, 'precise-updates'), (500, 'precise-security'), (500, 
'precise'), (100, 'precise-backports')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-25-generic (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBCAAGBQJP4ox3AAoJEBJutWOnSwa/4d0P/1ED6J4NAJKtFqGqzueXE5wS
3cuDanZOEFNzA0RtnHxt/CpE2+qPQfbwgziwRiAs4RwBiL6tdDCvJaXg4NFcoDo+
UGYmW/iv20LmklqiUEVWsYy+b5tB4uqHHV/Qz6QlMdL7NZtYrYKymShUnxeD196D
vcit8tVk7h6+N0WKkNbywJwOWaq71FdT0TV7PcJHadYQo+q6j7f4i2qOpgu3VKUE
X6i9sYYYWTQug5E4MdlT2kND10sYDCaiX2otHXcgvCQORqIEjKULsahiosmON756
vkeSw6i5JFRZ5CrzfbSysaoVtnJ/SQDXcjrBG4+H6QQRIZoWn7Ra88HVb/kqxver
6LaJeup2xhlr7BcLlyfIz4YTZneVB88mkNuMbbnpXSEhw3GbCPsJMNzOhI7Lz6G1
b09PJgtceBbfriKOfzlf9nJB/B7M0zz2LriYvvHi26g6mRGTm4jeH/QidnLxUcDj
PMmIDqFfRg5BdOicfV9jtm8mcKPyI07JIpvyvB12KlSoW1jY0ff5FnuAGL8JSJWo
hsYHYwVxPEOz5QH79QZVOGFypHUkm3cF1N96C2ifvgyM61+fBLetvM7FpMCmnMWM
V7RS+2gO/s7IkqydVN1b8/aXF1eUXr4w/hylF3NSBE+MlUn3R6Drv0iLwI+kf62T
UJ1YjfnaaCgjXIIDtVWr
=MvZR
-END PGP SIGNATURE-
diff -Nru libpeas-1.4.0/debian/changelog libpeas-1.4.0/debian/changelog
--- libpeas-1.4.0/debian/changelog	2012-05-28 00:40:22.0 -0400
+++ libpeas-1.4.0/debian/changelog	2012-06-20 22:31:30.0 -0400
@@ -1,3 +1,11 @@
+libpeas (1.4.0-2ubuntu2) quantal; urgency=low
+
+  * Build the Python 3 plugin, and enable it to exist next to the Python 2
+plugin (though only one can be used by an application at a time).  Add
+Python 3 support to peas-demo.
+
+ -- Barry Warsaw   Tue, 19 Jun 2012 11:16:15 -0400
+
 libpeas (1.4.0-2ubuntu1) quantal; urgency=low
 
   * Merge with Debian unstable, remaining Ubuntu changes:
diff -Nru libpeas-1.4.0/debian/control libpeas-1.4.0/debian/control
--- libpeas-1.4.0/debian/control	2012-06-20 22:33:01.0 -0400
+++ libpeas-1.4.0/debian/control	2012-06-20 22:31:35.0 -0400
@@ -10,6 +10,8 @@
 Uploaders: Debian GNOME Maintainers , Michael Biebl , Sjoerd Simons 
 Build-Depends: cdbs (>= 0.4.90),
debhelper (>= 8),
+   quilt,
+   autoconf,
gnome-pkg-tools,
intltool (>= 0.40),
gtk-doc-tools (>= 1.11),
@@ -20,6 +22,7 @@
libgtk-3-dev,
python-dev (>= 2.5.2),
python-gi-dev (>= 3.0.0),
+   python3-dev,
valac-0.14,
gnome-icon-theme
 Standards-Version: 3.9.3
diff -Nru libpeas-1.4.0/debian/control.in libpeas-1.4.0/debian/control.in
--- libpeas-1.4.0/debian/control.in	2012-05-28 00:40:22.0 -0400
+++ libpeas-1.4.0/debian/control.in	2012-06-20 17:14:04.0 -0400
@@ -5,6 +5,8 @@
 Uploaders: @GNOME_TEAM@
 Build-Depends: cdbs (>= 0.4.90),
debhelper (>= 8),
+   quilt,
+   autoconf,
gnome-pkg-tools,
intltool (>= 0.40),
gtk-doc-tools (>= 1.11),
@@ -15,6 +17,7 @@
libgtk-3-dev,
python-dev (>= 2.5.2),
python-gi-dev (>= 3.0.0),
+   python3-dev,
valac-0.14,
gnome-icon-theme
 Standards-Version: 3.9.3
diff -Nru libpeas-1.4.0/debian/patches/python3-demo.patch libpeas-1.4.0/debian/patches/python3-demo.patch
--- libpeas-1.4.0/debian/patches/python3-demo.patch	1969-12-31 19:00:00.0 -0500
+++ libpeas-1.4.0/debian/patches/python3-demo.pat