From 48df20618f09c6f07d19037176ce9b88d769fc94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klaim=20=28Jo=C3=ABl=20Lamotte=29?= <142265+Klaim@users.noreply.github.com> Date: Tue, 12 Nov 2024 10:27:10 +0100 Subject: [PATCH] Fix: json parsing error due to wrong encoding of Python output (#3584) --- .github/workflows/static_build.yml | 19 +++++++++++++++++++ libmamba/src/core/prefix_data.cpp | 7 ++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/static_build.yml b/.github/workflows/static_build.yml index 86039d1898..f839c1ca85 100644 --- a/.github/workflows/static_build.yml +++ b/.github/workflows/static_build.yml @@ -99,6 +99,16 @@ jobs: "micromamba-feedstock/build_artifacts/${{ matrix.platform }}-${{ matrix.arch }}/"micromamba-*.tar.bz2 "pkg/" mkdir -p "${{ github.workspace }}/artifacts" cp pkg/bin/micromamba "${{ github.workspace }}/artifacts" + + - name: Test basic commands + if: ${{ ${{ matrix.arch }} != 'aarch64' && ${{ matrix.arch }} != 'ppc64le' }} + run: | + mkdir test_prefix + ${{ github.workspace }}/artifacts/micromamba --version + ${{ github.workspace }}/artifacts/micromamba --help + ${{ github.workspace }}/artifacts/micromamba env create -y -n testenv -r ./test_prefix "python<3.13" + ${{ github.workspace }}/artifacts/micromamba list -n testenv -r ./test_prefix --log-level 1 + - name: Archive conda-build artifact if: failure() run: tar -czf ${{ github.workspace }}/micromamba-conda-build-failed-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz $MAMBA_ROOT_PREFIX/envs/mambabuild/conda-bld/micromamba_* @@ -181,6 +191,15 @@ jobs: - name: Archive-build artifact if: failure() run: tar -czf ${{ github.workspace }}/micromamba-build-failed-win-64.tar.gz ${{ github.workspace }}/build/ + + - name: Test basic commands + run: | + mkdir test_prefix + ${{ github.workspace }}/build/micromamba/micromamba.exe --version + ${{ github.workspace }}/build/micromamba/micromamba.exe --help + ${{ github.workspace }}/build/micromamba/micromamba.exe env create -y -n testenv -r ./test_prefix "python<3.13" + ${{ github.workspace }}/build/micromamba/micromamba.exe list -n testenv -r ./test_prefix --log-level 1 + - name: Upload build artifacts uses: actions/upload-artifact@v4 if: failure() diff --git a/libmamba/src/core/prefix_data.cpp b/libmamba/src/core/prefix_data.cpp index 68861b4a42..807a03d028 100644 --- a/libmamba/src/core/prefix_data.cpp +++ b/libmamba/src/core/prefix_data.cpp @@ -218,9 +218,14 @@ namespace mamba "pip", "inspect", "--local" }; + + const std::vector> env{ { "PYTHONIOENCODING", "utf-8" } }; + reproc::options run_options; + run_options.env.extra = reproc::env{ env }; + auto [status, ec] = reproc::run( args, - reproc::options{}, + run_options, reproc::sink::string(out), reproc::sink::string(err) );