diff --git a/src/providers/python.rs b/src/providers/python.rs index eafb7c275..6f70b5c9b 100644 --- a/src/providers/python.rs +++ b/src/providers/python.rs @@ -97,16 +97,15 @@ impl PythonProvider { if PythonProvider::is_django(app, env)? && PythonProvider::is_using_postgres(app, env)? { // Django with Postgres requires postgresql and gcc on top of the original python packages - pkgs.append(&mut vec![Pkg::new("postgresql"), Pkg::new("gcc")]); + pkgs.append(&mut vec![Pkg::new("postgresql")]); } let mut setup_phase = Phase::setup(Some(pkgs)); - // Numpy needs some C headers to be available + // Many Python packages need some C headers to be available // stdenv.cc.cc.lib -> https://discourse.nixos.org/t/nixos-with-poetry-installed-pandas-libstdc-so-6-cannot-open-shared-object-file/8442/3 - if PythonProvider::uses_dep(app, "numpy")? || PythonProvider::uses_dep(app, "pandas")? { - setup_phase.add_pkgs_libs(vec!["zlib".to_string(), "stdenv.cc.cc.lib".to_string()]); - } + setup_phase.add_pkgs_libs(vec!["zlib".to_string(), "stdenv.cc.cc.lib".to_string()]); + setup_phase.add_nix_pkgs(vec![Pkg::new("gcc")]); Ok(Some(setup_phase)) } @@ -323,6 +322,7 @@ impl PythonProvider { )) } + #[allow(dead_code)] fn uses_dep(app: &App, dep: &str) -> Result { let requirements_usage = app.includes_file("requirements.txt") && app diff --git a/tests/snapshots/generate_plan_tests__python.snap b/tests/snapshots/generate_plan_tests__python.snap index 3fb2e0085..db055f3a2 100644 --- a/tests/snapshots/generate_plan_tests__python.snap +++ b/tests/snapshots/generate_plan_tests__python.snap @@ -11,7 +11,14 @@ expression: plan "nixPackages": [ { "name": "python38" + }, + { + "name": "gcc" } + ], + "nixLibraries": [ + "zlib", + "stdenv.cc.cc.lib" ] }, { diff --git a/tests/snapshots/generate_plan_tests__python_2.snap b/tests/snapshots/generate_plan_tests__python_2.snap index 3a0a1bdca..10a36da70 100644 --- a/tests/snapshots/generate_plan_tests__python_2.snap +++ b/tests/snapshots/generate_plan_tests__python_2.snap @@ -11,7 +11,14 @@ expression: plan "nixPackages": [ { "name": "python27" + }, + { + "name": "gcc" } + ], + "nixLibraries": [ + "zlib", + "stdenv.cc.cc.lib" ] }, { diff --git a/tests/snapshots/generate_plan_tests__python_2_runtime.snap b/tests/snapshots/generate_plan_tests__python_2_runtime.snap index 3a0a1bdca..10a36da70 100644 --- a/tests/snapshots/generate_plan_tests__python_2_runtime.snap +++ b/tests/snapshots/generate_plan_tests__python_2_runtime.snap @@ -11,7 +11,14 @@ expression: plan "nixPackages": [ { "name": "python27" + }, + { + "name": "gcc" } + ], + "nixLibraries": [ + "zlib", + "stdenv.cc.cc.lib" ] }, { diff --git a/tests/snapshots/generate_plan_tests__python_django.snap b/tests/snapshots/generate_plan_tests__python_django.snap index 46e833574..61053dc1a 100644 --- a/tests/snapshots/generate_plan_tests__python_django.snap +++ b/tests/snapshots/generate_plan_tests__python_django.snap @@ -18,6 +18,10 @@ expression: plan { "name": "gcc" } + ], + "nixLibraries": [ + "zlib", + "stdenv.cc.cc.lib" ] }, { diff --git a/tests/snapshots/generate_plan_tests__python_numpy.snap b/tests/snapshots/generate_plan_tests__python_numpy.snap index bcbe113dc..db055f3a2 100644 --- a/tests/snapshots/generate_plan_tests__python_numpy.snap +++ b/tests/snapshots/generate_plan_tests__python_numpy.snap @@ -11,6 +11,9 @@ expression: plan "nixPackages": [ { "name": "python38" + }, + { + "name": "gcc" } ], "nixLibraries": [ diff --git a/tests/snapshots/generate_plan_tests__python_poetry.snap b/tests/snapshots/generate_plan_tests__python_poetry.snap index 6d8794c27..862dede40 100644 --- a/tests/snapshots/generate_plan_tests__python_poetry.snap +++ b/tests/snapshots/generate_plan_tests__python_poetry.snap @@ -14,7 +14,14 @@ expression: plan "nixPackages": [ { "name": "python38" + }, + { + "name": "gcc" } + ], + "nixLibraries": [ + "zlib", + "stdenv.cc.cc.lib" ] }, { diff --git a/tests/snapshots/generate_plan_tests__python_procfile.snap b/tests/snapshots/generate_plan_tests__python_procfile.snap index 242396d9a..742d163a5 100644 --- a/tests/snapshots/generate_plan_tests__python_procfile.snap +++ b/tests/snapshots/generate_plan_tests__python_procfile.snap @@ -11,7 +11,14 @@ expression: plan "nixPackages": [ { "name": "python38" + }, + { + "name": "gcc" } + ], + "nixLibraries": [ + "zlib", + "stdenv.cc.cc.lib" ] }, { diff --git a/tests/snapshots/generate_plan_tests__python_setuptools.snap b/tests/snapshots/generate_plan_tests__python_setuptools.snap index fce379f63..63fa06484 100644 --- a/tests/snapshots/generate_plan_tests__python_setuptools.snap +++ b/tests/snapshots/generate_plan_tests__python_setuptools.snap @@ -11,7 +11,14 @@ expression: plan "nixPackages": [ { "name": "python38" + }, + { + "name": "gcc" } + ], + "nixLibraries": [ + "zlib", + "stdenv.cc.cc.lib" ] }, {