Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to issue #36 (non-zero status) #99

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/pipupgrade/commands/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import sys, os, os.path as osp
import re
import json
import subprocess

# imports - module imports
from pipupgrade.model import Registry
Expand Down Expand Up @@ -305,7 +306,9 @@ def update_registry(registry,
upgrade = True
)
except PopenError as e:
if raise_err:
if(type(e) == subprocess.CalledProcessError):
print(f"Non-zero value returned by pip while updating {package.name}: {e}")
elif raise_err:
raise
else:
cli.echo("%s upto date." % cli_format(stitle, cli.CYAN),
Expand Down Expand Up @@ -386,4 +389,4 @@ def update_pip(pip_exec, user = None, quiet = None, file = None):
cli.echo("%s upto date." % cli_format(pip_exec, cli.CYAN),
file = file)

return output
return output
5 changes: 3 additions & 2 deletions src/pipupgrade/util/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ def popen(*args, **kwargs):
code = proc.wait()

if code and raise_err:
raise PopenError(code, command)
print("An error occurred while updating package:", PopenError(code, command))
#raise PopenError(code, command)

if output:
output, error = proc.communicate()
Expand Down Expand Up @@ -125,4 +126,4 @@ def touch(filename):
def make_temp_dir():
dir_path = tempfile.mkdtemp()
yield dir_path
shutil.rmtree(dir_path)
shutil.rmtree(dir_path)