summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorBen Finney <ben@benfinney.id.au>2008-05-16 16:50:38 +1000
committerBen Finney <ben@benfinney.id.au>2008-05-16 16:50:38 +1000
commitad7bc46acd80451de21ce58450edb0f4367a5c79 (patch)
tree12775f7901544a709f8d63079f1cd57fef00f5a8 /doc
parenta953d82143f0ec979e18f17e8d9bbacbac954868 (diff)
downloadpython-apt-ad7bc46acd80451de21ce58450edb0f4367a5c79.tar.gz
Fix code indentation to 4 spaces, to conform with PEP 8.
Diffstat (limited to 'doc')
-rw-r--r--doc/examples/acquire.py38
-rwxr-xr-xdoc/examples/build-deps.py72
-rwxr-xr-xdoc/examples/checkstate.py34
-rwxr-xr-xdoc/examples/config.py16
-rwxr-xr-xdoc/examples/configisc.py24
-rwxr-xr-xdoc/examples/dependant-pkgs.py34
-rwxr-xr-xdoc/examples/gui-inst.py48
-rw-r--r--doc/examples/inst.py36
-rwxr-xr-xdoc/examples/print_uris.py16
-rw-r--r--doc/examples/progress.py4
-rwxr-xr-xdoc/examples/recommends.py38
-rwxr-xr-xdoc/examples/records.py10
-rw-r--r--doc/examples/sources.py6
-rwxr-xr-xdoc/examples/tagfile.py4
-rwxr-xr-xdoc/examples/versiontest.py40
15 files changed, 210 insertions, 210 deletions
diff --git a/doc/examples/acquire.py b/doc/examples/acquire.py
index 07f8da0e..7bf7d646 100644
--- a/doc/examples/acquire.py
+++ b/doc/examples/acquire.py
@@ -6,25 +6,25 @@ import tempfile
def get_file(fetcher, uri, destFile):
- cwd = os.getcwd()
- # create a temp dir
- dir = tempfile.mkdtemp()
- os.chdir(dir)
- # get the file
- af = apt_pkg.GetPkgAcqFile(fetcher,
- uri=uri,
- descr="sample descr")
- res = fetcher.Run()
- if res != fetcher.ResultContinue:
- os.rmdir(dir)
- os.chdir(cwd)
- return False
- filename = os.path.basename(uri)
- os.rename(dir+"/"+filename,destFile)
- # cleanup
- os.rmdir(dir)
- os.chdir(cwd)
- return True
+ cwd = os.getcwd()
+ # create a temp dir
+ dir = tempfile.mkdtemp()
+ os.chdir(dir)
+ # get the file
+ af = apt_pkg.GetPkgAcqFile(fetcher,
+ uri=uri,
+ descr="sample descr")
+ res = fetcher.Run()
+ if res != fetcher.ResultContinue:
+ os.rmdir(dir)
+ os.chdir(cwd)
+ return False
+ filename = os.path.basename(uri)
+ os.rename(dir+"/"+filename,destFile)
+ # cleanup
+ os.rmdir(dir)
+ os.chdir(cwd)
+ return True
apt_pkg.init()
diff --git a/doc/examples/build-deps.py b/doc/examples/build-deps.py
index 2d83a54f..dc1a6f4e 100755
--- a/doc/examples/build-deps.py
+++ b/doc/examples/build-deps.py
@@ -7,17 +7,17 @@ import sets # only needed for python2.3, python2.4 supports this naively
def get_source_pkg(pkg, records, depcache):
- """ get the source package name of a given package """
- version = depcache.GetCandidateVer(pkg)
- if not version:
- return None
- file, index = version.FileList.pop(0)
- records.Lookup((file, index))
- if records.SourcePkg != "":
- srcpkg = records.SourcePkg
- else:
- srcpkg = pkg.Name
- return srcpkg
+ """ get the source package name of a given package """
+ version = depcache.GetCandidateVer(pkg)
+ if not version:
+ return None
+ file, index = version.FileList.pop(0)
+ records.Lookup((file, index))
+ if records.SourcePkg != "":
+ srcpkg = records.SourcePkg
+ else:
+ srcpkg = pkg.Name
+ return srcpkg
# main
@@ -30,45 +30,45 @@ srcrecords = apt_pkg.GetPkgSrcRecords()
# base package that we use for build-depends calculation
if len(sys.argv) < 2:
- print "need a package name as argument"
- sys.exit(1)
+ print "need a package name as argument"
+ sys.exit(1)
try:
- base = cache[sys.argv[1]]
+ base = cache[sys.argv[1]]
except KeyError:
- print "No package %s found" % sys.argv[1]
- sys.exit(1)
+ print "No package %s found" % sys.argv[1]
+ sys.exit(1)
all_build_depends = sets.Set()
# get the build depdends for the package itself
srcpkg_name = get_source_pkg(base, records, depcache)
print "srcpkg_name: %s " % srcpkg_name
if not srcpkg_name:
- print "Can't find source package for '%s'" % pkg.Name
+ print "Can't find source package for '%s'" % pkg.Name
srcrec = srcrecords.Lookup(srcpkg_name)
if srcrec:
- print "Files:"
- print srcrecords.Files
- bd = srcrecords.BuildDepends
- print "build-depends of the package: %s " % bd
- for b in bd:
- all_build_depends.add(b[0])
+ print "Files:"
+ print srcrecords.Files
+ bd = srcrecords.BuildDepends
+ print "build-depends of the package: %s " % bd
+ for b in bd:
+ all_build_depends.add(b[0])
# calculate the build depends for all dependencies
depends = depcache.GetCandidateVer(base).DependsList
for dep in depends["Depends"]: # FIXME: do we need to consider PreDepends?
- pkg = dep[0].TargetPkg
- srcpkg_name = get_source_pkg(pkg, records, depcache)
- if not srcpkg_name:
- print "Can't find source package for '%s'" % pkg.Name
- continue
- srcrec = srcrecords.Lookup(srcpkg_name)
- if srcrec:
- #print srcrecords.Package
- #print srcrecords.Binaries
- bd = srcrecords.BuildDepends
- #print "%s: %s " % (srcpkg_name, bd)
- for b in bd:
- all_build_depends.add(b[0])
+ pkg = dep[0].TargetPkg
+ srcpkg_name = get_source_pkg(pkg, records, depcache)
+ if not srcpkg_name:
+ print "Can't find source package for '%s'" % pkg.Name
+ continue
+ srcrec = srcrecords.Lookup(srcpkg_name)
+ if srcrec:
+ #print srcrecords.Package
+ #print srcrecords.Binaries
+ bd = srcrecords.BuildDepends
+ #print "%s: %s " % (srcpkg_name, bd)
+ for b in bd:
+ all_build_depends.add(b[0])
print "\n".join(all_build_depends)
diff --git a/doc/examples/checkstate.py b/doc/examples/checkstate.py
index 2986872f..3368d500 100755
--- a/doc/examples/checkstate.py
+++ b/doc/examples/checkstate.py
@@ -14,23 +14,23 @@ packages = cache.Packages
uninstalled, updated, upgradable = {}, {}, {}
for package in packages:
- versions = package.VersionList
- if not versions:
- continue
- version = versions[0]
- for other_version in versions:
- if apt_pkg.VersionCompare(version.VerStr, other_version.VerStr)<0:
- version = other_version
- if package.CurrentVer:
- current = package.CurrentVer
- if apt_pkg.VersionCompare(current.VerStr, version.VerStr)<0:
- upgradable[package.Name] = version
- break
- else:
- updated[package.Name] = current
- else:
- uninstalled[package.Name] = version
+ versions = package.VersionList
+ if not versions:
+ continue
+ version = versions[0]
+ for other_version in versions:
+ if apt_pkg.VersionCompare(version.VerStr, other_version.VerStr)<0:
+ version = other_version
+ if package.CurrentVer:
+ current = package.CurrentVer
+ if apt_pkg.VersionCompare(current.VerStr, version.VerStr)<0:
+ upgradable[package.Name] = version
+ break
+ else:
+ updated[package.Name] = current
+ else:
+ uninstalled[package.Name] = version
for l in (uninstalled, updated, upgradable):
- print l.items()[0]
+ print l.items()[0]
diff --git a/doc/examples/config.py b/doc/examples/config.py
index 222c1331..337899f0 100755
--- a/doc/examples/config.py
+++ b/doc/examples/config.py
@@ -25,31 +25,31 @@ print "Command line is",sys.argv
# Load the default configuration file, InitConfig() does this better..
Cnf.Set("config-file","/etc/apt/apt.conf"); # or Cnf["config-file"] = "..";
if posixpath.exists(Cnf.FindFile("config-file")):
- apt_pkg.ReadConfigFile(Cnf,"/etc/apt/apt.conf");
+ apt_pkg.ReadConfigFile(Cnf,"/etc/apt/apt.conf");
# Merge the command line arguments into the configuration space
Arguments = [('h',"help","help"),
('v',"version","version"),
('q',"quiet","quiet","IntLevel"),
('c',"config-file","","ConfigFile"),
- ('o',"option","","ArbItem")]
+ ('o',"option","","ArbItem")]
print "FileNames",apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv);
print "Quiet level selected is",Cnf.FindI("quiet",0);
# Do some stuff with it
if Cnf.FindB("version",0) == 1:
- print "Version selected - 1.1";
+ print "Version selected - 1.1";
if Cnf.FindB("help",0) == 1:
- print apt_pkg.Package,apt_pkg.Version,"for",apt_pkg.Architecture, \
- "compiled on",apt_pkg.Date,apt_pkg.Time;
- print "Hi, I am the help text for this program";
- sys.exit(0);
+ print apt_pkg.Package,apt_pkg.Version,"for",apt_pkg.Architecture, \
+ "compiled on",apt_pkg.Date,apt_pkg.Time;
+ print "Hi, I am the help text for this program";
+ sys.exit(0);
print "No help for you, try -h";
# Print the configuration space
print "The Configuration space looks like:";
for I in Cnf.keys():
- print "%s \"%s\";"%(I,Cnf[I]);
+ print "%s \"%s\";"%(I,Cnf[I]);
diff --git a/doc/examples/configisc.py b/doc/examples/configisc.py
index 1773a919..45a9c7f6 100755
--- a/doc/examples/configisc.py
+++ b/doc/examples/configisc.py
@@ -13,8 +13,8 @@ import apt_pkg,sys,posixpath;
ConfigFile = apt_pkg.ParseCommandLine(apt_pkg.Config,[],sys.argv);
if len(ConfigFile) != 1:
- print "Must have exactly 1 file name";
- sys.exit(0);
+ print "Must have exactly 1 file name";
+ sys.exit(0);
Cnf = apt_pkg.newConfiguration();
apt_pkg.ReadConfigFileISC(Cnf,ConfigFile[0]);
@@ -26,14 +26,14 @@ apt_pkg.ReadConfigFileISC(Cnf,ConfigFile[0]);
# bind8 config file..
if Cnf.has_key("Zone"):
- print "Zones: ",Cnf.SubTree("zone").List();
- for I in Cnf.List("zone"):
- SubCnf = Cnf.SubTree(I);
- if SubCnf.Find("type") == "slave":
- print "Masters for %s: %s"%(SubCnf.MyTag(),SubCnf.ValueList("masters"));
+ print "Zones: ",Cnf.SubTree("zone").List();
+ for I in Cnf.List("zone"):
+ SubCnf = Cnf.SubTree(I);
+ if SubCnf.Find("type") == "slave":
+ print "Masters for %s: %s"%(SubCnf.MyTag(),SubCnf.ValueList("masters"));
else:
- print "Tree definitions:";
- for I in Cnf.List("tree"):
- SubCnf = Cnf.SubTree(I);
- # This could use Find which would eliminate the possibility of exceptions.
- print "Subtree %s with sections '%s' and architectures '%s'"%(SubCnf.MyTag(),SubCnf["Sections"],SubCnf["Architectures"]);
+ print "Tree definitions:";
+ for I in Cnf.List("tree"):
+ SubCnf = Cnf.SubTree(I);
+ # This could use Find which would eliminate the possibility of exceptions.
+ print "Subtree %s with sections '%s' and architectures '%s'"%(SubCnf.MyTag(),SubCnf["Sections"],SubCnf["Architectures"]);
diff --git a/doc/examples/dependant-pkgs.py b/doc/examples/dependant-pkgs.py
index 2de420a5..bb10ce70 100755
--- a/doc/examples/dependant-pkgs.py
+++ b/doc/examples/dependant-pkgs.py
@@ -6,27 +6,27 @@ import sys
pkgs = set()
cache = apt.Cache()
for pkg in cache:
- candver = cache._depcache.GetCandidateVer(pkg._pkg)
- if candver == None:
- continue
- dependslist = candver.DependsList
- for dep in dependslist.keys():
- # get the list of each dependency object
- for depVerList in dependslist[dep]:
- for z in depVerList:
- # get all TargetVersions of
- # the dependency object
- for tpkg in z.AllTargets():
- if sys.argv[1] == tpkg.ParentPkg.Name:
- pkgs.add(pkg.name)
+ candver = cache._depcache.GetCandidateVer(pkg._pkg)
+ if candver == None:
+ continue
+ dependslist = candver.DependsList
+ for dep in dependslist.keys():
+ # get the list of each dependency object
+ for depVerList in dependslist[dep]:
+ for z in depVerList:
+ # get all TargetVersions of
+ # the dependency object
+ for tpkg in z.AllTargets():
+ if sys.argv[1] == tpkg.ParentPkg.Name:
+ pkgs.add(pkg.name)
main = set()
universe = set()
for pkg in pkgs:
- if "universe" in cache[pkg].section:
- universe.add(cache[pkg].sourcePackageName)
- else:
- main.add(cache[pkg].sourcePackageName)
+ if "universe" in cache[pkg].section:
+ universe.add(cache[pkg].sourcePackageName)
+ else:
+ main.add(cache[pkg].sourcePackageName)
print "main:"
print "\n".join(main)
diff --git a/doc/examples/gui-inst.py b/doc/examples/gui-inst.py
index 28887d34..edaec455 100755
--- a/doc/examples/gui-inst.py
+++ b/doc/examples/gui-inst.py
@@ -22,51 +22,51 @@ from apt.progress import OpProgress, FetchProgress, InstallProgress
class GuiFetchProgress(gtk.Window, FetchProgress):
def __init__(self):
- gtk.Window.__init__(self)
- self.vbox = gtk.VBox()
- self.vbox.show()
- self.add(self.vbox)
- self.progress = gtk.ProgressBar()
- self.progress.show()
- self.label = gtk.Label()
- self.label.show()
- self.vbox.pack_start(self.progress)
- self.vbox.pack_start(self.label)
- self.resize(300,100)
+ gtk.Window.__init__(self)
+ self.vbox = gtk.VBox()
+ self.vbox.show()
+ self.add(self.vbox)
+ self.progress = gtk.ProgressBar()
+ self.progress.show()
+ self.label = gtk.Label()
+ self.label.show()
+ self.vbox.pack_start(self.progress)
+ self.vbox.pack_start(self.label)
+ self.resize(300,100)
def start(self):
print "start"
- self.progress.set_fraction(0.0)
+ self.progress.set_fraction(0.0)
self.show()
def stop(self):
- self.hide()
+ self.hide()
def pulse(self):
FetchProgress.pulse(self)
self.label.set_text("Speed: %s/s" % apt_pkg.SizeToStr(self.currentCPS))
- #self.progressbar.set_fraction(self.currentBytes/self.totalBytes)
- while gtk.events_pending():
- gtk.main_iteration()
+ #self.progressbar.set_fraction(self.currentBytes/self.totalBytes)
+ while gtk.events_pending():
+ gtk.main_iteration()
return True
class TermInstallProgress(InstallProgress, gtk.Window):
def __init__(self):
- gtk.Window.__init__(self)
+ gtk.Window.__init__(self)
InstallProgress.__init__(self)
- self.show()
+ self.show()
box = gtk.VBox()
box.show()
self.add(box)
- self.term = vte.Terminal()
- self.term.show()
+ self.term = vte.Terminal()
+ self.term.show()
# check for the child
self.reaper = vte.reaper_get()
self.reaper.connect("child-exited",self.child_exited)
self.finished = False
- box.pack_start(self.term)
+ box.pack_start(self.term)
self.progressbar = gtk.ProgressBar()
self.progressbar.show()
box.pack_start(self.progressbar)
@@ -115,16 +115,16 @@ iprogress = TermInstallProgress()
# show the interface
while gtk.events_pending():
- gtk.main_iteration()
+ gtk.main_iteration()
pkg = cache["3dchess"]
print "\n%s"%pkg.name
# install or remove, the importend thing is to keep us busy :)
if pkg.isInstalled:
- pkg.markDelete()
+ pkg.markDelete()
else:
- pkg.markInstall()
+ pkg.markInstall()
cache.commit(fprogress, iprogress)
print "Exiting"
diff --git a/doc/examples/inst.py b/doc/examples/inst.py
index d1e2ff99..b37ab4cd 100644
--- a/doc/examples/inst.py
+++ b/doc/examples/inst.py
@@ -11,23 +11,23 @@ from apt.progress import InstallProgress
class TextInstallProgress(InstallProgress):
- def __init__(self):
- apt.progress.InstallProgress.__init__(self)
- self.last = 0.0
+ def __init__(self):
+ apt.progress.InstallProgress.__init__(self)
+ self.last = 0.0
- def updateInterface(self):
- InstallProgress.updateInterface(self)
- if self.last >= self.percent:
- return
- sys.stdout.write("\r[%s] %s\n" %(self.percent, self.status))
- sys.stdout.flush()
- self.last = self.percent
+ def updateInterface(self):
+ InstallProgress.updateInterface(self)
+ if self.last >= self.percent:
+ return
+ sys.stdout.write("\r[%s] %s\n" %(self.percent, self.status))
+ sys.stdout.flush()
+ self.last = self.percent
- def conffile(self,current,new):
- print "conffile prompt: %s %s" % (current,new)
+ def conffile(self,current,new):
+ print "conffile prompt: %s %s" % (current,new)
- def error(self, errorstr):
- print "got dpkg error: '%s'" % errorstr
+ def error(self, errorstr):
+ print "got dpkg error: '%s'" % errorstr
cache = apt.Cache(apt.progress.OpTextProgress())
@@ -39,11 +39,11 @@ pkg = cache["3dchess"]
# install or remove, the importend thing is to keep us busy :)
if pkg.isInstalled:
- print "Going to delete %s" % pkg.name
- pkg.markDelete()
+ print "Going to delete %s" % pkg.name
+ pkg.markDelete()
else:
- print "Going to install %s" % pkg.name
- pkg.markInstall()
+ print "Going to install %s" % pkg.name
+ pkg.markInstall()
res = cache.commit(fprogress, iprogress)
print res
diff --git a/doc/examples/print_uris.py b/doc/examples/print_uris.py
index c8a64223..3c93a668 100755
--- a/doc/examples/print_uris.py
+++ b/doc/examples/print_uris.py
@@ -12,11 +12,11 @@ upgradable = filter(lambda p: p.isUpgradable, cache)
for pkg in upgradable:
- pkg._lookupRecord(True)
- path = apt_pkg.ParseSection(pkg._records.Record)["Filename"]
- cand = pkg._depcache.GetCandidateVer(pkg._pkg)
- for (packagefile,i) in cand.FileList:
- indexfile = cache._list.FindIndex(packagefile)
- if indexfile:
- uri = indexfile.ArchiveURI(path)
- print uri
+ pkg._lookupRecord(True)
+ path = apt_pkg.ParseSection(pkg._records.Record)["Filename"]
+ cand = pkg._depcache.GetCandidateVer(pkg._pkg)
+ for (packagefile,i) in cand.FileList:
+ indexfile = cache._list.FindIndex(packagefile)
+ if indexfile:
+ uri = indexfile.ArchiveURI(path)
+ print uri
diff --git a/doc/examples/progress.py b/doc/examples/progress.py
index 39e73e70..d8f00a52 100644
--- a/doc/examples/progress.py
+++ b/doc/examples/progress.py
@@ -41,8 +41,8 @@ class TextFetchProgress(apt.FetchProgress):
return True
def mediaChange(self, medium, drive):
- print "Please insert medium %s in drive %s" % (medium, drive)
- sys.stdin.readline()
+ print "Please insert medium %s in drive %s" % (medium, drive)
+ sys.stdin.readline()
#return False
diff --git a/doc/examples/recommends.py b/doc/examples/recommends.py
index 03d46068..f0b3b1be 100755
--- a/doc/examples/recommends.py
+++ b/doc/examples/recommends.py
@@ -8,32 +8,32 @@ cache = apt_pkg.GetCache()
class Wanted:
- def __init__(self, name):
- self.name = name
- self.recommended = []
- self.suggested = []
+ def __init__(self, name):
+ self.name = name
+ self.recommended = []
+ self.suggested = []
wanted = {}
for package in cache.Packages:
- current = package.CurrentVer
- if not current:
- continue
- depends = current.DependsList
- for (key, attr) in (('Suggests', 'suggested'),
- ('Recommends', 'recommended')):
- list = depends.get(key, [])
- for dependency in list:
- name = dependency[0].TargetPkg.Name
- dep = cache[name]
- if dep.CurrentVer:
- continue
- getattr(wanted.setdefault(name, Wanted(name)),
- attr).append(package.Name)
+ current = package.CurrentVer
+ if not current:
+ continue
+ depends = current.DependsList
+ for (key, attr) in (('Suggests', 'suggested'),
+ ('Recommends', 'recommended')):
+ list = depends.get(key, [])
+ for dependency in list:
+ name = dependency[0].TargetPkg.Name
+ dep = cache[name]
+ if dep.CurrentVer:
+ continue
+ getattr(wanted.setdefault(name, Wanted(name)),
+ attr).append(package.Name)
ks = wanted.keys()
ks.sort()
for want in ks:
- print want, wanted[want].recommended, wanted[want].suggested
+ print want, wanted[want].recommended, wanted[want].suggested
diff --git a/doc/examples/records.py b/doc/examples/records.py
index ef04b555..9dfc460b 100755
--- a/doc/examples/records.py
+++ b/doc/examples/records.py
@@ -5,8 +5,8 @@ import apt
cache = apt.Cache()
for pkg in cache:
- if not pkg.candidateRecord:
- continue
- if pkg.candidateRecord.has_key("Task"):
- print "Pkg %s is part of '%s'" % (pkg.name, pkg.candidateRecord["Task"].split())
- #print pkg.candidateRecord
+ if not pkg.candidateRecord:
+ continue
+ if pkg.candidateRecord.has_key("Task"):
+ print "Pkg %s is part of '%s'" % (pkg.name, pkg.candidateRecord["Task"].split())
+ #print pkg.candidateRecord
diff --git a/doc/examples/sources.py b/doc/examples/sources.py
index b48c0ba5..8d807f4c 100644
--- a/doc/examples/sources.py
+++ b/doc/examples/sources.py
@@ -10,6 +10,6 @@ apt_pkg.init()
sources = apt_pkg.GetPkgSrcRecords()
sources.Restart()
while sources.Lookup('hello'):
- print sources.Package, sources.Version, sources.Maintainer, sources.Section, `sources.Binaries`
- print sources.Files
- print sources.Index.ArchiveURI(sources.Files[0][2])
+ print sources.Package, sources.Version, sources.Maintainer, sources.Section, `sources.Binaries`
+ print sources.Files
+ print sources.Index.ArchiveURI(sources.Files[0][2])
diff --git a/doc/examples/tagfile.py b/doc/examples/tagfile.py
index 653c0a71..aeba34d2 100755
--- a/doc/examples/tagfile.py
+++ b/doc/examples/tagfile.py
@@ -4,5 +4,5 @@ import apt_pkg
Parse = apt_pkg.ParseTagFile(open("/var/lib/dpkg/status","r"));
while Parse.Step() == 1:
- print Parse.Section.get("Package");
- print apt_pkg.ParseDepends(Parse.Section.get("Depends",""));
+ print Parse.Section.get("Package");
+ print apt_pkg.ParseDepends(Parse.Section.get("Depends",""));
diff --git a/doc/examples/versiontest.py b/doc/examples/versiontest.py
index c4e5f44d..8f18f6c8 100755
--- a/doc/examples/versiontest.py
+++ b/doc/examples/versiontest.py
@@ -7,30 +7,30 @@ apt_pkg.InitSystem();
TestFile = apt_pkg.ParseCommandLine(apt_pkg.Config,[],sys.argv);
if len(TestFile) != 1:
- print "Must have exactly 1 file name";
- sys.exit(0);
+ print "Must have exactly 1 file name";
+ sys.exit(0);
# Go over the file..
List = open(TestFile[0],"r");
CurLine = 0;
while(1):
- Line = List.readline();
- CurLine = CurLine + 1;
- if Line == "":
- break;
- Line = string.strip(Line);
- if len(Line) == 0 or Line[0] == '#':
- continue;
+ Line = List.readline();
+ CurLine = CurLine + 1;
+ if Line == "":
+ break;
+ Line = string.strip(Line);
+ if len(Line) == 0 or Line[0] == '#':
+ continue;
- Split = re.split("[ \n]",Line);
+ Split = re.split("[ \n]",Line);
- # Check forward
- if apt_pkg.VersionCompare(Split[0],Split[1]) != int(Split[2]):
- print "Comparision failed on line %u. '%s' ? '%s' %i != %i"%(CurLine,
- Split[0],Split[1],apt_pkg.VersionCompare(Split[0],Split[1]),
- int(Split[2]));
- # Check reverse
- if apt_pkg.VersionCompare(Split[1],Split[0]) != -1*int(Split[2]):
- print "Comparision failed on line %u. '%s' ? '%s' %i != %i"%(CurLine,
- Split[1],Split[0],apt_pkg.VersionCompare(Split[1],Split[0]),
- -1*int(Split[2]));
+ # Check forward
+ if apt_pkg.VersionCompare(Split[0],Split[1]) != int(Split[2]):
+ print "Comparision failed on line %u. '%s' ? '%s' %i != %i"%(CurLine,
+ Split[0],Split[1],apt_pkg.VersionCompare(Split[0],Split[1]),
+ int(Split[2]));
+ # Check reverse
+ if apt_pkg.VersionCompare(Split[1],Split[0]) != -1*int(Split[2]):
+ print "Comparision failed on line %u. '%s' ? '%s' %i != %i"%(CurLine,
+ Split[1],Split[0],apt_pkg.VersionCompare(Split[1],Split[0]),
+ -1*int(Split[2]));