From 154a0e91ffece83fd1e7ef836c6faaa83166e93c Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Sun, 18 Mar 2007 13:48:34 +0100 Subject: [PATCH] Create ~/Activities only when necessary --- sugar/activity/bundlebuilder.py | 8 ++++---- sugar/env.py | 5 +---- tools/build-snapshot.sh | 2 +- tools/sugar-install-bundle | 2 ++ 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/sugar/activity/bundlebuilder.py b/sugar/activity/bundlebuilder.py index 120e7b8c..be1d200b 100644 --- a/sugar/activity/bundlebuilder.py +++ b/sugar/activity/bundlebuilder.py @@ -92,9 +92,6 @@ def _get_bundle_dir(): def _get_install_dir(prefix): return os.path.join(prefix, 'share/activities') -def _get_bundle_path(): - return os.path.join(env.get_user_activities_path(), _get_bundle_dir()) - def _get_package_name(): bundle = Bundle(_get_source_path()) zipname = '%s-%d.xo' % (bundle.get_name(), bundle.get_activity_version()) @@ -120,7 +117,10 @@ setup.py help - print this message \n\ ' def cmd_dev(): - bundle_path = os.path.join(env.get_user_activities_path(), _get_bundle_dir()) + bundle_path = env.get_user_activities_path() + if not os.path.isdir(bundle_path): + os.mkdir(bundle_path) + bundle_path = os.path.join(bundle_path, _get_bundle_dir()) try: os.symlink(_get_source_path(), bundle_path) except OSError: diff --git a/sugar/env.py b/sugar/env.py index 49389400..2acdcb92 100644 --- a/sugar/env.py +++ b/sugar/env.py @@ -53,10 +53,7 @@ def get_profile_path(path=None): return base def get_user_activities_path(): - path = os.path.expanduser('~/Activities') - if not os.path.isdir(path): - os.mkdir(path) - return path + return os.path.expanduser('~/Activities') def get_bin_path(path=None): return _get_prefix_path('bin', path) diff --git a/tools/build-snapshot.sh b/tools/build-snapshot.sh index 1b55685f..13c9a665 100755 --- a/tools/build-snapshot.sh +++ b/tools/build-snapshot.sh @@ -1,6 +1,6 @@ VERSION=0.63 DATE=`date +%Y%m%d` -RELEASE=2.53 +RELEASE=2.55 TARBALL=sugar-$VERSION-$RELEASE.${DATE}git.tar.bz2 rm sugar-$VERSION.tar.bz2 diff --git a/tools/sugar-install-bundle b/tools/sugar-install-bundle index a66cd81c..359c1c06 100755 --- a/tools/sugar-install-bundle +++ b/tools/sugar-install-bundle @@ -28,6 +28,8 @@ proxy_obj = bus.get_object(DBUS_SERVICE, DBUS_PATH) dbus_service = dbus.Interface(proxy_obj, DBUS_SERVICE) bundle_dir = env.get_user_activities_path() +if not os.path.isdir(bundle_dir): + os.mkdir(bundle_dir) zip_file = zipfile.ZipFile(sys.argv[1]) file_names = zip_file.namelist()