home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyo (Python 2.4)
-
- import warnings
- warnings.filterwarnings('ignore', 'apt API not stable yet', FutureWarning)
- import apt
- import os
- (COL_NAME, COL_ITEM, COL_POPCON) = range(3)
-
- class MyCache(apt.Cache):
-
- def __init__(self, progress = None):
- apt.Cache.__init__(self, progress)
- pipe = os.popen('dpkg --print-architecture')
- self._arch = pipe.read().strip()
- del pipe
-
-
- def pkgDependsOn(self, pkgname, depends_name):
- ''' check if a given pkg depends on a given dependencie '''
- if not self.has_key(pkgname):
- return False
-
- pkg = self[pkgname]
- candver = self._depcache.GetCandidateVer(pkg._pkg)
- if candver == None:
- return False
-
- dependslist = candver.DependsList
- for dep in dependslist.keys():
- if dep == 'Depends' or dep == 'PreDepends':
- for depVerList in dependslist[dep]:
- for z in depVerList:
- for tpkg in z.AllTargets():
- if depends_name == tpkg.ParentPkg.Name:
- return True
- continue
-
-
-
-
- return False
-
-
- def clean(self):
- self._depcache.Init()
-
-
- def getArch(self):
- ''' Return the cpu architecture of the system'''
- return self._arch
-
-
-
- def xmlescape(s):
- escape = escape
- import xml.sax.saxutils
- if s == None:
- return ''
- else:
- return escape(s)
-
-
- def iterate_list_store(store, it):
- ''' iterate over a gtk tree-model, returns a gtk.TreeIter for each element
- '''
- if not it:
- raise StopIteration
-
- yield it
- while True:
- it = store.iter_next(it)
- if it == None:
- raise StopIteration
-
- yield it
-
-