[Sugar-devel] Why cannot collections of ---.xo files on a USB stick be run without installation in sugar?

James Cameron quozl at laptop.org
Tue Mar 1 01:38:47 EST 2011


On Mon, Feb 28, 2011 at 08:17:06AM -0800, Thomas C Gilliard wrote:
> Why cannot collections of ---.xo files on a USB stick be run without
> installation in sugar?

That would be nice.  In the meanwhile, a workaround:

	cd /media/stick
	for x in *.xo; do sugar-install-bundle $x; done

Unfortunate that it has to be done this way, so here's a patch to fix
it so that the for loop is moved from shell to python.

Subject: [PATCH] sugar-install-bundle to accept multiple files

Signed-off-by: James Cameron <quozl at laptop.org>
---
 bin/sugar-install-bundle |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/bin/sugar-install-bundle b/bin/sugar-install-bundle
index 52deada..a034135 100644
--- a/bin/sugar-install-bundle
+++ b/bin/sugar-install-bundle
@@ -1,5 +1,6 @@
 #!/usr/bin/env python
 import sys
+import fileinput
 
 from sugar.bundle.activitybundle import ActivityBundle
 
@@ -14,7 +15,8 @@ if len(sys.argv) != 2:
     cmd_help()
     sys.exit(2)
 
-bundle = ActivityBundle(sys.argv[1])
-bundle.install()
-
-print "%s: '%s' installed." % (sys.argv[0], sys.argv[1])
+for line in fileinput.input():
+    if line:
+        bundle = ActivityBundle(line)
+        bundle.install()
+        print "%s: '%s' installed." % (sys.argv[0], line)
-- 
1.7.2.3

-- 
James Cameron
http://quozl.linux.org.au/


More information about the Sugar-devel mailing list