Skip to content

Commit a531f74

Browse files
authored
Stop setting the LANG env var (#306)
Previously the buildpack would set the `LANG` env var at build and run time to the value `C.UTF-8`, to match the official Docker Python images. However, the env var should not be needed for modern Python, and so the official Docker Python images no longer set it: docker-library/python#887 docker-library/python#895 In addition, the older issues typically only affected other distros such as alpine, or environments where someone had overridden the system locale, which doesn't apply to the Heroku base images. GUS-W-17443565.
1 parent e626723 commit a531f74

File tree

4 files changed

+4
-15
lines changed

4 files changed

+4
-15
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Removed
11+
12+
- Stopped setting the `LANG` env var. ([#306](https://github.com/heroku/buildpacks-python/pull/306))
13+
1014
## [0.20.1] - 2024-12-13
1115

1216
### Fixed

src/layers/python.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,6 @@ fn generate_layer_env(layer_path: &Path, python_version: &PythonVersion) -> Laye
176176
)),
177177
)
178178
.chainable_insert(Scope::Build, ModificationBehavior::Delimiter, "CPATH", ":")
179-
// Ensure Python uses a Unicode locale, to prevent the issues described in:
180-
// https://github.com/docker-library/python/pull/570
181-
.chainable_insert(
182-
Scope::All,
183-
ModificationBehavior::Override,
184-
"LANG",
185-
"C.UTF-8",
186-
)
187179
// We have to set `PKG_CONFIG_PATH` explicitly, since the automatic path set by lifecycle/libcnb
188180
// is `<layer>/pkgconfig/`, whereas Python's pkgconfig files are at `<layer>/lib/pkgconfig/`.
189181
.chainable_insert(
@@ -330,7 +322,6 @@ mod tests {
330322
fn python_layer_env() {
331323
let mut base_env = Env::new();
332324
base_env.insert("CPATH", "/base");
333-
base_env.insert("LANG", "this-should-be-overridden");
334325
base_env.insert("PKG_CONFIG_PATH", "/base");
335326
base_env.insert("PYTHONHOME", "this-should-be-overridden");
336327
base_env.insert("PYTHONUNBUFFERED", "this-should-be-overridden");
@@ -341,7 +332,6 @@ mod tests {
341332
utils::environment_as_sorted_vector(&layer_env.apply(Scope::Build, &base_env)),
342333
[
343334
("CPATH", "/layer-dir/include/python3.11:/base"),
344-
("LANG", "C.UTF-8"),
345335
("PKG_CONFIG_PATH", "/layer-dir/lib/pkgconfig:/base"),
346336
("PYTHONHOME", "/layer-dir"),
347337
("PYTHONUNBUFFERED", "1"),
@@ -352,7 +342,6 @@ mod tests {
352342
utils::environment_as_sorted_vector(&layer_env.apply(Scope::Launch, &base_env)),
353343
[
354344
("CPATH", "/base"),
355-
("LANG", "C.UTF-8"),
356345
("PKG_CONFIG_PATH", "/base"),
357346
("PYTHONHOME", "/layer-dir"),
358347
("PYTHONUNBUFFERED", "1"),

tests/pip_test.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ fn pip_basic_install_and_cache_reuse() {
4040
4141
## Testing buildpack ##
4242
CPATH=/layers/heroku_python/venv/include:/layers/heroku_python/python/include/python3.13:/layers/heroku_python/python/include
43-
LANG=C.UTF-8
4443
LD_LIBRARY_PATH=/layers/heroku_python/venv/lib:/layers/heroku_python/python/lib:/layers/heroku_python/pip/lib
4544
LIBRARY_PATH=/layers/heroku_python/venv/lib:/layers/heroku_python/python/lib:/layers/heroku_python/pip/lib
4645
PATH=/layers/heroku_python/venv/bin:/layers/heroku_python/python/bin:/layers/heroku_python/pip/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
@@ -84,7 +83,6 @@ fn pip_basic_install_and_cache_reuse() {
8483
assert_eq!(
8584
command_output.stdout,
8685
formatdoc! {"
87-
LANG=C.UTF-8
8886
LD_LIBRARY_PATH=/layers/heroku_python/venv/lib:/layers/heroku_python/python/lib
8987
PATH=/layers/heroku_python/venv/bin:/layers/heroku_python/python/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
9088
PIP_PYTHON=/layers/heroku_python/venv

tests/poetry_test.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ fn poetry_basic_install_and_cache_reuse() {
3838
3939
## Testing buildpack ##
4040
CPATH=/layers/heroku_python/venv/include:/layers/heroku_python/python/include/python3.13:/layers/heroku_python/python/include
41-
LANG=C.UTF-8
4241
LD_LIBRARY_PATH=/layers/heroku_python/venv/lib:/layers/heroku_python/python/lib:/layers/heroku_python/poetry/lib
4342
LIBRARY_PATH=/layers/heroku_python/venv/lib:/layers/heroku_python/python/lib:/layers/heroku_python/poetry/lib
4443
PATH=/layers/heroku_python/venv/bin:/layers/heroku_python/python/bin:/layers/heroku_python/poetry/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
@@ -77,7 +76,6 @@ fn poetry_basic_install_and_cache_reuse() {
7776
assert_eq!(
7877
command_output.stdout,
7978
formatdoc! {"
80-
LANG=C.UTF-8
8179
LD_LIBRARY_PATH=/layers/heroku_python/venv/lib:/layers/heroku_python/python/lib
8280
PATH=/layers/heroku_python/venv/bin:/layers/heroku_python/python/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
8381
PYTHONHOME=/layers/heroku_python/python

0 commit comments

Comments
 (0)