Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f1b6b74

Browse filesBrowse files
authored
Check pip-compile failed to resolve requirements (bazel-contrib#482)
1 parent 915f21b commit f1b6b74
Copy full SHA for f1b6b74

File tree

Expand file treeCollapse file tree

1 file changed

+26
-10
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+26
-10
lines changed

‎python/pip_install/pip_compile.py

Copy file name to clipboardExpand all lines: python/pip_install/pip_compile.py
+26-10Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,33 @@
7474
cli()
7575
print("cli() should exit", file=sys.stderr)
7676
sys.exit(1)
77-
except SystemExit:
78-
golden = open(requirements_txt).readlines()
79-
out = open(requirements_out).readlines()
80-
if golden != out:
81-
import difflib
82-
83-
print(''.join(difflib.unified_diff(golden, out)), file=sys.stderr)
77+
except SystemExit as e:
78+
if e.code == 2:
8479
print(
85-
"Lock file out of date. Run '"
86-
+ update_command
87-
+ "' to update.",
80+
"pip-compile exited with code 2. This means that pip-compile found "
81+
"incompatible requirements or could not find a version that matches "
82+
f"the install requirement in {requirements_in}.",
8883
file=sys.stderr,
8984
)
9085
sys.exit(1)
86+
elif e.code == 0:
87+
golden = open(requirements_txt).readlines()
88+
out = open(requirements_out).readlines()
89+
if golden != out:
90+
import difflib
91+
92+
print(''.join(difflib.unified_diff(golden, out)), file=sys.stderr)
93+
print(
94+
"Lock file out of date. Run '"
95+
+ update_command
96+
+ "' to update.",
97+
file=sys.stderr,
98+
)
99+
sys.exit(1)
100+
sys.exit(0)
101+
else:
102+
print(
103+
f"pip-compile unexpectedly exited with code {e.code}.",
104+
file=sys.stderr
105+
)
106+
sys.exit(1)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.