File tree Expand file tree Collapse file tree 1 file changed +26
-10
lines changed
Expand file tree Collapse file tree 1 file changed +26
-10
lines changed Original file line number Diff line number Diff line change 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 )
You can’t perform that action at this time.
0 commit comments