[Sugar-devel] [PATCH] Support isolated start

Aleksey Lim alsroot at member.fsf.org
Fri Oct 22 12:02:59 EDT 2010


Running process is based on injection (how 0install works) of evironment
variables to final application process, e.g., via PYTHONPATH. Patch will let
bazaar.sugarlabs.org build sugar packages, also runnning from git cloned
directories will be supported (i.e., without jhbuild).
---
 .gitignore                       |    3 +++
 configure.ac                     |    1 +
 src/sugar/Makefile.am            |    8 ++++++--
 src/sugar/__init__.py            |   20 ++++++++++++++++++++
 src/sugar/_sugarbaseext.py       |   16 ++++++++++++++++
 src/sugar/activity/main.py       |    1 -
 src/sugar/dispatch/Makefile.am   |    6 ++++++
 src/sugar/dispatch/__init__.py   |   16 ++++++++++++++++
 src/sugar/dispatch/dispatcher.py |   16 ++++++++++++++++
 src/sugar/dispatch/saferef.py    |   16 ++++++++++++++++
 src/sugar/logger.py              |   16 ++++++++++++++++
 src/sugar/mime.py                |   16 ++++++++++++++++
 sweets.recipe                    |   34 ++++++++++++++++++++++++++++++++++
 13 files changed, 166 insertions(+), 3 deletions(-)
 create mode 100644 src/sugar/__init__.py
 create mode 100644 src/sugar/_sugarbaseext.py
 create mode 100644 src/sugar/dispatch/Makefile.am
 create mode 100644 src/sugar/dispatch/__init__.py
 create mode 100644 src/sugar/dispatch/dispatcher.py
 create mode 100644 src/sugar/dispatch/saferef.py
 create mode 100644 src/sugar/logger.py
 create mode 100644 src/sugar/mime.py
 create mode 100644 sweets.recipe

diff --git a/.gitignore b/.gitignore
index fe4cc56..a28347a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@
 *~
 .deps
 .libs
+*.so
 
 py-compile
 Makefile
@@ -22,3 +23,5 @@ libtool
 ltmain.sh
 missing
 compile
+*.tar.*
+.sweets
diff --git a/configure.ac b/configure.ac
index 41798ea..5b21a51 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,5 +44,6 @@ src/sugar/bundle/Makefile
 src/sugar/graphics/Makefile
 src/sugar/presence/Makefile
 src/sugar/datastore/Makefile
+src/sugar/dispatch/Makefile
 po/Makefile.in
 ])
diff --git a/src/sugar/Makefile.am b/src/sugar/Makefile.am
index 236e337..584edde 100644
--- a/src/sugar/Makefile.am
+++ b/src/sugar/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = activity bundle graphics presence datastore
+SUBDIRS = activity bundle graphics presence datastore dispatch
 
 sugardir = $(pythondir)/sugar
 sugar_PYTHON =		\
@@ -7,7 +7,11 @@ sugar_PYTHON =		\
 	profile.py	\
 	session.py	\
 	util.py		\
-	wm.py
+	wm.py \
+	_sugarbaseext.py \
+	logger.py \
+	mime.py \
+	__init__.py
 
 pkgpyexecdir = $(pythondir)/sugar
 
diff --git a/src/sugar/__init__.py b/src/sugar/__init__.py
new file mode 100644
index 0000000..b4fdb9a
--- /dev/null
+++ b/src/sugar/__init__.py
@@ -0,0 +1,20 @@
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+import gettext
+from os.path import join, dirname
+
+locale_path = join(dirname(__file__), '..', '..', 'share', 'locale')
+gettext.bindtextdomain('sugar-toolkit', locale_path)
diff --git a/src/sugar/_sugarbaseext.py b/src/sugar/_sugarbaseext.py
new file mode 100644
index 0000000..6602314
--- /dev/null
+++ b/src/sugar/_sugarbaseext.py
@@ -0,0 +1,16 @@
+# Copyright (C) 2010, Aleksey Lim
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser 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 General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+from sugar_base.sugar._sugarbaseext import *
diff --git a/src/sugar/activity/main.py b/src/sugar/activity/main.py
index c04257a..5b0a87d 100644
--- a/src/sugar/activity/main.py
+++ b/src/sugar/activity/main.py
@@ -111,7 +111,6 @@ def main():
     locale_path = i18n.get_locale_path(bundle.get_bundle_id())
 
     gettext.bindtextdomain(bundle.get_bundle_id(), locale_path)
-    gettext.bindtextdomain('sugar-toolkit', sugar.locale_path)
     gettext.textdomain(bundle.get_bundle_id())
 
     splitted_module = args[0].rsplit('.', 1)
diff --git a/src/sugar/dispatch/Makefile.am b/src/sugar/dispatch/Makefile.am
new file mode 100644
index 0000000..b2e5aed
--- /dev/null
+++ b/src/sugar/dispatch/Makefile.am
@@ -0,0 +1,6 @@
+sugardir = $(pythondir)/sugar/dispatch
+
+sugar_PYTHON = \
+	__init__.py \
+	dispatcher.py \
+	saferef.py
diff --git a/src/sugar/dispatch/__init__.py b/src/sugar/dispatch/__init__.py
new file mode 100644
index 0000000..195335a
--- /dev/null
+++ b/src/sugar/dispatch/__init__.py
@@ -0,0 +1,16 @@
+# Copyright (C) 2010, Aleksey Lim
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser 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 General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+from sugar_base.sugar.dispatch import *
diff --git a/src/sugar/dispatch/dispatcher.py b/src/sugar/dispatch/dispatcher.py
new file mode 100644
index 0000000..c5519cc
--- /dev/null
+++ b/src/sugar/dispatch/dispatcher.py
@@ -0,0 +1,16 @@
+# Copyright (C) 2010, Aleksey Lim
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser 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 General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+from sugar_base.sugar.dispatch.dispatcher import *
diff --git a/src/sugar/dispatch/saferef.py b/src/sugar/dispatch/saferef.py
new file mode 100644
index 0000000..28e50eb
--- /dev/null
+++ b/src/sugar/dispatch/saferef.py
@@ -0,0 +1,16 @@
+# Copyright (C) 2010, Aleksey Lim
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser 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 General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+from sugar_base.sugar.dispatch.saferef import *
diff --git a/src/sugar/logger.py b/src/sugar/logger.py
new file mode 100644
index 0000000..740b8c8
--- /dev/null
+++ b/src/sugar/logger.py
@@ -0,0 +1,16 @@
+# Copyright (C) 2010, Aleksey Lim
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser 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 General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+from sugar_base.sugar.logger import *
diff --git a/src/sugar/mime.py b/src/sugar/mime.py
new file mode 100644
index 0000000..f214587
--- /dev/null
+++ b/src/sugar/mime.py
@@ -0,0 +1,16 @@
+# Copyright (C) 2010, Aleksey Lim
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser 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 General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+from sugar_base.sugar.mime import *
diff --git a/sweets.recipe b/sweets.recipe
new file mode 100644
index 0000000..ae6c086
--- /dev/null
+++ b/sweets.recipe
@@ -0,0 +1,34 @@
+[DEFAULT]
+sweet     = sugar-toolkit
+summary   = A set of widgets to build HIG compliant activities
+license   = LGPLv2.1+
+homepage  = http://git.sugarlabs.org/projects/sugar-toolkit
+
+version   = 0.90.1
+stability = testing
+
+depends   = gtk; python; pygtk; libsm; alsa-lib
+
+[Component]
+requires  = %(depends)s; sugar-base; python-cjson; python-dateutil; unzip
+            librsvg-python; hippo-canvas-python; gconf-python; dbus-python
+binding   = PYTHONPATH = python
+arch      = any
+
+[Build]
+requires  = %(depends)s; pkg-config; intltool >= 0.33; make; gcc-c
+cleanup   = make distclean; ./autogen.sh
+configure = ./configure
+                --prefix=%(PREFIX)s
+                am_cv_python_pythondir=%(PREFIX)s/python
+                am_cv_python_pyexecdir=%(PREFIX)s/python
+                CFLAGS="%(CFLAGS)s"
+make      = make
+install   = make DESTDIR=%(DESTDIR)s install
+implement = %(install)s &&
+            rm -rf %(DESTDIR)s/%(PREFIX)s/python &&
+            ln -s %(BUILDDIR)s/src %(DESTDIR)s/%(PREFIX)s/python &&
+            ln -fs .libs/_sugarext.so src/sugar/
+
+[Source]
+exec      = ./autogen.sh && make dist
-- 
1.7.2.2



More information about the Sugar-devel mailing list