summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2013-08-26 13:45:40 +0200
committerJulian Andres Klode <jak@debian.org>2013-09-11 20:15:01 +0200
commitb3934f4303c419bb6b517f71cce59749cf13f9c4 (patch)
tree3a169387eb1d762391f3d1387d0c1dab3d475d0d
parent044322b4dca1135671a93ebfe1601214f7f6e655 (diff)
downloadpython-apt-b3934f4303c419bb6b517f71cce59749cf13f9c4.tar.gz
Completely remove deprecated stuff
-rw-r--r--apt/__init__.py6
-rw-r--r--apt/cache.py26
-rw-r--r--apt/cdrom.py4
-rw-r--r--apt/deprecation.py106
-rw-r--r--apt/package.py234
-rw-r--r--apt/progress/__init__.py7
-rw-r--r--apt/progress/gtk2.py83
-rw-r--r--apt/progress/old.py259
-rw-r--r--aptsources/sourceslist.py4
-rw-r--r--debian/python-apt-common.install2
-rw-r--r--debian/python-apt-common.lintian-overrides2
-rw-r--r--doc/source/conf.py2
-rw-r--r--python/apt_pkgmodule.cc2
-rwxr-xr-xutils/migrate-0.8.py254
14 files changed, 0 insertions, 991 deletions
diff --git a/apt/__init__.py b/apt/__init__.py
index 677a625b..4ded8e29 100644
--- a/apt/__init__.py
+++ b/apt/__init__.py
@@ -25,12 +25,6 @@ from apt.package import Package
from apt.cache import Cache, ProblemResolver
from apt.cdrom import Cdrom
-if apt_pkg._COMPAT_0_7:
- from apt.progress.old import (OpProgress, FetchProgress, InstallProgress,
- CdromProgress)
- from apt_pkg import (size_to_str as SizeToStr, time_to_str as TimeToStr,
- version_compare as VersionCompare)
-
# init the package system
apt_pkg.init()
diff --git a/apt/cache.py b/apt/cache.py
index 9842cb2a..928a6207 100644
--- a/apt/cache.py
+++ b/apt/cache.py
@@ -26,8 +26,6 @@ import weakref
import apt_pkg
from apt import Package
from apt_pkg import gettext as _
-from apt.deprecation import (AttributeDeprecatedBy, function_deprecated_by,
- deprecated_args)
import apt.progress.text
@@ -242,7 +240,6 @@ class Cache(object):
changes.append(package)
return changes
- @deprecated_args
def upgrade(self, dist_upgrade=False):
"""Upgrade all packages.
@@ -398,7 +395,6 @@ class Cache(object):
providers.add(package)
return list(providers)
- @deprecated_args
def update(self, fetch_progress=None, pulse_interval=0,
raise_on_error=True, sources_list=None):
"""Run the equivalent of apt-get update.
@@ -450,7 +446,6 @@ class Cache(object):
apt_pkg.config.set("Dir::Etc::sourceparts", old_sources_list_d)
apt_pkg.config.set("APT::List-Cleanup", old_cleanup)
- @deprecated_args
def install_archives(self, pm, install_progress):
"""
The first parameter *pm* refers to an object returned by
@@ -471,7 +466,6 @@ class Cache(object):
install_progress.finish_update()
return res
- @deprecated_args
def commit(self, fetch_progress=None, install_progress=None):
"""Apply the marked changes to the cache.
@@ -593,20 +587,6 @@ class Cache(object):
"""Return the number of packages marked as keep."""
return self._depcache.keep_count
- if apt_pkg._COMPAT_0_7:
- _runCallbacks = function_deprecated_by(_run_callbacks)
- getChanges = function_deprecated_by(get_changes)
- requiredDownload = AttributeDeprecatedBy('required_download')
- additionalRequiredSpace = AttributeDeprecatedBy('required_space')
- reqReinstallPkgs = AttributeDeprecatedBy('req_reinstall_pkgs')
- _runFetcher = function_deprecated_by(_run_fetcher)
- _fetchArchives = function_deprecated_by(_fetch_archives)
- isVirtualPackage = function_deprecated_by(is_virtual_package)
- getProvidingPackages = function_deprecated_by(get_providing_packages)
- installArchives = function_deprecated_by(install_archives)
- cachePostChange = function_deprecated_by(cache_post_change)
- cachePreChange = function_deprecated_by(cache_pre_change)
-
class ProblemResolver(object):
"""Resolve problems due to dependencies and conflicts.
@@ -736,12 +716,6 @@ class FilteredCache(object):
#print "getattr: %s " % key
return getattr(self.cache, key)
- if apt_pkg._COMPAT_0_7:
- _reapplyFilter = function_deprecated_by(_reapply_filter)
- setFilter = function_deprecated_by(set_filter)
- filterCachePostChange = function_deprecated_by(\
- filter_cache_post_change)
-
def cache_pre_changed():
print "cache pre changed"
diff --git a/apt/cdrom.py b/apt/cdrom.py
index 9688de9e..3c48fd07 100644
--- a/apt/cdrom.py
+++ b/apt/cdrom.py
@@ -23,7 +23,6 @@
import glob
import apt_pkg
-from apt.deprecation import AttributeDeprecatedBy
from apt.progress.base import CdromProgress
@@ -84,6 +83,3 @@ class Cdrom(apt_pkg.Cdrom):
if not line.lstrip().startswith("#") and cd_id in line:
return True
return False
-
- if apt_pkg._COMPAT_0_7:
- inSourcesList = AttributeDeprecatedBy('in_sources_list')
diff --git a/apt/deprecation.py b/apt/deprecation.py
deleted file mode 100644
index 0f39ad63..00000000
--- a/apt/deprecation.py
+++ /dev/null
@@ -1,106 +0,0 @@
-# deprecation.py - Module providing classes and functions for deprecation.
-#
-# Copyright (c) 2009 Julian Andres Klode <jak@debian.org>
-# Copyright (c) 2009 Ben Finney <ben+debian@benfinney.id.au>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA
-"""Classes and functions for deprecating features.
-
-This is used for internal purposes only and not part of the official API. Do
-not use it for anything outside the apt package.
-"""
-import re
-import operator
-import warnings
-
-import apt_pkg
-
-__all__ = []
-
-
-class AttributeDeprecatedBy(object):
- """Property acting as a proxy for a new attribute.
-
- When accessed, the property issues a DeprecationWarning and (on get) calls
- attrgetter() for the attribute 'attribute' on the current object or (on
- set) uses setattr to set the value of the wrapped attribute.
- """
-
- def __init__(self, attribute):
- """Initialize the property."""
- self.attribute = attribute
- self.__doc__ = 'Deprecated, please use \'%s\' instead' % attribute
- self.getter = operator.attrgetter(attribute)
-
- def __get__(self, obj, type_=None):
- """Issue a DeprecationWarning and return the requested value."""
- if obj is None:
- return getattr(type_, self.attribute, self)
- warnings.warn(self.__doc__, DeprecationWarning, stacklevel=2)
- return self.getter(obj or type_)
-
- def __set__(self, obj, value):
- """Issue a DeprecationWarning and set the requested value."""
- warnings.warn(self.__doc__, DeprecationWarning, stacklevel=2)
- setattr(obj, self.attribute, value)
-
-
-def function_deprecated_by(func, convert_names=True):
- """Return a function that warns it is deprecated by another function.
-
- Returns a new function that warns it is deprecated by function 'func',
- then acts as a pass-through wrapper for 'func'.
-
- This function also converts all keyword argument names from mixedCase to
- lowercase_with_underscores, but only if 'convert_names' is True (default).
- """
- warning = 'Deprecated, please use \'%s()\' instead' % func.__name__
-
- def deprecated_function(*args, **kwds):
- """Wrapper around a deprecated function."""
- warnings.warn(warning, DeprecationWarning, stacklevel=2)
- if convert_names:
- for key in kwds.keys():
- kwds[re.sub('([A-Z])', '_\\1', key).lower()] = kwds.pop(key)
- return func(*args, **kwds)
- return deprecated_function
-
-
-def deprecated_args(func):
- """A function with deprecated arguments.
-
- Similar to function_deprecated_by() but warns on every deprecated argument
- instead of function calls.
- """
- if not apt_pkg._COMPAT_0_7:
- return func
-
- def deprecated_function(*args, **kwds):
- """Wrapper around a function with deprecated arguments."""
- for key in kwds.keys():
- new_key = re.sub('([A-Z])', '_\\1', key).lower()
- if new_key != key:
- warnings.warn("Deprecated parameter %r" % key)
- kwds[new_key] = kwds.pop(key)
- return func(*args, **kwds)
-
- # Wrap the function completely (same as functools.wraps)
- # pylint: disable-msg=W0622
- deprecated_function.__name__ = func.__name__
- deprecated_function.__doc__ = func.__doc__
- deprecated_function.__module__ = func.__module__
- deprecated_function.__dict__.update(func.__dict__)
- return deprecated_function
diff --git a/apt/package.py b/apt/package.py
index dbaab320..f311eaff 100644
--- a/apt/package.py
+++ b/apt/package.py
@@ -41,8 +41,6 @@ except ImportError:
import apt_pkg
import apt.progress.text
from apt_pkg import gettext as _
-from apt.deprecation import (function_deprecated_by, AttributeDeprecatedBy,
- deprecated_args)
__all__ = ('BaseDependency', 'Dependency', 'Origin', 'Package', 'Record',
'Version', 'VersionList')
@@ -90,9 +88,6 @@ class BaseDependency(object):
return ('<BaseDependency: name:%r relation:%r version:%r preDepend:%r>'
% (self.name, self.relation, self.version, self.pre_depend))
- if apt_pkg._COMPAT_0_7:
- preDepend = AttributeDeprecatedBy('pre_depend')
-
class Dependency(list):
"""Represent an Or-group of dependencies.
@@ -109,25 +104,6 @@ class Dependency(list):
def or_dependencies(self):
return self
-class DeprecatedProperty(property):
- """A property which gives DeprecationWarning on access.
-
- This is only used for providing the properties in Package, which have been
- replaced by the ones in Version.
- """
-
- def __init__(self, fget=None, fset=None, fdel=None, doc=None):
- property.__init__(self, fget, fset, fdel, doc)
- self.__doc__ = (doc or fget.__doc__ or '')
-
- def __get__(self, obj, type_=None):
- if obj is not None:
- warnings.warn("Accessed deprecated property %s.%s, please see the "
- "Version class for alternatives." %
- ((obj.__class__.__name__ or type_.__name__),
- self.fget.__name__), DeprecationWarning, 2)
- return property.__get__(self, obj, type_)
-
class Origin(object):
"""The origin of a version.
@@ -806,36 +782,6 @@ class Package(object):
"""Return True if the package is an essential part of the system."""
return self._pkg.essential
- @DeprecatedProperty
- def installedVersion(self): #pylint: disable-msg=C0103
- """Return the installed version as string.
-
- .. deprecated:: 0.7.9"""
- return getattr(self.installed, 'version', None)
-
- @DeprecatedProperty
- def candidateVersion(self): #pylint: disable-msg=C0103
- """Return the candidate version as string.
-
- .. deprecated:: 0.7.9"""
- return getattr(self.candidate, "version", None)
-
- @DeprecatedProperty
- def candidateDependencies(self): #pylint: disable-msg=C0103
- """Return a list of candidate dependencies.
-
- .. deprecated:: 0.7.9
- """
- return getattr(self.candidate, "dependencies", None)
-
- @DeprecatedProperty
- def installedDependencies(self): #pylint: disable-msg=C0103
- """Return a list of installed dependencies.
-
- .. deprecated:: 0.7.9
- """
- return getattr(self.installed, 'dependencies', [])
-
def architecture(self):
"""Return the Architecture of the package.
@@ -846,107 +792,11 @@ class Package(object):
"""
return self._pkg.architecture
- @DeprecatedProperty
- def candidateDownloadable(self): #pylint: disable-msg=C0103
- """Return ``True`` if the candidate is downloadable.
-
- .. deprecated:: 0.7.9
- """
- return getattr(self.candidate, "downloadable", None)
-
- @DeprecatedProperty
- def installedDownloadable(self): #pylint: disable-msg=C0103
- """Return ``True`` if the installed version is downloadable.
-
- .. deprecated:: 0.7.9
- """
- return getattr(self.installed, 'downloadable', False)
-
- @DeprecatedProperty
- def sourcePackageName(self): #pylint: disable-msg=C0103
- """Return the source package name as string.
-
- .. deprecated:: 0.7.9
- """
- try:
- return self.candidate._records.source_pkg or self._pkg.name
- except AttributeError:
- try:
- return self.installed._records.source_pkg or self._pkg.name
- except AttributeError:
- return self._pkg.name
-
- @DeprecatedProperty
- def homepage(self):
- """Return the homepage field as string.
-
- .. deprecated:: 0.7.9
- """
- return getattr(self.candidate, "homepage", None)
-
@property
def section(self):
"""Return the section of the package."""
return self._pkg.section
- @DeprecatedProperty
- def priority(self):
- """Return the priority (of the candidate version).
-
- .. deprecated:: 0.7.9
- """
- return getattr(self.candidate, "priority", None)
-
- @DeprecatedProperty
- def installedPriority(self): #pylint: disable-msg=C0103
- """Return the priority (of the installed version).
-
- .. deprecated:: 0.7.9
- """
- return getattr(self.installed, 'priority', None)
-
- @DeprecatedProperty
- def summary(self):
- """Return the short description (one line summary).
-
- .. deprecated:: 0.7.9
- """
- return getattr(self.candidate, "summary", None)
-
- @DeprecatedProperty
- def description(self):
- """Return the formatted long description.
-
- Return the formatted long description according to the Debian policy
- (Chapter 5.6.13).
- See http://www.debian.org/doc/debian-policy/ch-controlfields.html
- for more information.
-
- .. deprecated:: 0.7.9
- """
- return getattr(self.candidate, "description", None)
-
- @DeprecatedProperty
- def rawDescription(self): #pylint: disable-msg=C0103
- """return the long description (raw).
-
- .. deprecated:: 0.7.9"""
- return getattr(self.candidate, "raw_description", None)
-
- @DeprecatedProperty
- def candidateRecord(self): #pylint: disable-msg=C0103
- """Return the Record of the candidate version of the package.
-
- .. deprecated:: 0.7.9"""
- return getattr(self.candidate, "record", None)
-
- @DeprecatedProperty
- def installedRecord(self): #pylint: disable-msg=C0103
- """Return the Record of the candidate version of the package.
-
- .. deprecated:: 0.7.9"""
- return getattr(self.installed, 'record', '')
-
# depcache states
@property
@@ -1007,39 +857,6 @@ class Package(object):
return self._pcache._depcache.is_auto_installed(self._pkg)
# sizes
- @DeprecatedProperty
- def packageSize(self): #pylint: disable-msg=C0103
- """Return the size of the candidate deb package.
-
- .. deprecated:: 0.7.9
- """
- return getattr(self.candidate, "size", None)
-
- @DeprecatedProperty
- def installedPackageSize(self): #pylint: disable-msg=C0103
- """Return the size of the installed deb package.
-
- .. deprecated:: 0.7.9
- """
- return getattr(self.installed, 'size', 0)
-
- @DeprecatedProperty
- def candidateInstalledSize(self): #pylint: disable-msg=C0103
- """Return the size of the candidate installed package.
-
- .. deprecated:: 0.7.9
- """
- return getattr(self.candidate, "installed_size", None)
-
- @DeprecatedProperty
- def installedSize(self): #pylint: disable-msg=C0103
- """Return the size of the currently installed package.
-
-
- .. deprecated:: 0.7.9
- """
- return getattr(self.installed, 'installed_size', 0)
-
@property
def installed_files(self):
"""Return a list of files installed by the package.
@@ -1216,14 +1033,6 @@ class Package(object):
socket.setdefaulttimeout(timeout)
return self._changelog
- @DeprecatedProperty
- def candidateOrigin(self): #pylint: disable-msg=C0103
- """Return a list of `Origin()` objects for the candidate version.
-
- .. deprecated:: 0.7.9
- """
- return getattr(self.candidate, "origins", None)
-
@property
def versions(self):
"""Return a VersionList() object for all available versions.
@@ -1250,7 +1059,6 @@ class Package(object):
self._pcache._depcache.mark_keep(self._pkg)
self._pcache.cache_post_change()
- @deprecated_args
def mark_delete(self, auto_fix=True, purge=False):
"""Mark a package for deletion.
@@ -1272,7 +1080,6 @@ class Package(object):
fix.resolve()
self._pcache.cache_post_change()
- @deprecated_args
def mark_install(self, auto_fix=True, auto_inst=True, from_user=True):
"""Mark a package for install.
@@ -1328,47 +1135,6 @@ class Package(object):
self._pcache._depcache.commit(fprogress, iprogress)
- if not apt_pkg._COMPAT_0_7:
- del installedVersion
- del candidateVersion
- del candidateDependencies
- del installedDependencies
- del architecture
- del candidateDownloadable
- del installedDownloadable
- del sourcePackageName
- del homepage
- del priority
- del installedPriority
- del summary
- del description
- del rawDescription
- del candidateRecord
- del installedRecord
- del packageSize
- del installedPackageSize
- del candidateInstalledSize
- del installedSize
- del candidateOrigin
- else:
- markedInstalled = AttributeDeprecatedBy('marked_installed')
- markedInstall = AttributeDeprecatedBy('marked_install')
- markedUpgrade = AttributeDeprecatedBy('marked_upgrade')
- markedDelete = AttributeDeprecatedBy('marked_delete')
- markedKeep = AttributeDeprecatedBy('marked_keep')
- markedDowngrade = AttributeDeprecatedBy('marked_downgrade')
- markedReinstall = AttributeDeprecatedBy('marked_reinstall')
- isInstalled = AttributeDeprecatedBy('is_installed')
- isUpgradable = AttributeDeprecatedBy('is_upgradable')
- isAutoRemovable = AttributeDeprecatedBy('is_auto_removable')
- installedFiles = AttributeDeprecatedBy('installed_files')
- getChangelog = function_deprecated_by(get_changelog)
- markDelete = function_deprecated_by(mark_delete)
- markInstall = function_deprecated_by(mark_install)
- markKeep = function_deprecated_by(mark_keep)
- markUpgrade = function_deprecated_by(mark_upgrade)
-
-
def _test():
"""Self-test."""
print "Self-test for the Package modul"
diff --git a/apt/progress/__init__.py b/apt/progress/__init__.py
index 10c11021..00dc768f 100644
--- a/apt/progress/__init__.py
+++ b/apt/progress/__init__.py
@@ -26,10 +26,3 @@ import apt_pkg
__all__ = []
-
-
-if apt_pkg._COMPAT_0_7:
- from apt.progress.old import (CdromProgress, DpkgInstallProgress,
- DumbInstallProgress, FetchProgress,
- InstallProgress, OpProgress,
- OpTextProgress, TextFetchProgress)
diff --git a/apt/progress/gtk2.py b/apt/progress/gtk2.py
index c2635ca0..63e531fa 100644
--- a/apt/progress/gtk2.py
+++ b/apt/progress/gtk2.py
@@ -36,12 +36,8 @@ import vte
import apt_pkg
from apt_pkg import gettext as _
-from apt.deprecation import function_deprecated_by, AttributeDeprecatedBy
from apt.progress import base
-if apt_pkg._COMPAT_0_7:
- from apt.progress import old
-
__all__ = ['GAcquireProgress', 'GInstallProgress', 'GOpProgress',
'GtkAptProgress']
@@ -90,9 +86,6 @@ class GOpProgress(gobject.GObject, base.OpProgress):
base.OpProgress.done(self)
self.emit("status-finished")
- if apt_pkg._COMPAT_0_7:
- subOp = AttributeDeprecatedBy('subop')
- Op = AttributeDeprecatedBy('op')
class GInstallProgress(gobject.GObject, base.InstallProgress):
@@ -204,14 +197,6 @@ class GInstallProgress(gobject.GObject, base.InstallProgress):
time.sleep(0.02)
return self.apt_status
- if apt_pkg._COMPAT_0_7:
- updateInterface = function_deprecated_by(update_interface)
- startUpdate = function_deprecated_by(start_update)
- finishUpdate = function_deprecated_by(finish_update)
- statusChange = function_deprecated_by(status_change)
- waitChild = function_deprecated_by(wait_child)
- childExited = function_deprecated_by(child_exited)
-
GDpkgInstallProgress = GInstallProgress
@@ -272,59 +257,6 @@ class GAcquireProgress(gobject.GObject, base.AcquireProgress):
self._context.iteration()
return self._continue
-if apt_pkg._COMPAT_0_7:
-
- class GFetchProgress(gobject.GObject, old.FetchProgress):
- """A Fetch Progress with GObject signals.
-
- Signals:
-
- * status-changed(str: description, int: percent)
- * status-started()
- * status-finished()
-
- DEPRECATED.
- """
-
- __gsignals__ = {"status-changed": mksig((str, int)),
- "status-started": mksig(),
- "status-finished": mksig()}
-
- def __init__(self):
- old.FetchProgress.__init__(self)
- gobject.GObject.__init__(self)
- self._continue = True
- self._context = glib.main_context_default()
-
- def start(self):
- self.emit("status-started")
-
- def stop(self):
- self.emit("status-finished")
-
- def cancel(self):
- self._continue = False
-
- def pulse(self):
- old.FetchProgress.pulse(self)
- current_item = self.currentItems + 1
- if current_item > self.totalItems:
- current_item = self.totalItems
- if self.current_cps > 0:
- text = (_("Downloading file %(current)li of %(total)li with "
- "%(speed)s/s") % \
- {"current": current_item,
- "total": self.totalItems,
- "speed": apt_pkg.size_to_str(self.currentCPS)})
- else:
- text = (_("Downloading file %(current)li of %(total)li") % \
- {"current": current_item,
- "total": self.totalItems})
- self.emit("status-changed", text, self.percent)
- while self._context.pending():
- self._context.iteration()
- return self._continue
-
class GtkAptProgress(gtk.VBox):
"""Graphical progress for installation/fetch/operations.
@@ -403,21 +335,6 @@ class GtkAptProgress(gtk.VBox):
"""Return the install progress handler for dpkg."""
return self._progress_install
- if apt_pkg._COMPAT_0_7:
-
- @property
- def fetch(self):
- """Return the fetch progress handler."""
- if self._progress_fetch is None:
- self._progress_fetch = GFetchProgress()
- self._progress_fetch.connect("status-changed",
- self._on_status_changed)
- self._progress_fetch.connect("status-started",
- self._on_status_started)
- self._progress_fetch.connect("status-finished",
- self._on_status_finished)
- return self._progress_fetch
-
@property
def acquire(self):
"""Return the acquire progress handler."""
diff --git a/apt/progress/old.py b/apt/progress/old.py
deleted file mode 100644
index 364cd2ce..00000000
--- a/apt/progress/old.py
+++ /dev/null
@@ -1,259 +0,0 @@
-# progress.py - progress reporting classes
-#
-# Copyright (c) 2005-2009 Canonical
-#
-# Author: Michael Vogt <michael.vogt@ubuntu.com>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA
-# pylint: disable-msg = C0103
-"""Deprecated progress reporting classes.
-
-This module provides classes for compatibility with python-apt 0.7. They are
-completely deprecated and should not be used anymore.
-"""
-
-
-import os
-import sys
-
-import apt_pkg
-from apt.deprecation import AttributeDeprecatedBy, function_deprecated_by
-import warnings
-from apt.progress import base, text
-
-__all__ = []
-
-
-class OpProgress(base.OpProgress):
- """Abstract class to implement reporting on cache opening."""
-
- def __init__(self):
- base.OpProgress.__init__(self)
- warnings.warn("apt.progress.OpProgress is deprecated.",
- DeprecationWarning, stacklevel=2)
-
- subOp = AttributeDeprecatedBy('subop')
- Op = AttributeDeprecatedBy('op')
-
-
-class OpTextProgress(OpProgress, text.OpProgress):
- """A simple text based cache open reporting class."""
-
- def __init__(self):
- text.OpProgress.__init__(self)
- warnings.warn("apt.progress.OpTextProgress is deprecated.",
- DeprecationWarning, stacklevel=2)
-
-
-class FetchProgress(object):
- """Report the download/fetching progress."""
-
- # download status constants
- (dlDone, dlQueued, dlFailed, dlHit, dlIgnored) = range(5)
- dlStatusStr = {dlDone: "Done", dlQueued: "Queued", dlFailed: "Failed",
- dlHit: "Hit", dlIgnored: "Ignored"}
-
- def __init__(self):
- self.eta = 0.0
- self.percent = 0.0
- # Make checking easier
- self.currentBytes = 0
- self.currentItems = 0
- self.totalBytes = 0
- self.totalItems = 0
- self.currentCPS = 0
- warnings.warn("apt.progress.FetchProgress is deprecated.",
- DeprecationWarning, stacklevel=2)
-
- def start(self):
- """Called when the fetching starts."""
-
- def stop(self):
- """Called when all files have been fetched."""
-
- def updateStatus(self, uri, descr, short_descr, status):
- """Called when the status of an item changes.
-
- This happens eg. when the downloads fails or is completed.
- """
-
- def update_status_full(self, uri, descr, short_descr, status, file_size,
- partial_size):
- """Called when the status of an item changes.
-
- This happens eg. when the downloads fails or is completed. This
- version include information on current filesize and partial size
- """
-
- def pulse(self):
- """Called periodically to update the user interface.
-
- Return True to continue or False to cancel.
- """
- self.percent = (((self.currentBytes + self.currentItems) * 100.0) /
- float(self.totalBytes + self.totalItems))
- if self.currentCPS > 0:
- self.eta = ((self.totalBytes - self.currentBytes) /
- float(self.currentCPS))
- return True
-
- def pulse_items(self, items):
- """Called periodically to update the user interface.
- This function includes details about the items being fetched
- Return True to continue or False to cancel.
-
- """
- self.percent = (((self.currentBytes + self.currentItems) * 100.0) /
- float(self.totalBytes + self.totalItems))
- if self.currentCPS > 0:
- self.eta = ((self.totalBytes - self.currentBytes) /
- float(self.currentCPS))
- return True
-
- def mediaChange(self, medium, drive):
- """react to media change events."""
-
-
-class TextFetchProgress(FetchProgress):
- """ Ready to use progress object for terminal windows """
-
- def __init__(self):
- FetchProgress.__init__(self)
- self.items = {}
-
- def updateStatus(self, uri, descr, short_descr, status):
- """Called when the status of an item changes.
-
- This happens eg. when the downloads fails or is completed.
- """
- if status != self.dlQueued:
- print "\r%s %s" % (self.dlStatusStr[status], descr)
- self.items[uri] = status
-
- def pulse(self):
- """Called periodically to update the user interface.
-
- Return True to continue or False to cancel.
- """
- FetchProgress.pulse(self)
-
- if self.currentCPS > 0:
- s = "[%2.f%%] %sB/s %s" % (self.percent,
- apt_pkg.size_to_str(self.currentCPS),
- apt_pkg.time_to_str(long(self.eta)))
- else:
- s = "%2.f%% [Working]" % (self.percent)
- print "\r%s" % (s),
- sys.stdout.flush()
- return True
-
- def stop(self):
- """Called when all files have been fetched."""
- print "\rDone downloading "
-
- def mediaChange(self, medium, drive):
- """react to media change events."""
- print ("Media change: please insert the disc labeled "
- "'%s' in the drive '%s' and press enter") % (medium, drive)
-
- return raw_input() not in ('c', 'C')
-
-
-class CdromProgress(object):
- """Report the cdrom add progress."""
-
- def __init__(self):
- warnings.warn("apt.progress.CdromProgress is deprecated.",
- DeprecationWarning, stacklevel=2)
-
- def askCdromName(self):
- """Ask for a cdrom name"""
-
- def changeCdrom(self):
- """Change cdrom"""
-
- def update(self, text, current):
- """Update."""
-
-
-class DumbInstallProgress(base.InstallProgress):
- """Report the install progress."""
-
- def __init__(self):
- base.InstallProgress.__init__(self)
- warnings.warn("apt.progress.*InstallProgress are deprecated.",
- DeprecationWarning, stacklevel=2)
-
- def updateInterface(self):
- # *_stream were not available in the old progress reporting classes,
- # create the attributes if they do not exist yet; as they are used
- # in base.InstallProgress.update_interface().
- if hasattr(self, "writefd") and not hasattr(self, "write_stream"):
- self.write_stream = os.fdopen(self.writefd, "w")
- if hasattr(self, "statusfd") and not hasattr(self, "status_stream"):
- self.status_stream = os.fdopen(self.statusfd, "r")
- return base.InstallProgress.update_interface(self)
-
- def update_interface(self):
- return self.updateInterface()
-
- def startUpdate(self):
- return base.InstallProgress.start_update(self)
-
- def start_update(self):
- return self.startUpdate()
-
- def finishUpdate(self):
- return base.InstallProgress.finish_update(self)
-
- def finish_update(self):
- return self.finishUpdate()
-
-
-class InstallProgress(DumbInstallProgress, base.InstallProgress):
- """An InstallProgress that is pretty useful.
-
- It supports the attributes 'percent' 'status' and callbacks for the dpkg
- errors and conffiles and status changes.
- """
-
- selectTimeout = AttributeDeprecatedBy('select_timeout')
-
- def statusChange(self, pkg, percent, status):
- return base.InstallProgress.status_change(self, pkg, percent, status)
-
- def status_change(self, pkg, percent, status):
- return self.statusChange(pkg, percent, status)
-
- def waitChild(self):
- return base.InstallProgress.wait_child(self)
-
- def wait_child(self):
- return self.waitChild()
-
-
-class DpkgInstallProgress(InstallProgress):
- """Progress handler for a local Debian package installation."""
-
- debfile = ""
- debname = ""
-
- def run(self, debfile):
- """Start installing the given Debian package."""
- # Deprecated stuff
- self.debfile = debfile
- self.debname = os.path.basename(debfile).split("_")[0]
- return base.InstallProgress.run(self, debfile)
diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py
index f5a86ecb..48839d6e 100644
--- a/aptsources/sourceslist.py
+++ b/aptsources/sourceslist.py
@@ -34,7 +34,6 @@ import time
import apt_pkg
from .distinfo import DistInfo
-from apt.deprecation import function_deprecated_by
#from apt_pkg import gettext as _
@@ -352,9 +351,6 @@ class SourcesList(object):
if os.path.exists(file+backup_ext):
shutil.copy(file+backup_ext, file)
- if apt_pkg._COMPAT_0_7:
- restoreBackup = function_deprecated_by(restore_backup)
-
def backup(self, backup_ext=None):
""" make a backup of the current source files, if no backup extension
is given, the current date/time is used (and returned) """
diff --git a/debian/python-apt-common.install b/debian/python-apt-common.install
index bea48037..d21f9b8e 100644
--- a/debian/python-apt-common.install
+++ b/debian/python-apt-common.install
@@ -1,4 +1,2 @@
usr/share/locale
usr/share/python-apt
-# Install the migration helper
-utils/migrate-0.8.py usr/share/python-apt
diff --git a/debian/python-apt-common.lintian-overrides b/debian/python-apt-common.lintian-overrides
deleted file mode 100644
index f0eddf6b..00000000
--- a/debian/python-apt-common.lintian-overrides
+++ /dev/null
@@ -1,2 +0,0 @@
-# package depends on python | python3
-python-script-but-no-python-dep usr/share/python-apt/migrate-0.8.py
diff --git a/doc/source/conf.py b/doc/source/conf.py
index 8fbf2c11..bdf0579b 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -32,8 +32,6 @@ if os.path.exists("../../build"):
sys.path.pop(0)
else:
sys.stdout.write('I: Found apt_pkg.so in %s\n' % sys.path[0])
- # Hack: Disable compatibility mode
- apt_pkg._COMPAT_0_7 = 0
break
diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc
index 5e48be04..4cffcaa5 100644
--- a/python/apt_pkgmodule.cc
+++ b/python/apt_pkgmodule.cc
@@ -903,8 +903,6 @@ extern "C" void initapt_pkg()
PyModule_AddIntConstant(Module,"INSTSTATE_HOLD_REINSTREQ",pkgCache::State::HoldReInstReq);
- // DEPRECATED API
- PyModule_AddIntConstant(Module,"_COMPAT_0_7",0);
#if PY_MAJOR_VERSION >= 3
return Module;
#endif
diff --git a/utils/migrate-0.8.py b/utils/migrate-0.8.py
deleted file mode 100755
index 555257a9..00000000
--- a/utils/migrate-0.8.py
+++ /dev/null
@@ -1,254 +0,0 @@
-#!/usr/bin/python2.6
-#
-# migrate-0.8.py - Find use of deprecated methods/attributes in the code.
-#
-# Copyright (C) 2009 Julian Andres Klode <jak@debian.org>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA
-"""migrate-0.8.py - Find all occurences of funcs./attrs. deprecated in 0.8.
-
-Usage: python2.6 migrate-0.8.py [options] <file/directory>...
-
-This reads the list of all functions and attributes available only in
-COMPAT_0_7 builds and checks for occurences in the given Python modules. Has
-to be run from the python-apt source code directory.
-
-Requires python2.6 to be installed.
-
-Parameters:
- -h Display this help
- -c Colorize the matching parts in the output.
-"""
-import _ast
-import ast
-import glob
-import linecache
-import os
-import re
-import sys
-import types
-from collections import defaultdict
-from textwrap import fill
-
-color=False
-if len(sys.argv) > 1 and sys.argv[1] in ('-c', '--color', '--colour'):
- color=True
- del sys.argv[1]
-
-if '-h' in sys.argv or '--help' in sys.argv or not sys.argv[1:]:
- print __doc__.strip()
- sys.exit(0)
-
-if os.path.dirname(__file__).endswith('utils'):
- sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
-
-deprecated_cpp_stuff = set([
- '.Add', '.AllTargets', '.Arch', '.Architecture', '.Archive',
- '.ArchiveURI', '.Auto', '.Base64Encode', '.Binaries', '.BrokenCount',
- '.BuildDepends', '.Bytes', '.CheckDep', '.CheckDomainList', '.Clear',
- '.Close', '.Commit', '.CompType', '.Complete', '.Component', '.Config',
- '.CurStateConfigFiles', '.CurStateHalfConfigured',
- '.CurStateHalfInstalled', '.CurStateInstalled', '.CurStateNotInstalled',
- '.CurStateUnPacked', '.CurrentState', '.CurrentVer', '.Date',
- '.DeQuoteString', '.DebSize', '.DelCount', '.DepType', '.DependsCount',
- '.DependsList', '.DependsListStr', '.DescURI', '.Describe', '.DestFile',
- '.Dist', '.DoInstall', '.Downloadable', '.ErrorText', '.Essential',
- '.Exists', '.FetchNeeded', '.FileList', '.FileName', '.FileSize',
- '.Files', '.Find', '.FindB', '.FindDir', '.FindFile', '.FindFlag',
- '.FindI', '.FindIndex', '.FindRaw', '.FixBroken', '.FixMissing',
- '.GetAcquire', '.GetArchives', '.GetCache', '.GetCandidateVer',
- '.GetCdrom', '.GetDepCache', '.GetIndexes', '.GetLock',
- '.GetPackageManager', '.GetPkgAcqFile', '.GetPkgActionGroup',
- '.GetPkgProblemResolver', '.GetPkgRecords', '.GetPkgSourceList',
- '.GetPkgSrcRecords', '.HasPackages', '.Hash', '.Homepage', '.ID',
- '.Ident', '.Important', '.Index', '.IndexFiles', '.IndexType', '.Init',
- '.InitConfig', '.InitSystem', '.InstCount', '.InstState',
- '.InstStateHold', '.InstStateHoldReInstReq', '.InstStateOk',
- '.InstStateReInstReq', '.InstallProtect', '.InstalledSize',
- '.IsAutoInstalled', '.IsGarbage', '.IsInstBroken', '.IsNowBroken',
- '.IsTrusted', '.IsUpgradable', '.Items', '.Jump', '.KeepCount',
- '.Label', '.LanguageCode', '.LibVersion', '.List', '.Local',
- '.LongDesc', '.Lookup', '.MD5Hash', '.Maintainer', '.MarkDelete',
- '.MarkInstall', '.MarkKeep', '.MarkedDelete', '.MarkedDowngrade',
- '.MarkedInstall', '.MarkedKeep', '.MarkedReinstall', '.MarkedUpgrade',
- '.MinimizeUpgrade', '.MyTag', '.Name', '.NotAutomatic', '.NotSource',
- '.Offset', '.Open', '.Origin', '.Package', '.PackageCount',
- '.PackageFileCount', '.Packages', '.ParentPkg', '.ParentVer',
- '.ParseCommandLine', '.ParseDepends', '.ParseSection',
- '.ParseSrcDepends', '.ParseTagFile', '.PartialPresent',
- '.PkgSystemLock', '.PkgSystemUnLock', '.PriExtra', '.PriImportant',
- '.PriOptional', '.PriRequired', '.PriStandard', '.Priority',
- '.PriorityStr', '.Protect', '.ProvidesCount', '.ProvidesList',
- '.QuoteString', '.ReadConfigDir', '.ReadConfigFile',
- '.ReadConfigFileISC', '.ReadMainList', '.ReadPinFile', '.Record',
- '.Remove', '.Resolve', '.ResolveByKeep', '.Restart', '.RevDependsList',
- '.RewriteSection', '.RewriteSourceOrder', '.Run', '.SHA1Hash',
- '.SHA256Hash', '.Section', '.SelStateDeInstall', '.SelStateHold',
- '.SelStateInstall', '.SelStatePurge', '.SelStateUnknown',
- '.SelectedState', '.Set', '.SetCandidateVer', '.SetReInstall',
- '.ShortDesc', '.Shutdown', '.Site', '.Size', '.SizeToStr',
- '.SmartTargetPkg', '.SourcePkg', '.SourceVer', '.Status', '.Step',
- '.StrToTime', '.StringToBool', '.SubTree', '.TargetPkg', '.TargetVer',
- '.Time', '.TimeRFC1123', '.TimeToStr', '.TotalNeeded',
- '.TranslationDescription', '.URI', '.URItoFileName', '.Update',
- '.Upgrade', '.UpstreamVersion', '.UsrSize', '.ValueList',
- '.VerFileCount', '.VerStr', '.Version', '.VersionCompare',
- '.VersionCount', '.VersionList', '.newConfiguration', 'Base64Encode',
- 'CheckDep', 'CheckDomainList', 'Config', 'CurStateConfigFiles',
- 'CurStateHalfConfigured', 'CurStateHalfInstalled', 'CurStateInstalled',
- 'CurStateNotInstalled', 'CurStateUnPacked', 'Date', 'DeQuoteString',
- 'GetAcquire', 'GetCache', 'GetCdrom', 'GetDepCache', 'GetLock',
- 'GetPackageManager', 'GetPkgAcqFile', 'GetPkgActionGroup',
- 'GetPkgProblemResolver', 'GetPkgRecords', 'GetPkgSourceList',
- 'GetPkgSrcRecords', 'InitConfig', 'InitSystem', 'InstStateHold',
- 'InstStateHoldReInstReq', 'InstStateOk', 'InstStateReInstReq',
- 'LibVersion', 'ParseCommandLine', 'ParseDepends', 'ParseSection',
- 'ParseSrcDepends', 'ParseTagFile', 'PkgSystemLock', 'PkgSystemUnLock',
- 'PriExtra', 'PriImportant', 'PriOptional', 'PriRequired', 'PriStandard',
- 'QuoteString', 'ReadConfigDir', 'ReadConfigFile', 'ReadConfigFileISC',
- 'RewriteSection', 'RewriteSourceOrder', 'SelStateDeInstall',
- 'SelStateHold', 'SelStateInstall', 'SelStatePurge', 'SelStateUnknown',
- 'SizeToStr', 'StrToTime', 'StringToBool', 'Time', 'TimeRFC1123',
- 'TimeToStr', 'URItoFileName', 'UpstreamVersion', 'VersionCompare',
- 'newConfiguration', '.has_key'])
-
-def do_color(string, words):
- """Colorize (red) the given words in the given string."""
- if not color:
- return string
- for word in words:
- word = re.escape(word)
- string = re.sub('([^_]*)(%s)([^_]*)' % word, "\\1\033[31m\033[1m" +
- r"\2" + "\033[0m\\3", string)
- return string
-
-def find_deprecated_py():
- """Find all the deprecated functions and attributes.
-
- Import apt_pkg, set _COMPAT_0_7 to 0, import apt and aptsources and
- create a list of all attributes. Then remove the imported modules,
- reimport them (with _COMPAT_0_7=1), and see which functions do not
- exist anymore.
- """
-
- modules = ('apt', 'apt.package', 'apt.cdrom', 'apt.cache', 'apt.debfile',
- 'apt.progress', 'apt.progress.old', 'aptsources.distinfo',
- 'aptsources.distro', 'aptsources.sourceslist')
-
- import apt_pkg
- apt_pkg._COMPAT_0_7 = 0
-
- empty = set(sys.modules)
- new, deprecated = set(), set()
-
- for mname in sorted(modules):
- module = __import__(mname, fromlist=['*'])
-
- for clsname in dir(module):
- cls = getattr(module, clsname)
- if not isinstance(cls, types.TypeType):
- new.add(clsname)
- continue
- # Attributes/Methods
- new.update(clsname + '.' + name for name in dir(cls))
-
- for mname in sys.modules.keys():
- if not mname in empty:
- del sys.modules[mname]
-
- apt_pkg._COMPAT_0_7 = 1
-
- for mname in sorted(modules):
- module = __import__(mname, fromlist=['*'])
- for clsname in dir(module):
- cls = getattr(module, clsname)
- if not isinstance(cls, types.TypeType):
- deprecated.add(clsname)
- continue
- for name in dir(cls):
- if not clsname + '.' + name in new:
- # Attributes/Methods, which are deprecated (not in new).
- deprecated.add('.' + name)
-
- for mname in sys.modules.keys():
- if not mname in empty:
- del sys.modules[mname]
-
- return deprecated.difference(new)
-
-
-def find_occurences(all_old, files):
- """Find all ocurrences in the given Python files."""
- for fname in files:
- if not os.path.exists(fname):
- continue
- if not (fname in sys.argv or fname.endswith('.py') or
- re.match('^#.*python.*', open(fname).readline())):
- continue
-
- words = defaultdict(lambda: set())
- try:
- node = ast.parse(open(fname, "rU").read(), fname)
- except Exception as e:
- print >> sys.stderr, "Ignoring %s: %s" % (fname, e)
- continue
- for i in ast.walk(node):
- if isinstance(i, _ast.ImportFrom):
- for alias in i.names:
- if alias.name in all_old:
- words[i.lineno].add(alias.name)
- if isinstance(i, _ast.Name) and i.id in all_old:
- words[i.lineno].add(i.id)
-
- if isinstance(i, _ast.Attribute) and ('.' + i.attr in all_old):
- words[i.lineno].add(i.attr)
-
- for lineno in sorted(words):
- line = do_color(linecache.getline(fname, lineno).rstrip('\n'),
- words[lineno])
- print '%s:%s:%s' % (fname, lineno, line)
-
-# Now, let's find them in the code.
-
-print __doc__.split("\n")[0]
-print
-print fill('Information: Please verify that the results are correct before '
- 'you modify any code, because there may be false positives.', 79)
-print
-if color:
- print fill('Information: The color is not always correct, because we '
- 'simply highlight the matched words (like grep).', 79)
- print
-
-all_old = deprecated_cpp_stuff
-
-if not '-P' in sys.argv:
- all_old |= find_deprecated_py()
-else:
- sys.argv.remove('-P')
-
-files = set()
-for path in sys.argv[1:]:
- if not os.path.exists(path):
- raise ValueError('Path does not exist: %s' % path)
- if os.path.isfile(path):
- files.add(path)
- else:
- for root, dirs, files_ in os.walk(path):
- for fname in files_:
- files.add(os.path.normpath(os.path.join(root, fname)))
-
-find_occurences(all_old, sorted(files))