#2457 HIGH First D: shared-mime-info data should be taken from bundle

Zarro Boogs per Child bugtracker at laptop.org
Tue Sep 25 09:21:50 EDT 2007


#2457: shared-mime-info data should be taken from bundle
---------------------+------------------------------------------------------
  Reporter:  bert    |       Owner:  danw                  
      Type:  defect  |      Status:  new                   
  Priority:  high    |   Milestone:  First Deployment, V1.0
 Component:  sugar   |     Version:                        
Resolution:          |    Keywords:  review?               
  Verified:  0       |  
---------------------+------------------------------------------------------
Changes (by danw):

 * cc: marco (added)
  * keywords:  => review?


Comment:

 Oops, my patch for this already snuck in as part of the
 Bundle->ActivityBundle patch. The relevant code is:

 {{{
         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._service_name)
             os.symlink(mime_path, installed_mime_path)
             os.spawnlp(os.P_WAIT, 'update-mime-database',
                        'update-mime-database', mime_dir)
 }}}

 (from sugar/bundle/activitybundle.py:install())

 Meaning, if you put a file called "mimetypes.xml" in the activity subdir
 of your activity bundle, it will be symlinked into $XDG_DATA_HOME at
 bundle-install time. Does that seem like a good way to do it? If so, this
 is mostly done, I just need to write the corresponding code for
 uninstall().

-- 
Ticket URL: <https://dev.laptop.org/ticket/2457#comment:5>
One Laptop Per Child <https://dev.laptop.org>
OLPC bug tracking system



More information about the Bugs mailing list