[Sugar-devel] [PATCH] account for exec in subpath

Sascha Silbe sascha-ml-reply-to-2011-3 at silbe.org
Sat Jul 2 13:39:01 EDT 2011


Excerpts from Walter Bender's message of Mon Jun 06 20:26:03 +0200 2011:

[src/jarabe/view/viewsource.py]
> @@ -132,8 +132,9 @@ class ViewSource(gtk.Window):
>          activity_bundle = ActivityBundle(bundle_path)
>          command = activity_bundle.get_command()
>          if len(command.split(' ')) > 1:
> -            name = command.split(' ')[1].split('.')[0]
> -            file_name = name + '.py'
> +            name = command.split(' ')[1].split('.')[-1]
> +            tmp_path = command.split(' ')[1].replace('.', '/')
> +            file_name = tmppath[0:-(len(name) + 1)] + '.py'

How about using something like this:

    def _get_activity_class_file(self):
        command = activity_bundle.get_command()
        executable, space_, arguments = command.partition(' ')
        if executable != 'sugar-activity':
            return None

        classes = [name for name in arguments if not name.startswith('-')]
        if not classes:
            return None

        module = os.path.join(classes[0].split('.')[:-1])
        return module + '.py'

Sascha

-- 
http://sascha.silbe.org/
http://www.infra-silbe.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 500 bytes
Desc: not available
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20110702/b38bf258/attachment.pgp>


More information about the Sugar-devel mailing list