h2oai / datatable

A Python package for manipulating 2-dimensional tabular data structures
https://datatable.readthedocs.io
Mozilla Public License 2.0
1.81k stars 155 forks source link

Fix error with stdout and stderr together in shell command when running git_date update #3480

Open frederikdyrmose opened 10 months ago

frederikdyrmose commented 10 months ago

When compiling from source on aarch64 I encounter an error regarding converting git_date to UTC time due to the inclusion of stderr in stdout:

20.77   Preparing metadata (pyproject.toml): finished with status 'error'
20.84   error: subprocess-exited-with-error
20.84
20.84   × Preparing metadata (pyproject.toml) did not run successfully.
20.84   │ exit code: 1
20.84   ╰─> [15 lines of output]
20.84       Traceback (most recent call last):
20.84         File "/usr/local/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
20.84           main()
20.84         File "/usr/local/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
20.84           json_out['return_val'] = hook(**hook_input['kwargs'])
20.84                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20.84         File "/usr/local/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 152, in prepare_metadata_for_build_wheel
20.84           whl_basename = backend.build_wheel(metadata_directory, config_settings)
20.84                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20.84         File "/tmp/pip-req-build-561biiaw/ci/ext.py", line 491, in generate_build_info
20.84           time.gmtime(int(git_date)))
20.84                       ^^^^^^^^^^^^^
20.84       ValueError: invalid literal for int() with base 10: "12:14:19.175267 git.c:460               trace: built-in: git show -s '--format=%ct' HEAD\n1685547898"
20.84       [end of output]
20.84
20.84   note: This error originates from a subprocess, and is likely not a problem with pip.
20.86 error: metadata-generation-failed
20.86
20.86 × Encountered error while generating package metadata.
20.86 ╰─> See above for output.
20.86
20.86 note: This is an issue with the package mentioned above, not pip.
20.86 hint: See above for details.

This error is fixed by not mixing stdout and stderr in the shell_cmd function. I updated the function, and now it compiles without any problems on linux aarch64, linux x86_64 and windows x86_64 when testing locally.