summaryrefslogtreecommitdiffstats
path: root/doc/examples/cdrom.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 18:07:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 18:07:41 +0000
commit76926159194e180003aa78de97e5f287bf4325a5 (patch)
tree2cea7245cdc3f66355900c820c145eba90598766 /doc/examples/cdrom.py
parentInitial commit. (diff)
downloadpython-apt-76926159194e180003aa78de97e5f287bf4325a5.tar.xz
python-apt-76926159194e180003aa78de97e5f287bf4325a5.zip
Adding upstream version 2.7.6.upstream/2.7.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'doc/examples/cdrom.py')
-rw-r--r--doc/examples/cdrom.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/doc/examples/cdrom.py b/doc/examples/cdrom.py
new file mode 100644
index 0000000..ad4d2ba
--- /dev/null
+++ b/doc/examples/cdrom.py
@@ -0,0 +1,24 @@
+#!/usr/bin/python3
+# example how to deal with the depcache
+
+import sys
+
+import apt_pkg
+from progress import TextCdromProgress
+
+# init
+apt_pkg.init()
+
+cdrom = apt_pkg.Cdrom()
+print(cdrom)
+
+progress = TextCdromProgress()
+
+(res, ident) = cdrom.ident(progress)
+print(f"ident result is: {res} ({ident}) ")
+
+apt_pkg.config["APT::CDROM::Rename"] = "True"
+cdrom.add(progress)
+
+print("Exiting")
+sys.exit(0)