Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/ssb.py
diff options
context:
space:
mode:
Diffstat (limited to 'ssb.py')
-rw-r--r--ssb.py41
1 files changed, 21 insertions, 20 deletions
diff --git a/ssb.py b/ssb.py
index b46569b..3e4f7b7 100644
--- a/ssb.py
+++ b/ssb.py
@@ -14,8 +14,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-import shutil
import os
+import shutil
import tempfile
import zipfile
import ConfigParser
@@ -23,7 +23,7 @@ import logging
from fnmatch import fnmatch
from sugar.activity import activity
-from sugar.bundle.activitybundle import ActivityBundle
+from sugar.bundle import activitybundle
from sugar.datastore import datastore
from sugar import profile
@@ -36,8 +36,25 @@ IGNORE_FILES = ['.gitignore', 'MANIFEST', '*.pyc', '*~', '*.bak',
def get_is_ssb(activity):
'''determine if the activity is an SSB'''
return activity.get_bundle_id().startswith(DOMAIN_PREFIX)
+
+def copy_profile():
+ '''get the data from the bundle and into the profile'''
+ ssb_data_path = os.path.join(activity.get_bundle_path(), 'data/ssb_data')
+ data_path = os.path.join(activity.get_activity_root(), 'data')
+
+ if os.path.isdir(ssb_data_path):
+ # we can't use shutil.copytree for the entire dir
+ for i in os.listdir(ssb_data_path):
+ src = os.path.join(ssb_data_path, i)
+ dst = os.path.join(data_path, i)
+ if not os.path.exists(dst):
+ if os.path.isdir(src):
+ shutil.copytree(src, dst)
+ else: # is there a better way?
+ shutil.copy(src, dst)
def list_files(base_dir, ignore_dirs=None, ignore_files=None):
+ '''from bundlebuilder.py'''
result = []
base_dir = os.path.abspath(base_dir)
@@ -72,22 +89,6 @@ def remove_paths(paths, root=None):
except OSError:
logging.warning('failed to remove: ' + path)
-def copy_profile():
- '''get the data from the bundle and into the profile'''
- ssb_data_path = os.path.join(activity.get_bundle_path(), 'data/ssb_data')
- data_path = os.path.join(activity.get_activity_root(), 'data')
-
- if os.path.isdir(ssb_data_path):
- # we can't use shutil.copytree for the entire dir
- for i in os.listdir(ssb_data_path):
- src = os.path.join(ssb_data_path, i)
- dst = os.path.join(data_path, i)
- if not os.path.exists(dst):
- if os.path.isdir(src):
- shutil.copytree(src, dst)
- else: # is there a better way?
- shutil.copy(src, dst)
-
class SSBCreator(object):
def __init__(self, title, uri):
self.title = title
@@ -145,7 +146,7 @@ class SSBCreator(object):
# copy profile
ssb_data_path = os.path.join(self.ssb_path, 'data/ssb_data')
shutil.copytree(self.data_path, ssb_data_path)
-
+
# delete undesirable things from the profile
remove_paths(['Cache', 'cookies.sqlite'],
root=os.path.join(ssb_data_path, 'gecko'))
@@ -172,7 +173,7 @@ class SSBCreator(object):
def install(self):
'''install the generated .xo bundle'''
- bundle = ActivityBundle(self.xo_path)
+ bundle = activitybundle.ActivityBundle(self.xo_path)
bundle.install()
def show_in_journal(self):