summaryrefslogtreecommitdiffstats
path: root/doc/examples/cdrom.py
diff options
context:
space:
mode:
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)