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

« back to all changes in this revision

Viewing changes to softwarecenter/distro/fedora.py

  • Committer: Package Import Robot
  • Author(s): Michael Vogt
  • Date: 2012-10-11 15:33:05 UTC
  • mfrom: (195.1.18 quantal)
  • Revision ID: package-import@ubuntu.com-20121011153305-fm5ln7if3rpzts4n
Tags: 5.4.1.1
* lp:~mvo/software-center/reinstall-previous-purchase-token-fix:
  - fix reinstall previous purchases that have a system-wide
    license key LP: #1065481
* lp:~mvo/software-center/lp1060106:
  - Add missing gettext init for utils/update-software-center-agent
    (LP: #1060106)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2009 Canonical
 
2
#
 
3
# Authors:
 
4
#  Michael Vogt
 
5
#  Julian Andres Klode
 
6
#
 
7
# This program is free software; you can redistribute it and/or modify it under
 
8
# the terms of the GNU General Public License as published by the Free Software
 
9
# Foundation; version 3.
 
10
#
 
11
# This program is distributed in the hope that it will be useful, but WITHOUT
 
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
13
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 
14
# details.
 
15
#
 
16
# You should have received a copy of the GNU General Public License along with
 
17
# this program; if not, write to the Free Software Foundation, Inc.,
 
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
19
 
 
20
import os
 
21
 
 
22
from softwarecenter.distro import Distro
 
23
from gettext import gettext as _
 
24
 
 
25
 
 
26
class Fedora(Distro):
 
27
    DISTROSERIES = [
 
28
        'Beefy Miracle',
 
29
        'Verne',
 
30
        'Lovelock',
 
31
        'Laughlin',
 
32
        'Leonidas',
 
33
        'Constantine',
 
34
    ]
 
35
 
 
36
    # disable paid software
 
37
    PURCHASE_APP_URL = None
 
38
 
 
39
    # screenshot handling
 
40
    # FIXME - fedora should get its own proxy eventually
 
41
    SCREENSHOT_THUMB_URL = ("http://screenshots.ubuntu.com/"
 
42
        "thumbnail-with-version/%(pkgname)s/%(version)s")
 
43
    SCREENSHOT_LARGE_URL = ("http://screenshots.ubuntu.com/"
 
44
        "screenshot-with-version/%(pkgname)s/%(version)s")
 
45
    SCREENSHOT_JSON_URL = "http://screenshots.ubuntu.com/json/package/%s"
 
46
 
 
47
    # reviews
 
48
    # FIXME: fedora will want to get their own review server instance at
 
49
    #        some point I imagine :) (or a alternative backend)
 
50
    #
 
51
    REVIEWS_SERVER = (os.environ.get("SOFTWARE_CENTER_REVIEWS_HOST") or
 
52
        "http://reviews.ubuntu.com/reviews/api/1.0")
 
53
    REVIEWS_URL = (REVIEWS_SERVER + "/reviews/filter/%(language)s/%(origin)s/"
 
54
        "%(distroseries)s/%(version)s/%(pkgname)s%(appname)s/")
 
55
 
 
56
    REVIEW_STATS_URL = REVIEWS_SERVER + "/review-stats"
 
57
 
 
58
    def get_distro_channel_name(self):
 
59
        """ The name of the primary repository """
 
60
        return "fedora"
 
61
 
 
62
    def get_distro_channel_description(self):
 
63
        """ The description of the main distro channel
 
64
            Overrides what's present in yum.conf for fedora, updates,
 
65
            updates-testing, their respective -source and -debuginfo
 
66
        """
 
67
        return _("Provided by Fedora")
 
68
 
 
69
    def get_app_name(self):
 
70
        return _("Fedora Software Center")
 
71
 
 
72
    def get_removal_warning_text(self, cache, pkg, appname, depends):
 
73
        primary = _("To remove %s, these items must be removed "
 
74
                    "as well:") % appname
 
75
        button_text = _("Remove All")
 
76
 
 
77
        return (primary, button_text)
 
78
 
 
79
    def get_license_text(self, component):
 
80
        # with a PackageKit backend, component is always 'main'
 
81
        # (but we have license in the individual packages)
 
82
        return _("Open source")
 
83
 
 
84
    def get_architecture(self):
 
85
        return os.uname()[4]
 
86
 
 
87
    def get_foreign_architectures(self):
 
88
        return []
 
89
 
 
90
    def is_supported(self, cache, doc, pkgname):
 
91
        origin = cache.get_origin(pkgname)
 
92
        return origin == 'fedora' or origin == 'updates'
 
93
 
 
94
    def get_maintenance_status(self, cache, appname, pkgname, component,
 
95
        channelname):
 
96
        # FIXME
 
97
        pass
 
98
 
 
99
    def get_supported_query(self):
 
100
        import xapian
 
101
        query1 = xapian.Query("XOO" + "fedora")
 
102
        query2 = xapian.Query("XOO" + "updates")
 
103
        return xapian.Query(xapian.Query.OP_OR, query1, query2)