[Sugar-devel] [PATCH] Support isolated start

2010-10-22 Thread Aleksey Lim
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 +-
 bin/Makefile.am|2 +-
 bin/sugar  |   91 
 bin/sugar-session  |1 -
 bin/sugar.in   |   82 
 configure.ac   |1 -
 src/jarabe/config.py.in|   17 ---
 src/jarabe/model/bundleregistry.py |7 ++-
 sweets.recipe  |   49 +++
 9 files changed, 156 insertions(+), 97 deletions(-)
 create mode 100755 bin/sugar
 mode change 100644 = 100755 bin/sugar-activity
 mode change 100644 = 100755 bin/sugar-control-panel
 mode change 100644 = 100755 bin/sugar-install-bundle
 mode change 100644 = 100755 bin/sugar-launch
 mode change 100644 = 100755 bin/sugar-ui-check
 delete mode 100644 bin/sugar.in
 create mode 100644 sweets.recipe

diff --git a/.gitignore b/.gitignore
index 047a849..0f7dc7f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,6 +13,8 @@ Makefile.in
 .*.sw?
 *.service
 stamp-*
+*.tar.*
+.sweets
 
 # Absolute
 
@@ -51,7 +53,6 @@ m4/intltool.m4
 sugar/browser/_sugarbrowser.c
 browser/sugar-marshal.c
 browser/sugar-marshal.h
-bin/sugar
 shell/extensions/_extensions.c
 data/sugar.gtkrc
 data/sugar.xml
diff --git a/bin/Makefile.am b/bin/Makefile.am
index 05a9215..bf66dbd 100644
--- a/bin/Makefile.am
+++ b/bin/Makefile.am
@@ -11,4 +11,4 @@ bin_SCRIPTS = \
sugar   \
$(python_scripts)
 
-EXTRA_DIST = $(python_scripts) sugar.in
+EXTRA_DIST = $(python_scripts)
diff --git a/bin/sugar b/bin/sugar
new file mode 100755
index 000..9d079ed
--- /dev/null
+++ b/bin/sugar
@@ -0,0 +1,91 @@
+#!/bin/sh
+
+if [ $(id -u) -eq 0 -o $(id -ru) -eq 0 ] ; then
+   echo Refusing to run as root.
+   exit 3
+fi
+
+usage() {
+cat EOF
+Usage: sugar [OPTION]..
+
+Start Sugar window manager.
+
+Optional arguments.
+  -d, --display DISPLAY Display to start sugar
+  -s, --scaling SCALING Scale Sugar theme
+Supported values: 72, 100
+EOF
+exit 0
+}
+
+while [ $# -ne 0 ] ; do
+case $1 in
+   -d | --display)
+shift
+export DISPLAY=$1
+;;
+   -s | --scaling)
+shift
+export SUGAR_SCALING=$1
+;;
+   -h | --help)
+usage
+;;
+esac
+shift
+done
+
+# Set default profile dir
+if test -z $SUGAR_PROFILE; then
+export SUGAR_PROFILE=default
+fi
+
+if test $SUGAR_SHELL_PREFIX; then
+include=include \\$(HOME)/.sugar/gconf.path\
+grep $include ~/.gconf.path /dev/null 21 || \
+echo $include  ~/.gconf.path
+mkdir -p ~/.sugar
+echo xml:readonly:$SUGAR_SHELL_PREFIX/gconf.xml  ~/.sugar/gconf.path
+gconftool-2 --shutdown
+fi
+
+if test -z $SUGAR_SCALING; then
+export SUGAR_SCALING=72
+fi
+
+export GTK2_RC_FILES=$(dirname $(dirname 
$0))/share/sugar/data/sugar-$SUGAR_SCALING.gtkrc
+
+# Needed for executing wpa_passphrase
+export PATH=$PATH:/sbin:/usr/sbin
+
+if ! test -f $GTK2_RC_FILES; then
+echo sugar: ERROR: Gtk theme for scaling $SUGAR_SCALING not available in 
path $GTK2_RC_FILES
+exit 1
+fi
+
+# Set default language
+export LANG=${LANG:-en_US.utf8}
+export LANGUAGE=${LANGUAGE:-${LANG}}
+
+# Set Sugar's telepathy accounts directory
+export MC_ACCOUNT_DIR=$HOME/.sugar/$SUGAR_PROFILE/accounts
+
+# Workaround until gnome-keyring-daemon lets dbus activate it
+# https://bugzilla.gnome.org/show_bug.cgi?id=628302
+if test $SUGAR_EMULATOR = yes -a $(type gnome-keyring-daemon); then
+gnome-keyring-daemon --components=secrets 
+fi
+
+# Source language settings and debug definitions
+if [ -f ~/.i18n ]; then
+. ~/.i18n
+fi
+if [ -f ~/.sugar/debug ]; then
+. ~/.sugar/debug
+fi
+
+echo Xcursor.theme: sugar | xrdb -merge
+metacity --no-force-fullscreen -d $DISPLAY 
+
+exec sugar-session
diff --git a/bin/sugar-activity b/bin/sugar-activity
old mode 100644
new mode 100755
diff --git a/bin/sugar-control-panel b/bin/sugar-control-panel
old mode 100644
new mode 100755
diff --git a/bin/sugar-install-bundle b/bin/sugar-install-bundle
old mode 100644
new mode 100755
diff --git a/bin/sugar-launch b/bin/sugar-launch
old mode 100644
new mode 100755
diff --git a/bin/sugar-session b/bin/sugar-session
index 91ebf6f..e2157ba 100755
--- a/bin/sugar-session
+++ b/bin/sugar-session
@@ -218,7 +218,6 @@ def main():
 # strings in the module scope.
 from jarabe import config
 gettext.bindtextdomain('sugar', config.locale_path)
-gettext.bindtextdomain('sugar-toolkit', config.locale_path)
 gettext.textdomain('sugar')
 
 from jarabe.desktop import 

[Sugar-devel] [PATCH] Support isolated start

2010-10-22 Thread Aleksey Lim
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|2 ++
 sweets.recipe |   29 +
 2 files changed, 31 insertions(+), 0 deletions(-)
 create mode 100644 sweets.recipe

diff --git a/.gitignore b/.gitignore
index 9acb07c..4ad2f8c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,3 +38,5 @@ test/exported_*
 .DS_Store
 gtk/theme/sugar-100.gtkrc
 gtk/theme/sugar-72.gtkrc
+*.tar.*
+.sweets
diff --git a/sweets.recipe b/sweets.recipe
new file mode 100644
index 000..5e39563
--- /dev/null
+++ b/sweets.recipe
@@ -0,0 +1,29 @@
+[DEFAULT]
+sweet = sugar-artwork
+summary   = Themes and icons
+license   = LGPLv2.1+
+homepage  = http://git.sugarlabs.org/projects/sugar-artwork
+
+version   = 0.90.0
+stability = testing
+
+depends   = gtk; pygobject; cairo = 0.1.1
+
+[Component]
+requires  = %(depends)s
+binding   = GTK_PATH lib/gtk-2.0
+replace GTK_DATA_PREFIX
+XDG_DATA_DIRS share
+XCURSOR_PATH share/icons
+arch  = any
+
+[Build]
+requires  = %(depends)s; icon-slicer; icon-naming-utils; xcursorgen
+pkg-config; make; gcc-c
+cleanup   = make distclean; ./autogen.sh
+configure = ./configure --prefix=%(PREFIX)s CFLAGS=%(CFLAGS)s
+make  = make
+install   = make DESTDIR=%(DESTDIR)s install
+
+[Source]
+exec  = ./autogen.sh  make dist
-- 
1.7.2.2

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH] Support isolated start

2010-10-22 Thread Aleksey Lim
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 |4 
 src/Makefile.am|3 +++
 src/__init__.py|   20 
 src/sugar/Makefile.am  |4 ++--
 src/sugar/__init__.py  |   13 -
 src/sugar/dispatch/Makefile.am |2 +-
 sweets.recipe  |   33 +
 7 files changed, 63 insertions(+), 16 deletions(-)
 create mode 100644 src/__init__.py
 create mode 100644 sweets.recipe

diff --git a/.gitignore b/.gitignore
index 25cb6e9..8285052 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,10 @@
 *.lo
 *.la
 stamp-*
+m4/*
+*.so
+*.tar.*
+.sweets
 
 # Absolute
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 4fa44db..c399f12 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1 +1,4 @@
 SUBDIRS = sugar
+
+sugardir = $(pythondir)/sugar_base
+sugar_PYTHON = __init__.py
diff --git a/src/__init__.py b/src/__init__.py
new file mode 100644
index 000..3ff9423
--- /dev/null
+++ b/src/__init__.py
@@ -0,0 +1,20 @@
+# 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 3 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/.
+
+import gettext
+from os.path import join, dirname
+
+locale_path = join(dirname(__file__), '..', '..', 'share', 'locale')
+gettext.bindtextdomain('sugar-base', locale_path)
diff --git a/src/sugar/Makefile.am b/src/sugar/Makefile.am
index 871871e..3db2eda 100644
--- a/src/sugar/Makefile.am
+++ b/src/sugar/Makefile.am
@@ -2,13 +2,13 @@ SUBDIRS = dispatch
 
 INCLUDES = -DXDG_PREFIX=sugar_mime
 
-sugardir = $(pythondir)/sugar
+sugardir = $(pythondir)/sugar_base/sugar
 sugar_PYTHON = \
__init__.py \
logger.py   \
mime.py
 
-pkgpyexecdir = $(pythondir)/sugar
+pkgpyexecdir = $(pythondir)/sugar_base/sugar
 
 pkgpyexec_LTLIBRARIES = _sugarbaseext.la
 
diff --git a/src/sugar/__init__.py b/src/sugar/__init__.py
index d24d665..2683bc6 100644
--- a/src/sugar/__init__.py
+++ b/src/sugar/__init__.py
@@ -15,16 +15,3 @@
 # 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 os
-import gettext
-
-
-if 'SUGAR_PREFIX' in os.environ:
-prefix = os.environ['SUGAR_PREFIX']
-else:
-prefix = '/usr'
-
-locale_path = os.path.join(prefix, 'share', 'locale')
-
-gettext.bindtextdomain('sugar-base', locale_path)
diff --git a/src/sugar/dispatch/Makefile.am b/src/sugar/dispatch/Makefile.am
index eb44a32..ad0f69d 100644
--- a/src/sugar/dispatch/Makefile.am
+++ b/src/sugar/dispatch/Makefile.am
@@ -1,4 +1,4 @@
-sugardir = $(pythondir)/sugar/dispatch
+sugardir = $(pythondir)/sugar_base/sugar/dispatch
 sugar_PYTHON = \
__init__.py \
dispatcher.py   \
diff --git a/sweets.recipe b/sweets.recipe
new file mode 100644
index 000..581c774
--- /dev/null
+++ b/sweets.recipe
@@ -0,0 +1,33 @@
+[DEFAULT]
+sweet = sugar-base
+summary   = Helpers for the development of services and activities
+license   = LGPLv2.1+
+homepage  = http://git.sugarlabs.org/projects/sugar-base
+
+version   = 0.90.1
+stability = testing
+
+depends   = pygtk; pygobject = 2.15
+
+[Component]
+requires  = %(depends)s; decorator
+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/sugar_base/sugar 
+ln -s %(BUILDDIR)s/src/sugar 
%(DESTDIR)s/%(PREFIX)s/python/sugar_base/ 
+ln -fs .libs/_sugarbaseext.so src/sugar/
+
+[Source]
+exec  = ./autogen.sh  make dist
-- 
1.7.2.2

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH] Support isolated start

2010-10-22 Thread Aleksey Lim
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 000..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 000..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)
 

[Sugar-devel] [PATCH] Support isolated start

2010-10-22 Thread Aleksey Lim
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|2 ++
 src/sugar-presence-service.in |4 +++-
 sweets.recipe |   27 +++
 3 files changed, 32 insertions(+), 1 deletions(-)
 create mode 100644 sweets.recipe

diff --git a/.gitignore b/.gitignore
index 89e441e..7b18edf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,8 @@ Makefile.in
 *.loT
 .*.sw?
 *.service
+*.tar.*
+.sweets
 
 # Absolute
 
diff --git a/src/sugar-presence-service.in b/src/sugar-presence-service.in
index ff8d66a..96c9757 100644
--- a/src/sugar-presence-service.in
+++ b/src/sugar-presence-service.in
@@ -16,8 +16,10 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 import sys
+from os.path import join, dirname
 
-sys.path.append('@prefix@/share/sugar-presence-service')
+path = join(dirname(__file__), '..', 'share', 'sugar-presence-service')
+sys.path.append(path)
 
 import main
 
diff --git a/sweets.recipe b/sweets.recipe
new file mode 100644
index 000..bde72a5
--- /dev/null
+++ b/sweets.recipe
@@ -0,0 +1,27 @@
+[DEFAULT]
+sweet = sugar-presence-service
+summary   = Interfaces between Sugar and Telepathy Connection Managers
+license   = LGPLv2.1+
+homepage  = http://git.sugarlabs.org/projects/sugar-presence-service
+
+version   = 0.90.1
+stability = testing
+
+[Component]
+requires  = sugar-toolkit; telepathy-python
+telepathy-salut = 0.4; telepathy-gabble = 0.10
+binding   = PATH bin; XDG_DATA_DIRS share
+arch  = any
+
+[Build]
+requires  = make
+cleanup   = make distclean; ./autogen.sh
+configure = ./configure --prefix=%(PREFIX)s
+make  = make
+install   = make DESTDIR=%(DESTDIR)s install
+implement = %(install)s 
+rm -rf %(DESTDIR)s/%(PREFIX)s/share/sugar-presence-service 
+ln -s %(BUILDDIR)s/src 
%(DESTDIR)s/%(PREFIX)s/share/sugar-presence-service
+
+[Source]
+exec  = ./autogen.sh  make dist
-- 
1.7.2.2

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel