File: rpm-e.py

package info (click to toggle)
rpm 4.20.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,832 kB
  • sloc: ansic: 70,093; sh: 1,843; python: 1,037; cpp: 324; makefile: 39
file content (24 lines) | stat: -rwxr-xr-x 651 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/python3

# Uninstall a package from the system.
# A Python equivalent for `rpm -e hello`

import sys
import rpm


class Callback:
    def callback(self, what, amount, total, mydata, wibble):
        # Transactions that only remove packages don't strictly require the
        # the callback to do anything. Though, most operations require at least
        # `rpm.RPMCALLBACK_INST_OPEN_FILE` and `rpm.RPMCALLBACK_INST_CLOSE_FILE`
        # to be handled. See `rpm-i.py` example for more information.
        pass


ts = rpm.TransactionSet()
for name in sys.argv[1:]:
    ts.addErase(name)

callback = Callback()
ts.run(callback.callback, "")