Really this is a convenience function, but since we're now being picky about
MANIFEST, I think that not having a way to fix the MANIFEST counts as a
regression. Thus I do nominate this for 8.2 .

fix_manifest.patch is just these changes, but it collides with the other
patch I submitted. combined.patch is both patches together.
diff --git a/src/sugar/activity/bundlebuilder.py b/src/sugar/activity/bundlebuilder.py
index 2480b03..52cd3e5 100644
--- a/src/sugar/activity/bundlebuilder.py
+++ b/src/sugar/activity/bundlebuilder.py
@@ -192,6 +192,8 @@ setup.py uninstall [dirname] - uninstall the bundle \n\
 setup.py genpot              - generate the gettext pot file \n\
 setup.py release             - do a new release of the bundle \n\
 setup.py help                - print this message \n\
+setup.py fix_manifest        - fix the MANIFEST file to list all files in directory \n\
+                             except dist/* .git/* .gitignore MANIFEST *.pyc *~ *.bak \n\
 '
 
 def cmd_dev(config, options, args):
@@ -361,6 +363,10 @@ def cmd_build(config, options, args):
     builder = Builder(config)
     builder.build()
 
+def cmd_fix_manifest(config, options, args):
+    buildpackager = BuildPackager(config)
+    buildpackager.fix_manifest()
+
 def start(bundle_name=None):
     if bundle_name:
         logging.warn("bundle_name deprecated, now comes from activity.info")
diff --git a/src/sugar/activity/bundlebuilder.py b/src/sugar/activity/bundlebuilder.py
index 2480b03..7744f0b 100644
--- a/src/sugar/activity/bundlebuilder.py
+++ b/src/sugar/activity/bundlebuilder.py
@@ -81,6 +81,10 @@ class Builder(object):
     def build_locale(self):
         po_dir = os.path.join(self.config.source_dir, 'po')
 
+        if not self.config.bundle.is_dir(po_dir):
+            logging.warn("Missing po/ dir, cannot build_locale")
+            return
+        
         for f in os.listdir(po_dir):
             if not f.endswith('.po'):
                 continue
@@ -192,6 +196,8 @@ setup.py uninstall [dirname] - uninstall the bundle \n\
 setup.py genpot              - generate the gettext pot file \n\
 setup.py release             - do a new release of the bundle \n\
 setup.py help                - print this message \n\
+setup.py fix_manifest        - fix the MANIFEST file to list all files in directory \n\
+                             except dist/* .git/* .gitignore MANIFEST *.pyc *~ *.bak \n\
 '
 
 def cmd_dev(config, options, args):
@@ -214,6 +220,10 @@ def cmd_dist_xo(config, options, args):
     packager = XOPackager(config)
     packager.package()
 
+def cmd_dist(config, options, args):
+    logging.warn("dist deprecated, use dist_xo.")
+    cmd_dist_xo(config, options, args)
+
 def cmd_dist_source(config, options, args):
     packager = SourcePackager(config)
     packager.package()
@@ -361,6 +371,10 @@ def cmd_build(config, options, args):
     builder = Builder(config)
     builder.build()
 
+def cmd_fix_manifest(config, options, args):
+    buildpackager = BuildPackager(config)
+    buildpackager.fix_manifest()
+
 def start(bundle_name=None):
     if bundle_name:
         logging.warn("bundle_name deprecated, now comes from activity.info")
diff --git a/src/sugar/bundle/bundle.py b/src/sugar/bundle/bundle.py
index 9e876c2..eccbe9a 100644
--- a/src/sugar/bundle/bundle.py
+++ b/src/sugar/bundle/bundle.py
@@ -132,7 +132,18 @@ class Bundle:
                 zip_file.close()
 
             return True
-                
+
+    def is_dir(self, filename):
+        if self._unpacked:
+            path = os.path.join(self._path, filename)
+            return os.path.isdir(path)
+        else:
+            zip_file = zipfile.ZipFile(self._path)
+            path = os.path.join(self._zip_root_dir, filename, "")
+            for subfile in zip_file.namelist():
+                if subfile.startswith(path):
+                    return True
+            return False
 
     def get_path(self):
         """Get the bundle path."""
_______________________________________________
Sugar mailing list
[email protected]
http://lists.laptop.org/listinfo/sugar

Reply via email to