[Sugar-devel] [PATCH] Support isolated start

Aleksey Lim alsroot at member.fsf.org
Fri Oct 22 12:01:42 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                     |    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 0000000..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 0000000..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



More information about the Sugar-devel mailing list