From 96a25e8cbc83741e9e4511de4e110e316f08d235 Mon Sep 17 00:00:00 2001 From: Ben Richard <143630488+benrichard-amd@users.noreply.github.com> Date: Mon, 17 Mar 2025 16:40:36 -0400 Subject: [PATCH] Remove dependency on en_US.UTF-8 locale (#613) Set locale to C.utf8 instead of en_US.UTF-8 Avoid forcing the user to use en_US.UTF-8. Most Linux systems have C.utf8. --- .github/workflows/ubuntu-jammy.yml | 2 -- docker/Dockerfile.test | 3 --- src/utils/utils.py | 4 ++-- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ubuntu-jammy.yml b/.github/workflows/ubuntu-jammy.yml index 94b92be4f2..27113e61b8 100644 --- a/.github/workflows/ubuntu-jammy.yml +++ b/.github/workflows/ubuntu-jammy.yml @@ -29,8 +29,6 @@ jobs: sudo apt-get install -y git sudo apt-get install -y python3-pip sudo apt-get install -y cmake - sudo apt-get install -y locales - sudo locale-gen en_US.UTF-8 - name: Checkout uses: actions/checkout@v4 - name: Install Python prereqs diff --git a/docker/Dockerfile.test b/docker/Dockerfile.test index 1db802515a..448cf7cb0f 100644 --- a/docker/Dockerfile.test +++ b/docker/Dockerfile.test @@ -13,9 +13,6 @@ RUN apt-get update && apt-get install -y \ # Allows running git commands in /app RUN git config --global --add safe.directory /app -# Generate the desired locale -RUN locale-gen en_US.UTF-8 - # Install Python 3.10 and pip RUN apt-get install -y python3.10 python3.10-venv python3.10-dev python3-pip diff --git a/src/utils/utils.py b/src/utils/utils.py index fa8c4a3f4c..3dd86494f6 100644 --- a/src/utils/utils.py +++ b/src/utils/utils.py @@ -1120,10 +1120,10 @@ def print_status(msg): def set_locale_encoding(): try: - locale.setlocale(locale.LC_ALL, "en_US.UTF-8") + locale.setlocale(locale.LC_ALL, "C.UTF-8") except locale.Error as error: console_error( - "Please ensure that the 'en_US.UTF-8' locale is available on your system.", + "Please ensure that the 'C.UTF-8' locale is available on your system.", exit=False, ) console_error(error)