diff options
| author | Chad Smith <chad.smith@canonical.com> | 2018-03-28 12:29:04 -0600 |
|---|---|---|
| committer | Chad Smith <chad.smith@canonical.com> | 2018-03-28 12:29:04 -0600 |
| commit | cf3eaed2e01062f9b5d47042d7a76b092970e0cf (patch) | |
| tree | 53f7c52c5a76bb586da0483699fd6d188e72f457 /tools/pipremove | |
| parent | 9f159f3a55a7bba7868e03d9cccd898678381f03 (diff) | |
| parent | 8caa3bcf8f2c5b3a448b9d892d4cf53ed8db9be9 (diff) | |
| download | vyos-cloud-init-cf3eaed2e01062f9b5d47042d7a76b092970e0cf.tar.gz vyos-cloud-init-cf3eaed2e01062f9b5d47042d7a76b092970e0cf.zip | |
merge from master at 18.2
Diffstat (limited to 'tools/pipremove')
| -rwxr-xr-x | tools/pipremove | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/pipremove b/tools/pipremove new file mode 100755 index 00000000..f8f4ff11 --- /dev/null +++ b/tools/pipremove @@ -0,0 +1,14 @@ +#!/usr/bin/python3 +import subprocess +import sys + +for pkg in sys.argv[1:]: + try: + exec('import %s' % pkg) # pylint: disable=W0122 + except ImportError: + continue + sys.stderr.write("%s removing package %s\n" % (sys.argv[0], pkg)) + ret = subprocess.Popen(['pip', 'uninstall', '--yes', pkg]).wait() + if ret != 0: + sys.stderr.write("Failed to uninstall %s (%d)\n" % (pkg, ret)) + sys.exit(ret) |
