~ubuntu-branches/ubuntu/raring/software-center/raring-proposed

« back to all changes in this revision

Viewing changes to softwarecenter/distro/ubuntu.py

  • Committer: Package Import Robot
  • Author(s): Michael Vogt
  • Date: 2012-12-06 17:30:50 UTC
  • Revision ID: package-import@ubuntu.com-20121206173050-n7mxi5fzlsvtdh9l
Tags: 5.5.2
* lp:~mvo/software-center/fix-pygobject-deprecation-warnings:
  - fix deprecation warninings with the latest python-gi
* lp:~mvo/software-center/minor-logging-fixes:
  - drop some LOG.info() messages to LOG.debug() to spam the user
    less
* lp:~mvo/software-center/trivial-close-ui-tweak:
  - hide the main window immediately when closing down
* lp:~mvo/software-center/5.4-fix-save-person-to-config:
  - This branch ensures that the "username" is saved everytime
    that the ubuntu sso whoami call is done
* lp:~mvo/software-center/use-dpkg-builddeps:
  - use dpkg-checkbuilddeps to find test-dependencies
* lp:~mvo/software-center/update-sc-cmdline-flexibility:
  - update-software-center-agent: 
    + add --target-db-path commandline
  - update-software-center: 
    + add --app-install-desktop-dir and --target-db-path commandline
* lp:~mvo/software-center/raring-pep8:
  - fixes for new pep8

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
        "precise",
43
43
        "oneiric",
44
44
        "natty",
45
 
        ]
 
45
    ]
46
46
 
47
47
    # metapackages
48
48
    IMPORTANT_METAPACKAGES = ("ubuntu-desktop", "kubuntu-desktop")
49
49
 
50
50
    # screenshot handling
51
51
    SCREENSHOT_THUMB_URL = ("http://screenshots.ubuntu.com/"
52
 
        "thumbnail-with-version/%(pkgname)s/%(version)s")
 
52
                            "thumbnail-with-version/%(pkgname)s/%(version)s")
53
53
    SCREENSHOT_LARGE_URL = ("http://screenshots.ubuntu.com/"
54
 
        "screenshot-with-version/%(pkgname)s/%(version)s")
 
54
                            "screenshot-with-version/%(pkgname)s/%(version)s")
55
55
 
56
56
    # the json description of the available screenshots
57
57
    SCREENSHOT_JSON_URL = "http://screenshots.ubuntu.com/json/package/%s"
58
58
 
59
59
    # purchase subscription
60
60
    PURCHASE_APP_URL = (BUY_SOMETHING_HOST + "/subscriptions/%s/ubuntu/%s/"
61
 
        "+new/?%s")
 
61
                        "+new/?%s")
62
62
 
63
63
    # reviews
64
64
    REVIEWS_SERVER = (os.environ.get("SOFTWARE_CENTER_REVIEWS_HOST") or
65
 
        "http://reviews.ubuntu.com/reviews/api/1.0")
 
65
                      "http://reviews.ubuntu.com/reviews/api/1.0")
66
66
    REVIEWS_URL = (REVIEWS_SERVER + "/reviews/filter/%(language)s/%(origin)s/"
67
 
        "%(distroseries)s/%(version)s/%(pkgname)s%(appname)s/")
 
67
                   "%(distroseries)s/%(version)s/%(pkgname)s%(appname)s/")
68
68
 
69
69
    #REVIEW_STATS_URL = (REVIEWS_SERVER + "/reviews/api/1.0/%(language)s/"
70
70
    #    "%(origin)s/%(distroseries)s/review-stats/")
79
79
 
80
80
    def get_app_description(self):
81
81
        return _("Lets you choose from thousands of applications available "
82
 
            "for Ubuntu.")
 
82
                 "for Ubuntu.")
83
83
 
84
84
    def get_distro_channel_name(self):
85
85
        """ The name in the Release file """
98
98
        for m in self.IMPORTANT_METAPACKAGES:
99
99
            if m in depends:
100
100
                primary = _("%s is a core item in Ubuntu. "
101
 
                              "Removing it may cause future upgrades "
102
 
                              "to be incomplete. Are you sure you want to "
103
 
                              "continue?") % appname
 
101
                            "Removing it may cause future upgrades "
 
102
                            "to be incomplete. Are you sure you want to "
 
103
                            "continue?") % appname
104
104
                button_text = _("Remove Anyway")
105
105
                depends = []
106
106
                break
109
109
        for m in depends:
110
110
            if cache[m].section == "metapackages":
111
111
                primary = _("If you uninstall %s, future updates will not "
112
 
                              "include new items in <b>%s</b> set. "
113
 
                              "Are you sure you want to continue?") % (appname,
114
 
                              cache[m].installed.summary)
 
112
                            "include new items in <b>%s</b> set. "
 
113
                            "Are you sure you want to continue?") % (
 
114
                                appname, cache[m].installed.summary)
115
115
                button_text = _("Remove Anyway")
116
116
                depends = []
117
117
                break
154
154
        return _("Canonical-Maintained Software")
155
155
 
156
156
    def get_maintenance_status(self, cache, appname, pkgname, component,
157
 
        channelname):
 
157
                               channelname):
158
158
        # try to figure out the support dates of the release and make
159
159
        # sure to look only for stuff in "Ubuntu" and "distro_codename"
160
160
        # (to exclude stuff in ubuntu-updates for the support time
180
180
 
181
181
            # see if we have a "Supported" entry in the pkg record
182
182
            if (pkgname in cache and
183
 
                cache[pkgname].candidate):
 
183
                    cache[pkgname].candidate):
184
184
                support_time = cache._cache[pkgname].candidate.record.get(
185
185
                    "Supported")
186
186
                if support_time:
190
190
                        support_month = int(support_time.strip("m"))
191
191
                    else:
192
192
                        LOG.warning("unsupported 'Supported' string '%s'" %
193
 
                            support_time)
 
193
                                    support_time)
194
194
 
195
195
            # mvo: we do not define the end date very precisely
196
196
            #      currently this is why it will just display a end
210
210
                             "Updates may be available in a newer version of "
211
211
                             "Ubuntu.") % (appname, self.get_distro_release())
212
212
                else:
 
213
                    d = {'appname': appname,
 
214
                         'support_end_month_str': support_end_month_str,
 
215
                         'support_end_year': support_end_year}
213
216
                    return _("Canonical provides critical updates for "
214
217
                             "%(appname)s until %(support_end_month_str)s "
215
 
                             "%(support_end_year)s.") % {
216
 
                                'appname': appname,
217
 
                                'support_end_month_str': support_end_month_str,
218
 
                                'support_end_year': support_end_year}
 
218
                             "%(support_end_year)s.") % d
219
219
            elif component == "restricted":
220
220
                if support_ended:
221
221
                    return _("Canonical does no longer provide "
223
223
                             "Updates may be available in a newer version of "
224
224
                             "Ubuntu.") % (appname, self.get_distro_release())
225
225
                else:
 
226
                    d = {'appname': appname,
 
227
                         'support_end_month_str': support_end_month_str,
 
228
                         'support_end_year': support_end_year,
 
229
                         }
226
230
                    return _("Canonical provides critical updates supplied "
227
231
                             "by the developers of %(appname)s until "
228
232
                             "%(support_end_month_str)s "
229
 
                             "%(support_end_year)s.") % {
230
 
                                'appname': appname,
231
 
                                'support_end_month_str': support_end_month_str,
232
 
                                'support_end_year': support_end_year,
233
 
                            }
 
233
                             "%(support_end_year)s.") % d
234
234
 
235
235
        # if we couldn't determine a support date, use a generic maintenance
236
236
        # string without the date
237
237
        if (channelname or
238
 
            component in ("partner", "independent", "commercial")):
 
238
                component in ("partner", "independent", "commercial")):
239
239
            return _("Provided by the vendor.")
240
240
        elif component == "main":
241
241
            return _("Canonical provides critical updates for %s.") % appname
276
276
            #raise ValueError("we currently support downloadable icons in "
277
277
            #    "ppa's only")
278
278
            LOG.warning("downloadable icon is not supported for archive: '%s'"
279
 
                % full_archive_url)
 
279
                        % full_archive_url)
280
280
            return ''
281
281
 
282
282
if __name__ == "__main__":
283
283
    import apt
284
284
    cache = apt.Cache()
285
285
    print cache.get_maintenance_status(cache, "synaptic app", "synaptic",
286
 
        "main", None)
 
286
                                       "main", None)
287
287
    print cache.get_maintenance_status(cache, "3dchess app", "3dchess",
288
 
        "universe", None)
 
288
                                       "universe", None)