diff options
| author | Michael Vogt <egon@bottom> | 2007-04-24 21:24:32 +0200 |
|---|---|---|
| committer | Michael Vogt <egon@bottom> | 2007-04-24 21:24:32 +0200 |
| commit | f83140ef276db00a2673e5085a40704f078a8cbd (patch) | |
| tree | f2d65b5d4cc573b7dad4125a676788c19a7330ad /apt/cdrom.py | |
| parent | 82a6e0be9a632bc16e5c21b9c3ab0cce9a5b2a37 (diff) | |
| parent | 6b02ff1915b3dcd098474e1b9ccd5f89d6b777da (diff) | |
| download | python-apt-f83140ef276db00a2673e5085a40704f078a8cbd.tar.gz | |
* apt/cdrom.py:
- better cdrom handling support
* apt/package.py:
- added candidateDependencies, installedDependencies
- SizeToString supports PyLong too
- support pkg.architecture
- support candidateRecord, installedRecord
* apt/cache.py:
- fix rootdir
* apt/cdrom.py:
- fix bug in cdrom mountpoint handling
Diffstat (limited to 'apt/cdrom.py')
| -rw-r--r-- | apt/cdrom.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/apt/cdrom.py b/apt/cdrom.py new file mode 100644 index 00000000..8d73339c --- /dev/null +++ b/apt/cdrom.py @@ -0,0 +1,48 @@ + +import apt_pkg +from progress import CdromProgress + +class Cdrom(object): + def __init__(self, progress=None, mountpoint=None, nomount=True): + """ Support for apt-cdrom like features. + Options: + - progress: optional progress.CdromProgress() subclass + - mountpoint: optional alternative mountpoint + - nomount: do not mess with mount/umount the CD + """ + self._cdrom = apt_pkg.GetCdrom() + if progress is None: + self._progress = CdromProgress() + else: + self._progress = progress + # see if we have a alternative mountpoint + if mountpoint is not None: + apt_pkg.Config.Set("Acquire::cdrom::mount",mountpoint) + # do not mess with mount points by default + if nomount is True: + apt_pkg.Config.Set("APT::CDROM::NoMount", "true") + else: + apt_pkg.Config.Set("APT::CDROM::NoMount", "false") + def add(self): + " add cdrom to the sources.list " + return self._cdrom.Add(self._progress) + def ident(self): + " identify the cdrom " + (res, ident) = self._cdrom.Ident(self._progress) + if res: + return ident + return None + @property + def inSourcesList(self): + " check if the cdrom is already in the current sources.list " + cdid = self.ident() + if cdid is None: + # FIXME: throw exception instead + return False + # FIXME: check sources.list.d/ as well + for line in open(apt_pkg.Config.FindFile("Dir::Etc::sourcelist")): + line = line.strip() + if not line.startswith("#") and cdid in line: + return True + return False + |
