~gary-lasker/software-center/new-apps-icons

« back to all changes in this revision

Viewing changes to softwarecenter/distro/Ubuntu.py

  • Committer: Gary Lasker
  • Date: 2010-08-09 01:56:15 UTC
  • Revision ID: gary.lasker@canonical.com-20100809015615-x9ziyo2448o42l0f
generate the url for a downloadable icon (currently support ppa's only)

Show diffs side-by-side

added added

removed removed

Lines of Context:
208
208
        """
209
209
        generates the url for a downloadable icon based on its pkgname and the icon filename itself
210
210
        """
211
 
 
212
 
        # PPA_DOWNLOADABLE_ICON_URL = "http://ppa.launchpad.net/%s/meta/ppa/%s"
213
211
        full_archive_url = cache[pkgname].candidate.uri
214
 
 
215
 
        # >>> cache["daily-journal"].candidate.uri
216
 
        #'http://ppa.launchpad.net/app-review-board/ppa/ubuntu/pool/main/d/daily-journal/daily-journal_10.06.1+newapps2_all.deb'
217
 
 
218
 
        # and look for "pool" in there.
219
 
        
220
 
        # pkg._pcache._list.find_index(pkg.candidate._cand.file_list[0][0]).archive_uri("")
221
 
        # 'http://ppa.launchpad.net/app-review-board/ppa/ubuntu/'
222
 
 
223
 
        # archive_url = self._pkg._pcache._list.find_index(pkg.candidate._cand.file_list[0][0]).archive_uri("")
224
 
 
225
 
        return self.PPA_DOWNLOADABLE_ICON_URL % ("app-review-board", icon_filename)
 
212
        split_at_pool = full_archive_url.split("pool")[0]
 
213
        if split_at_pool.endswith("/ppa/ubuntu/"):
 
214
            # it's a ppa, generate the icon_url for a ppa
 
215
            split_at_ppa = split_at_pool.split("/ppa/")[0]
 
216
            downloadable_icon_url = []
 
217
            downloadable_icon_url.append(split_at_ppa)
 
218
            downloadable_icon_url.append("/meta/ppa/")
 
219
            downloadable_icon_url.append(icon_filename)
 
220
            return "".join(downloadable_icon_url)
 
221
        else:
 
222
            raise ValueError, "we currently support downloadable icons in ppa's only"
226
223
 
227
224
 
228
225
if __name__ == "__main__":