Re: [sugar] documentation effort for sugar api

2008-06-07 Thread Marco Pesenti Gritti
On Sat, Jun 7, 2008 at 4:43 AM, David Farning [EMAIL PROTECTED] wrote:
 On Thu, 2008-06-05 at 16:01 -0400, Faisal Anwar wrote:
 Hi Tomeu,

 Thanks for your email and willingness to help. I'm prioritizing
 getting something similar to the java almanac up and running, but if I
 can get a substantial body of how to's completed in the next couple of
 weeks, then I will prioritize working on the wikibot.
 Best,

 Has anyone looked into this process yet? It seems like we could get
 epydoc running in a couple of hour.  Epydoc create structured .html
 pages from the docstrings in the source code.

 git-clone git://dev.laptop.org/sugar
 cd sugar
 mkdir -p html/api
 epydoc -v -o html/api src
 firefox html/api/index.html

 A little fine tuning and we should be able to put the contents of
 html/api on our server.

Do you want to give it a try? :) Bernie could give you shell access to
sugarlabs.org and we could do it there.

I think it's something we really need and as you say it's easy to setup.

Btw the interesting modules to document are actually sugar-toolkit and
sugar-base.

Marco
___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


Re: [sugar] [IAEP] Fwd: Autonomous system for Sugar development....

2008-06-07 Thread Bernie Innocenti
Jim Gettys wrote:

 These discussions should be best be on email, or at worst scheduled,
 published in advance IRC meetings (*with minutes*).  This project is
 world wide, with participation in (almost) every timezone and continent;
 we must enable all interested to participate.  As projects grow, IRC is
 less and less appropriate for such discussion, and any IRC use needs to
 become scheduled pre-published events (and even then, you leave out
 people on some parts of the world).  Mail has the features of leaving a
 record, and allowing time-shifting.

My ancestors would say verba volant, scripta manent.

-- 
   \___/  Bernie Innocenti - http://www.codewiz.org/
  _| X |  Sugar Labs Team  - http://www.sugarlabs.org/
  \|_O_|  It's an education project, not a laptop project!

___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


[sugar] [PATCH] New startup notification

2008-06-07 Thread Marco Pesenti Gritti
Hello,

this is heavily based on Eben work. Full patch is attached, splitted
up commits here (from Remove pending...):
http://dev.laptop.org/git?p=users/marco/sugar;a=summary

Not very well tested, I would like to get the big changes in and
gradually improve on the base of it. It should be good enough to make
the freeze.

Eben, I had to increase the animation time to be able to see it, not sure why.

Tomeu, I didn't do the iconify things for now, I have some doubts
about it and this patch ended up not requiring huge changes to the
model, so we can do that in a separate step.

Marco


startup.diff
Description: Binary data
___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


Re: [sugar] [PATCH] Bundlebuilder use manifest, fix_manifest function

2008-06-07 Thread Marco Pesenti Gritti
I'm still getting a few pylint errors, you don't?. Also can you please
answer the question/notes I posted before I go ahead an do a full
review?

Thanks,
Marco
___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


Re: [sugar] [PATCH] Bundlebuilder use manifest, fix_manifest function

2008-06-07 Thread Jameson Chema Quinn
I'm away from my machine, but quick response, I'll say more later.


On Sat, Jun 7, 2008 at 6:51 AM, Marco Pesenti Gritti [EMAIL PROTECTED]
wrote:

 I'm still getting a few pylint errors, you don't?.


I was just getting defined outside of __init__ for ActivityBundle.manifest
... I don't know how I'm supposed to fix that, since it is defined from a
subroutine of __init__ that is also useful elsewhere.


 Also can you please
 answer the question/notes I posted before I go ahead an do a full
 review?


OK, here:

* Please run pylint on the changed files. You can use
sugar-jhbuild/scripts/data

 /pylintrc. That will catch several problems
 and nitpicks that I'd ask you to fix anyway.


Done, I think, I will check again later.


 * I dont understand all the
 warnings.warn(MalformedBundleException(...)). What's the purpose of
 those. Shouldn't they be real exceptions? What's the advantage of
 using the warnings module over logging.warning?


fixed in the patch I reposted


* I'm not sure what you are using dest_dir for, but it looks like it
should be part of Config.

again, fixed.

* Why are you moving the activity and env imports inline.

I answered that in my previous email: to make it easier to use these files
without having the rest of Sugar installed.
___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


Re: [sugar] documentation effort for sugar api

2008-06-07 Thread Bernie Innocenti
David Farning wrote:
 On Sat, 2008-06-07 at 10:26 +0200, Marco Pesenti Gritti wrote:
 
 A little fine tuning and we should be able to put the contents of
 html/api on our server.
 Do you want to give it a try? :) Bernie could give you shell access to
 sugarlabs.org and we could do it there.
 
 I am willing to give it a try.  Could you or Bernie configure apache to
 serve a static folder for the API files?  I don't feel comfortable
 messing with configurations on a live systems.

Sure.  Send me your ssh keys and the username you desire, and I'll create
an account for you.

Then, put the output in ~/public_html, test, and let me know.  You can
use cron of course.

-- 
   \___/  Bernie Innocenti - http://www.codewiz.org/
  _| X |  Sugar Labs Team  - http://www.sugarlabs.org/
  \|_O_|  It's an education project, not a laptop project!
___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


Re: [sugar] [PATCH] Bundlebuilder use manifest, fix_manifest function

2008-06-07 Thread Jameson Chema Quinn
bundleManifest.all2.patch /*here*/ = (bundleMANIFEST.patch +
bundleManifest.subpatch + bundleMANIFEST.sub2.patch /*here*/)

bundleMANIFEST.sub2.patch makes bundle.Bundle.is_file public, makes version
an  attribute of bundlebuilder.RawActivity (and all children), and fixes a
minor versioning bug in cmd_release.

On Sat, Jun 7, 2008 at 7:54 PM, Jameson Chema Quinn [EMAIL PROTECTED]
wrote:

 oops, I left out the more complete patch. As I said,

 bundleManifest.all.patch /*here*/ = (bundleMANIFEST.patch /*15K, included
 in msg 3 of this thread*/ + bundleManifest.subpatch /*included in previous
 message*/)

diff --git a/src/sugar/activity/bundlebuilder.py b/src/sugar/activity/bundlebuilder.py
index 1063f72..1b682a2 100644
--- a/src/sugar/activity/bundlebuilder.py
+++ b/src/sugar/activity/bundlebuilder.py
@@ -19,64 +19,45 @@ import os
 import zipfile
 import tarfile
 import shutil
-import subprocess
+from subprocess import Popen, PIPE
 import re
 import gettext
 from optparse import OptionParser
+import subprocess
+import logging
 
 from sugar import env
-from sugar.bundle.activitybundle import ActivityBundle
-
-def list_files(base_dir, ignore_dirs=None, ignore_files=None):
-result = []
-
-for root, dirs, files in os.walk(base_dir):
-for f in files:
-if ignore_files and f not in ignore_files:
-rel_path = root[len(base_dir) + 1:]
-result.append(os.path.join(rel_path, f))
-if ignore_dirs and root == base_dir:
-for ignore in ignore_dirs:
-if ignore in dirs:
-dirs.remove(ignore)
-
-return result
-
-class Config(object):
-def __init__(self, bundle_name, source_dir=None):
-if source_dir:
-self.source_dir = source_dir
-else:
-self.source_dir = os.getcwd()
-
-
-bundle = ActivityBundle(self.source_dir)
-version = bundle.get_activity_version()
+from sugar.bundle.activitybundle import ActivityBundle, MANIFEST, list_files
 
-self.bundle_name = bundle_name
-self.xo_name = '%s-%d.xo' % (self.bundle_name, version)
-self.tarball_name = '%s-%d.tar.bz2' % (self.bundle_name, version)
+class RawActivity(object):
+def __init__(self, source_dir=None, dist_path = ):
+self.source_dir = source_dir or os.getcwd()
+
+self.bundle = bundle = ActivityBundle(self.source_dir)
+self.version = bundle.get_activity_version()
+self.activity_name = bundle.get_name()
 self.bundle_id = bundle.get_bundle_id()
+self.bundle_name = reduce(lambda x, y:x+y, self.activity_name.split())
+
+dist_dir, dist_name = os.path.split(dist_path)
+self.dist_dir = dist_dir or os.path.join(self.source_dir, 'dist')
+self.xo_name = dist_name or '%s-%d.xo' % (self.bundle_name, 
+  self.version)
+self.tarball_name = (dist_name or 
+ '%s-%d.tar.bz2' % (self.bundle_name, 
+self.version))
 self.bundle_root_dir = self.bundle_name + '.activity'
-self.tarball_root_dir = '%s-%d' % (self.bundle_name, version)
-
-info_path = os.path.join(self.source_dir, 'activity', 'activity.info')
-f = open(info_path,'r')
-info = f.read()
-f.close()
-match = re.search('^name\s*=\s*(.*)$', info, flags = re.MULTILINE)
-self.activity_name = match.group(1)
-
-class Builder(object):
-def __init__(self, config):
-self.config = config
-
+self.tarball_root_dir = '%s-%d' % (self.bundle_name, self.version)
+
+class Builder(RawActivity):
 def build(self):
 self.build_locale()
 
 def build_locale(self):
-po_dir = os.path.join(self.config.source_dir, 'po')
-
+if not self.bundle.is_dir('po'):
+logging.warn(Activity lacks a po directory for translations)
+return
+po_dir = os.path.join(self.source_dir, 'po')
 for f in os.listdir(po_dir):
 if not f.endswith('.po'):
 continue
@@ -84,78 +65,92 @@ class Builder(object):
 file_name = os.path.join(po_dir, f)
 lang = f[:-3]
 
-localedir = os.path.join(self.config.source_dir, 'locale', lang)
+localedir = os.path.join(self.source_dir, 'locale', lang)
 mo_path = os.path.join(localedir, 'LC_MESSAGES')
 if not os.path.isdir(mo_path):
 os.makedirs(mo_path)
 
-mo_file = os.path.join(mo_path, %s.mo % self.config.bundle_id)
+mo_file = os.path.join(mo_path, %s.mo % self.bundle_id)
 args = [msgfmt, --output-file=%s % mo_file, file_name]
 retcode = subprocess.call(args)
 if retcode:
 print 'ERROR - msgfmt failed with return code %i.' % retcode
 
 cat = gettext.GNUTranslations(open(mo_file, 'r'))
-