@@ -110,7 +110,8 @@ class WorkingDirectoryPaths(NamedTuple):
110
110
pyproject_file : Path # ./pixi-working/pyproject.toml
111
111
environment_file : Path # ./pixi-working/environment.yml
112
112
environment_blas_file : Path # ./pixi-working/scripts/environment-blas.yml
113
- pixi_toml_file : Path # ./pixi-working/pixi.toml
113
+ raw_generated_pixi_toml : Path # ./pixi-working/pixi-raw.toml
114
+ processed_generated_pixi_toml : Path # ./pixi-working/pixi-processed.toml
114
115
gitignore_file : Path # ./pixi-working/.gitignore
115
116
116
117
@@ -173,21 +174,34 @@ def main():
173
174
# Write the unprocessed pixi.toml data to the working directory
174
175
pixi_toml_raw_data = tomlkit .loads (result .stdout .decode ("utf-8" ))
175
176
pixi_toml_raw_content = tomlkit .dumps (pixi_toml_raw_data )
176
- working_directory_paths .pixi_toml_file .write_text (pixi_toml_raw_content )
177
+ working_directory_paths .raw_generated_pixi_toml .write_text (pixi_toml_raw_content )
177
178
178
179
# Generate the pixi.toml content
179
180
pixi_toml_data = postprocess_pixi_toml_data (pixi_toml_raw_data )
180
181
pixi_toml_content = tomlkit .dumps (pixi_toml_data )
182
+ working_directory_paths .processed_generated_pixi_toml .write_text (pixi_toml_content )
181
183
182
184
if args .verify_only :
183
185
# Compare with existing pixi.toml
184
186
existing_pixi_toml_content = original_paths .pixi_toml_file .read_text ()
185
187
if existing_pixi_toml_content != pixi_toml_content :
188
+ # Run diff command to show the differences
189
+ cmd = [
190
+ "diff" ,
191
+ "-u" ,
192
+ str (original_paths .pixi_toml_file ),
193
+ str (working_directory_paths .processed_generated_pixi_toml ),
194
+ ]
195
+ diff_result = subprocess .run (cmd , capture_output = True , text = True )
196
+
186
197
message = dedent ("""\
187
198
Mismatch detected between existing and new pixi.toml content.
188
199
189
- New pixi.toml content:
190
- {pixi_toml_content}
200
+ Diff command:
201
+ {diff_command}
202
+
203
+ Diff output:
204
+ {diff_output}
191
205
192
206
Run 'python scripts/generate-pixi-toml.py' to regenerate it.
193
207
After updating `pixi.toml`, it's suggested to run the following commands:
@@ -200,7 +214,7 @@ def main():
200
214
201
215
ERROR: pixi.toml is not consistent with environment files.
202
216
See above for details.
203
- """ ).format (pixi_toml_content = pixi_toml_content )
217
+ """ ).format (diff_command = shlex . join ( cmd ), diff_output = diff_result . stdout )
204
218
print (message ) # noqa: T201
205
219
sys .exit (1 )
206
220
@@ -245,14 +259,16 @@ def initialize_working_directory(
245
259
pyproject_file = working_path / "pyproject.toml"
246
260
environment_file = working_path / "environment.yml"
247
261
environment_blas_file = working_path / "scripts" / "environment-blas.yml"
248
- pixi_toml_file = working_path / "pixi.toml"
262
+ raw_generated_pixi_toml = working_path / "pixi-raw.toml"
263
+ processed_generated_pixi_toml = working_path / "pixi-processed.toml"
249
264
250
265
return WorkingDirectoryPaths (
251
266
working_path = working_path ,
252
267
pyproject_file = pyproject_file ,
253
268
environment_file = environment_file ,
254
269
environment_blas_file = environment_blas_file ,
255
- pixi_toml_file = pixi_toml_file ,
270
+ raw_generated_pixi_toml = raw_generated_pixi_toml ,
271
+ processed_generated_pixi_toml = processed_generated_pixi_toml ,
256
272
gitignore_file = gitignore_file ,
257
273
)
258
274
@@ -263,7 +279,8 @@ def cleanup_working_directory(working_paths: WorkingDirectoryPaths):
263
279
working_paths .environment_file .unlink ()
264
280
working_paths .environment_blas_file .unlink ()
265
281
working_paths .environment_blas_file .parent .rmdir ()
266
- working_paths .pixi_toml_file .unlink ()
282
+ working_paths .raw_generated_pixi_toml .unlink ()
283
+ working_paths .processed_generated_pixi_toml .unlink ()
267
284
working_paths .gitignore_file .unlink ()
268
285
working_paths .working_path .rmdir ()
269
286
0 commit comments