From 3313d78429dea74c81fef707b12b144414643e90 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Sun, 25 May 2008 21:47:32 +0200 Subject: [PATCH] Simplify install a bit, remove uninstall. --- src/sugar/activity/bundlebuilder.py | 42 ++++++++++++++--------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/src/sugar/activity/bundlebuilder.py b/src/sugar/activity/bundlebuilder.py index 9619ef1e..487110ba 100644 --- a/src/sugar/activity/bundlebuilder.py +++ b/src/sugar/activity/bundlebuilder.py @@ -92,22 +92,6 @@ class _AllFileList(list): f != '.gitignore': self.append(os.path.join(root, f)) -def _extract_bundle(source_file, dest_dir): - if not os.path.exists(dest_dir): - os.mkdir(dest_dir) - - zf = zipfile.ZipFile(source_file) - - for name in zf.namelist(): - path = os.path.join(dest_dir, name) - if not os.path.exists(os.path.dirname(path)): - os.makedirs(os.path.dirname(path)) - - outfile = open(path, 'wb') - outfile.write(zf.read(name)) - outfile.flush() - outfile.close() - def cmd_help(config, options, args): print 'Usage: \n\ setup.py dev - setup for development \n\ @@ -185,14 +169,25 @@ def cmd_install(config, options, args): path = args[0] cmd_dist(config, options, args) - cmd_uninstall(config, options, args) - _extract_bundle(config.xo_name, path) + root_path = os.path.join(args[0], config.bundle_root_dir) + if os.path.isdir(root_path): + shutil.rmtree(root_path) -def cmd_uninstall(config, options, args): - path = os.path.join(args[0], config.bundle_top_dir) - if os.path.isdir(path): - shutil.rmtree(path) + if not os.path.exists(path): + os.mkdir(path) + + zf = zipfile.ZipFile(config.xo_name) + + for name in zf.namelist(): + full_path = os.path.join(path, name) + if not os.path.exists(os.path.dirname(full_path)): + os.makedirs(os.path.dirname(full_path)) + + outfile = open(full_path, 'wb') + outfile.write(zf.read(name)) + outfile.flush() + outfile.close() def cmd_genpot(config, options, args): po_path = os.path.join(config.source_dir, 'po') @@ -331,6 +326,9 @@ def cmd_release(config, options, args): print 'Done.' +def cmd_build(config, options, args): + pass + def start(bundle_name, manifest='MANIFEST'): parser = OptionParser() (options, args) = parser.parse_args()