PY-29471 Don't propagate not existing exit code from runpy.run_module()

packaging_tool.py is terminated with the right exit code from pip
anyway with this approach because pip.__main__ calls sys.exit() itself.
This commit is contained in:
Mikhail Golubev
2018-04-21 21:13:16 +03:00
parent 069846f883
commit 7e9a2b871f
+4 -5
View File
@@ -56,11 +56,11 @@ def do_list():
def do_install(pkgs):
return run_pip(['install'] + pkgs)
run_pip(['install'] + pkgs)
def do_uninstall(pkgs):
return run_pip(['uninstall', '-y'] + pkgs)
run_pip(['uninstall', '-y'] + pkgs)
def run_pip(args):
@@ -143,13 +143,12 @@ def main():
rmdir = mkdtemp_ifneeded()
pkgs = sys.argv[2:]
retcode = do_install(pkgs)
do_install(pkgs)
if rmdir is not None:
import shutil
shutil.rmtree(rmdir)
elif cmd == 'untar':
if len(sys.argv) < 2:
usage()
@@ -159,7 +158,7 @@ def main():
if len(sys.argv) < 2:
usage()
pkgs = sys.argv[2:]
retcode = do_uninstall(pkgs)
do_uninstall(pkgs)
elif cmd == 'pyvenv':
opts, args = getopt.getopt(sys.argv[2:], '', ['system-site-packages'])
if len(args) != 1: