Ticket #7205: 0001-bug-7205-bundlebuilder-accepts-old-dist-doesn-t.patch

File 0001-bug-7205-bundlebuilder-accepts-old-dist-doesn-t.patch, 2.1 KB (added by homunq, 6 years ago)

proposed patch to fix

  • src/sugar/activity/bundlebuilder.py

    From 1aab51842c4474073954b95e4759c9d27276b550 Mon Sep 17 00:00:00 2001
    From: chema <chema@chema-laptop.(none)>
    Date: Thu, 10 Jul 2008 13:37:09 -0600
    Subject: [PATCH] bug 7205: bundlebuilder accepts old "dist", doesn't bomb on missing po dir
    
    ---
     src/sugar/activity/bundlebuilder.py |    8 ++++++++
     src/sugar/bundle/bundle.py          |   13 ++++++++++++-
     2 files changed, 20 insertions(+), 1 deletions(-)
    
    diff --git a/src/sugar/activity/bundlebuilder.py b/src/sugar/activity/bundlebuilder.py
    index 5afd78f..6c04d88 100644
    a b class Builder(object): 
    8181    def build_locale(self): 
    8282        po_dir = os.path.join(self.config.source_dir, 'po') 
    8383 
     84        if not config.bundle.is_dir(po_dir): 
     85            logging.warn("Missiong po/ dir, cannot build_locale") 
     86            return 
     87         
    8488        for f in os.listdir(po_dir): 
    8589            if not f.endswith('.po'): 
    8690                continue 
    def cmd_dist_xo(config, options, args): 
    214218    packager = XOPackager(config) 
    215219    packager.package() 
    216220 
     221def cmd_dist(config, options, args): 
     222    logging.warn("dist deprecated, use dist_xo.") 
     223    cmd_dist_xo(config, options, args) 
     224 
    217225def cmd_dist_source(config, options, args): 
    218226    packager = SourcePackager(config) 
    219227    packager.package() 
  • src/sugar/bundle/bundle.py

    diff --git a/src/sugar/bundle/bundle.py b/src/sugar/bundle/bundle.py
    index 9e876c2..eccbe9a 100644
    a b class Bundle: 
    132132                zip_file.close() 
    133133 
    134134            return True 
    135                  
     135 
     136    def is_dir(self, filename): 
     137        if self._unpacked: 
     138            path = os.path.join(self._path, filename) 
     139            return os.path.isdir(path) 
     140        else: 
     141            zip_file = zipfile.ZipFile(self._path) 
     142            path = os.path.join(self._zip_root_dir, filename, "") 
     143            for subfile in zip_file.namelist(): 
     144                if subfile.startswith(path): 
     145                    return True 
     146            return False 
    136147 
    137148    def get_path(self): 
    138149        """Get the bundle path."""