#10427 NORM 10.1.3: mimetypes.xml defined by activities not installed when installing activities

Zarro Boogs per Child bugtracker at laptop.org
Thu Nov 4 07:20:05 EDT 2010


#10427: mimetypes.xml defined by activities not installed when installing
activities
--------------------+-------------------------------------------------------
 Reporter:  erikos  |                 Owner:  erikos                           
     Type:  defect  |                Status:  new                              
 Priority:  normal  |             Milestone:  10.1.3                           
Component:  sugar   |               Version:  Development build as of this date
 Keywords:          |           Next_action:  code                             
 Verified:  0       |   Deployment_affected:                                   
Blockedby:          |              Blocking:                                   
--------------------+-------------------------------------------------------
 Phenomena:

 * Create a game in Memorize. In the Journal the game has no associated
 icon, even so the activity bundle does contain one and define it in
 mimetypes.xml.

 * Try to copy a Scratch project from the Journal to an external device.
 The Journal chokes on it, since no mimetype is recognized.
 {{{
  Traceback (most recent call last):
   File "/usr/lib/python2.6/site-
 packages/jarabe/journal/volumestoolbar.py", line 164, in
 _drag_data_received_cb
     model.copy(metadata, self.mount_point)
   File "/usr/lib/python2.6/site-packages/jarabe/journal/model.py", line
 476, in copy
     return write(metadata, file_path, transfer_ownership=False)
   File "/usr/lib/python2.6/site-packages/jarabe/journal/model.py", line
 502, in write
     file_name = _get_file_name(metadata['title'], metadata['mime_type'])
   File "/usr/lib/python2.6/site-packages/jarabe/journal/model.py", line
 515, in _get_file_name
     extension = '.' + mime.get_primary_extension(mime_type)
 }}}

 The issue is the following: As described in
 http://bugs.sugarlabs.org/ticket/2262 Sugar does not install a mimetype
 when 'setyp.py install' is run. This command is used when having an
 activity packaged in an rpm. In the case of the olpc images we do just
 unzip the content of the .xo to the Activities folder in HOME without
 taking the mimetype into account. There is code in activitybundle.py to
 put the mimetype definition in the appropriate place.

 {{{
 xdg_data_home = os.getenv('XDG_DATA_HOME',
                                   os.path.expanduser('~/.local/share'))

         mime_path = os.path.join(install_path, 'activity',
 'mimetypes.xml')
         if os.path.isfile(mime_path):
             mime_dir = os.path.join(xdg_data_home, 'mime')
             mime_pkg_dir = os.path.join(mime_dir, 'packages')
             if not os.path.isdir(mime_pkg_dir):
                 os.makedirs(mime_pkg_dir)
             installed_mime_path = os.path.join(mime_pkg_dir,
                                                '%s.xml' % self._bundle_id)
             self._symlink(mime_path, installed_mime_path)
             os.spawnlp(os.P_WAIT, 'update-mime-database',
                        'update-mime-database', mime_dir)
 }}}

 This works, but only if you install the activity directly from the
 Journal.

-- 
Ticket URL: <http://dev.laptop.org/ticket/10427>
One Laptop Per Child <http://laptop.org/>
OLPC bug tracking system


More information about the Bugs mailing list