Nick Coghlan | 60f08c8 | 2013-11-30 17:45:09 +1000 | [diff] [blame] | 1 | """Basic pip uninstallation support, helper for the Windows uninstaller""" |
| 2 | |
| 3 | import argparse |
| 4 | import ensurepip |
Igor Filatov | 9adda0c | 2017-09-21 13:07:45 +0300 | [diff] [blame] | 5 | import sys |
Nick Coghlan | 60f08c8 | 2013-11-30 17:45:09 +1000 | [diff] [blame] | 6 | |
| 7 | |
Nick Coghlan | f71cae0 | 2013-12-23 18:20:34 +1000 | [diff] [blame] | 8 | def _main(argv=None): |
Nick Coghlan | 60f08c8 | 2013-11-30 17:45:09 +1000 | [diff] [blame] | 9 | parser = argparse.ArgumentParser(prog="python -m ensurepip._uninstall") |
| 10 | parser.add_argument( |
| 11 | "--version", |
| 12 | action="version", |
| 13 | version="pip {}".format(ensurepip.version()), |
| 14 | help="Show the version of pip this will attempt to uninstall.", |
| 15 | ) |
| 16 | parser.add_argument( |
| 17 | "-v", "--verbose", |
| 18 | action="count", |
| 19 | default=0, |
| 20 | dest="verbosity", |
| 21 | help=("Give more output. Option is additive, and can be used up to 3 " |
| 22 | "times."), |
| 23 | ) |
| 24 | |
Nick Coghlan | f71cae0 | 2013-12-23 18:20:34 +1000 | [diff] [blame] | 25 | args = parser.parse_args(argv) |
Nick Coghlan | 60f08c8 | 2013-11-30 17:45:09 +1000 | [diff] [blame] | 26 | |
Igor Filatov | 9adda0c | 2017-09-21 13:07:45 +0300 | [diff] [blame] | 27 | return ensurepip._uninstall_helper(verbosity=args.verbosity) |
Nick Coghlan | 60f08c8 | 2013-11-30 17:45:09 +1000 | [diff] [blame] | 28 | |
| 29 | |
| 30 | if __name__ == "__main__": |
Igor Filatov | 9adda0c | 2017-09-21 13:07:45 +0300 | [diff] [blame] | 31 | sys.exit(_main()) |