summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKiwinote <kiwinote@gmail.com>2010-06-25 21:45:19 +0100
committerKiwinote <kiwinote@gmail.com>2010-06-25 21:45:19 +0100
commit5ced3fd6f12111305f43f8cdc9b04a5b3bc2be7e (patch)
tree36427db62df233be5dfebc6b52117d8c483515f0
parentae363bccb5b52ffc7a17e3f6b3d7b1cff5f65a98 (diff)
downloadpython-apt-5ced3fd6f12111305f43f8cdc9b04a5b3bc2be7e.tar.gz
Don't depend on python-debian
-rw-r--r--apt/debfile.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/apt/debfile.py b/apt/debfile.py
index 90d58449..469cbb36 100644
--- a/apt/debfile.py
+++ b/apt/debfile.py
@@ -24,7 +24,6 @@ import os
import sys
from apt_pkg import gettext as _
-from debian.debfile import DebFile
from StringIO import StringIO
class NoDebArchiveException(IOError):
@@ -470,14 +469,18 @@ class DebPackage(object):
remove.append(pkg.name)
return (install, remove, unauthenticated)
+ @property
def control_filelist(self):
""" return the list of files in control.tar.gt """
+ try:
+ from debian.debfile import DebFile
+ except:
+ raise Exception(_("Python-debian module not available"))
content = []
for name in DebFile(self.file).control:
if name and name != ".":
content.append(name)
return sorted(content)
- control_filelist = property(control_filelist)
def to_hex(self, in_data):
hex = ""
@@ -515,6 +518,10 @@ class DebPackage(object):
def control_content(self, name):
""" return the content of a specific control.tar.gz file """
+ try:
+ from debian.debfile import DebFile
+ except:
+ raise Exception(_("Python-debian module not available"))
control = DebFile(self.file).control
if name in control:
return self._get_content(control, name)
@@ -522,6 +529,10 @@ class DebPackage(object):
def data_content(self, name):
""" return the content of a specific control.tar.gz file """
+ try:
+ from debian.debfile import DebFile
+ except:
+ raise Exception(_("Python-debian module not available"))
data = DebFile(self.file).data
if name in data:
return self._get_content(data, name)