~dylanmccall/update-manager/dialogs-refactor

« back to all changes in this revision

Viewing changes to janitor/plugincore/plugins/kdelibs4to5_plugin.py

  • Committer: Barry Warsaw
  • Date: 2012-06-11 15:08:35 UTC
  • mto: (2446.1.6 py3)
  • mto: This revision was merged to the branch mainline in revision 2454.
  • Revision ID: barry@python.org-20120611150835-lbx9cjwzfjy3y7bw
Re-integrate the Python 3 Computer Janitor refactoring branch for now.  The
code itself lives in ~computer-janitor-hackers/computer-janitor/py3refactor
and will eventually be ripped out of here, but for now, this unblocks other
folks.

Still getting test failures in `bzr bd -S` though.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2009-2012  Canonical, Ltd.
 
2
#
 
3
# This program is free software: you can redistribute it and/or modify it
 
4
# under the terms of the GNU General Public License as published by the Free
 
5
# Software Foundation, version 3 of the License.
 
6
#
 
7
# This program is distributed in the hope that it will be useful, but WITHOUT
 
8
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
9
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 
10
# more details.
 
11
#
 
12
# You should have received a copy of the GNU General Public License along with
 
13
# this program.  If not, see <http://www.gnu.org/licenses/>.
 
14
 
 
15
"""Install kdelibs5-dev if kdeblibs4-dev is installed."""
 
16
 
 
17
from __future__ import absolute_import, print_function, unicode_literals
 
18
 
 
19
__metaclass__ = type
 
20
__all__ = [
 
21
    'Kdelibs4devToKdelibs5devPlugin',
 
22
    ]
 
23
 
 
24
 
 
25
from janitor.plugincore.core.missing_package_cruft import MissingPackageCruft
 
26
from janitor.plugincore.i18n import setup_gettext
 
27
from janitor.plugincore.plugin import Plugin
 
28
 
 
29
_ = setup_gettext()
 
30
 
 
31
 
 
32
class Kdelibs4devToKdelibs5devPlugin(Plugin):
 
33
    """Plugin to install kdelibs5-dev if kdelibs4-dev is installed.
 
34
 
 
35
    See also LP: #279621.
 
36
    """
 
37
 
 
38
    def __init__(self):
 
39
        self.condition = ['from_hardyPostDistUpgradeCache']
 
40
 
 
41
    def get_cruft(self):
 
42
        fromp = 'kdelibs4-dev'
 
43
        top = 'kdelibs5-dev'
 
44
        cache = self.app.apt_cache
 
45
        if (fromp in cache and cache[fromp].is_installed and
 
46
            top in cache and not cache[top].is_installed):
 
47
                yield MissingPackageCruft(
 
48
                    cache[top],
 
49
                    _('When upgrading, if kdelibs4-dev is installed, '
 
50
                      'kdelibs5-dev needs to be installed. See '
 
51
                      'bugs.launchpad.net, bug #279621 for details.'))