Skip to content

Commit

Permalink
Fix: json parsing error due to wrong encoding of Python output (#3584)
Browse files Browse the repository at this point in the history
  • Loading branch information
Klaim authored Nov 12, 2024
1 parent 554d926 commit 48df206
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
19 changes: 19 additions & 0 deletions .github/workflows/static_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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_*
Expand Down Expand Up @@ -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()
Expand Down
7 changes: 6 additions & 1 deletion libmamba/src/core/prefix_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,14 @@ namespace mamba
"pip",
"inspect",
"--local" };

const std::vector<std::pair<std::string, std::string>> 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)
);
Expand Down

0 comments on commit 48df206

Please sign in to comment.